Trending ▼   ResFinder  

ICSE Class X Board Exam 2017 : Computer Applications (Solved Paper)

11 pages, 40 questions, 3 questions with responses, 3 total responses,    1    0
Sumanta Pan
Oxford High School, Howrah
+Fave Message
 Home > sumanta4evr >   F Also featured on: School Page

Formatting page ...

ICSE Question Paper 2017 (Solved) Computer Applications Class X SECTION A (40 Marks) Answer all questions from this Section SECTION A (40 MARKS) Attempt all questions Question 1: a) What is Inheritance ? [2] Ans. Inheritance is the process by which one class extends another class to inherit the variables and functions and add any additional variables and methods. b) Name the operators listed below [2] i) < ii) ++ iii) && iv) ?: Ans. i) Less than comparison operator ii) Increment operator iii) And logical operator iv) Ternary operator c) State the number of bytes occupied by char and int data types.[2] Ans. char occupies two bytes and int occupied 4 bytes. d) Write one difference between / and % operator. [2] Ans. / is division operator while % is modulus operator which gives the remainder on dividing two numbers. e) String x[] = { SAMSUNG , NOKIA , SONY , MICROMAX , BLACKBERRY }; Give the output of the following statements:[2] i) System.out.println(x[1]); ii) System.out.println(x[3].length()); Ans. i) NOKIA ii) MICROMAX .length() = 8 Question 2: a) Name of the following: [2] i) A keyword used to call a package in the program. ii) Any one reference data types. Ans. i) import ii) String b) What are the two ways of invoking functions? [2] Ans. Call by value and call by reference c) State the data type and value of res after the following is executed : [2] char ch = t ; res = Character.toUpperCase(ch); Ans. Data type of res is char and value is T d) Give the output of the following program segment and also mention the number of times the loop is executed: [2] int a,b; for(a=6,b=4;a<=24;a=a+6) { if(a%b==0) break; } System.out.println(a); Ans. Loop initialization: a = 6, b = 4 First iteration: Condition check: a <= 24 that means (6 <= 24) , which is true Loop is executed for the first time Loop execution: a % b = 6 % 4 = 2 != 0 Hence, break is not executed Loop increment operator: a = a + 6 that means ( a = 6 + 6 ), then a is updated to 12 Second iteration: Condition check: a <= 24 that means (12 <= 24) , which is true Loop is executed for the second time Loop execution: a % b = 12 % 4 = 0 = 0 Hence, break is executed System.out.println(a); This statement will print 12 Output is 12 and loop is executed two times e) Write the Output: [2] char ch= 'F'; int m=ch; m=m+5; System.out.println(m+ " " +ch); Ans. ch = F int m = ch; From this statement ASCII value of F i.e. 70 will be assigned to m m = m + 5 = 70 + 5 = 75 System.out.println(m+ +ch); & this statement will print 75 F Output is 75 F Question 3: a) Write a Java expression for the following : [2] ax5 + bx3 + c Ans. a * Math.pow(x, 5) + b * Math.pow(x, 3) + c b) What is the value of x1 if x=5 ? [2] x1=++x x++ + x Ans. x1=++x x++ + x x1 = 6 (x is incremented to 6) 6 (x is incremented to 7) + 6 (x is decremented to 6) =6 c) Why is an object called an instance of a class? [2] Ans. An object is called an instance of a class as every object created from a class gets its own instances of the variables defined in the class. Multiple objects can be created from the same class. d) Convert following do-while loop into for loop. [2] int i=1; int d=5; do{ d=d*2 System.out.println(d); i++; }while(i<=5); Ans. for(int i=1, d=5; i<=5; i++) { d = d * 2; System.out.println(d); } e) Differentiate between constructor and function. [2] Ans. The constructor of a class is invoked automatically during object creation while a function is invoked manually after object creation. A constructor is invoked only once while a function can be invoked multiple times. A constructor has the same name as the class in which it is defined while a function can have any name. f) Write the output for the following: [2] String s= "Today is Test"; System.out.println(s.indexOf('T')); System.out.println(s.substring(0,7)+ " "+ "Holiday"); Ans. So the first println method , System.out.println(s.indexOf( T )); will print the index of T, which is 0 (zero) & second println method will take substring stored from 0 to 7th index & concatenate it with a String Holiday Today i + + Holiday Today i Holiday Output is 0 Today i Holiday g) What are the values stored in variables r1 and r2: [2] i) double r1 = Math.abs(Math.min(-2.83,-5.83)); ii) double r2 = Math.sqrt(Math.floor(16.3)); Ans. i) double r1 = Math.abs(Math.min(-2.83,-5.83)); = Math.abs(-5.83) = 5.83 ii) double r2 = Math.sqrt(Math.floor(16.3)); = Math.sqrt(16) = 4.0 h) Give the output of the following code: [2] String A= "26", B= "100" ; String D=A+B+ "200"; int x= Integer.parseInt(A); int y=Integer.parseInt(B); int d=x+y; System.out.println("Result 1=" +D); System.out.println("Result 2="+d); Ans. String A= 26 , B= 100 ; A = 26 , B = 100 String D=A+B+ 200 ; By doing this, value of A will concatenate with value of B & further these are concatenated with String 200 So , D = 26 + 100 + 200 = 26100200 int x= Integer.parseInt(A); x = Integer.parseInt( 26 ) , By doing this String 26 will converted into Integer 26 , and it will be assigned into variable x int y=Integer.parseInt(B); y= Integer.parseInt( 100 ) , Similarly String 26 will be converted into Integer 26 , and it will be assigned into variable y int d=x+y; d = 26 + 100 = 126 System.out.println( Result 1= +D); Result 1=26100200 System.out.println( Result 2= +d); Result 2=126 Output is Result 1=26100200 Result 2=126 i) Analyze the given program segment and answer the following questions [2] for(int i=3;i<=4;i++) { for(int j=2;j<i;j++) { System.out.print(" "); } System.out.println("WIN"); } i) How many times does the inner loop execute ? ii) Write the output of the program segment. Ans. The output loop runs twice, with i = 3 and i = 4 When i = 3, the inner loop runs once with j = 2 When i = 4, the inner loop runs twice with j = 2 and j = 3 i) Inner loop executes 3 times ii) WIN WIN j) What is the difference between the Scanner class functions next() and nextLine()? [2] Ans. next() read a single token i.e. all characters from the current position till a whitespace or tab or new line is encountered. nextLine() reads an entire line i.e. all characters from the current position till a new line is encountered. SECTION B (60 Marks) Attempt any four questions from this Section. Question 4. Define a class Electric Bill with the following specifications: [15] class: ElectricBill Instance Variable/ data member: String n to store the name of the customer int units to store the number of units consumed double bill to store the amount to paid Member methods: Void accept() to accept the name of the customer and number of units consumed Void calculate() to calculate the bill as per the following tariff : Number of units Rate per unit First 100 units Rs.2.00 Next 200 units Rs.3.00 Above 300 units Rs.5.00 A surcharge of 2.5% charged if the number of units consumed is above 300 units. Void print() To print the details as follows : Name of the customer Number of units consumed Bill amount . Write a main method to create an object of the class and call the above member methods. Ans. import java.util.Scanner; public class ElectricBill { private String n; private int units; private double bill; public void accept() { Scanner kb = new Scanner(System.in); System.out.print("Enter name: "); n = kb.next(); System.out.print("Enter units: "); units = kb.nextInt(); } public void calculate() { if (units<= 100) { bill = units * 2; } else if (units>100 && units<=300) { bill = units * 3; } else { bill = units * 5; double surcharge = bill * 2.5 / 100; bill = bill + surcharge; } } public void print() { System.out.println("Name of the customer: " +n); System.out.println("Number of units consumed: " +units); System.out.println("Bill amount: " +bill); } public static void main(String[] args) { ElectricBill EB = new ElectricBill(); EB.accept(); EB.calculate(); EB.print(); } } Sample output Enter name: Atharv Enter units: 50 Name of the customer: Atharv Number of units consumed: 50 Bill amount: 100.0 Question 5. Write a program to accept a number and check and display whether it is a spy number or not. [15] (A number is spy if the sum its digits equals the product of the digits.) Example: consider the number 1124 , sum of the digits = 1 + 1 + 2 + 4 = 8 Product of the digits = 1 x 1 x 2 x 4=8 Ans. import java.util.Scanner; public class SpyNumber { public static void main(String[] args) { Scanner kb = new Scanner(System.in); System.out.print("Enter number: "); int n = kb.nextInt(); int sum = 0; int product = 1; while (n>0) { int r = n % 10; sum = sum + r; product = product * r; n = n / 10; } if (sum == product) { System.out.println("Spy number"); } else { System.out.println("Not a spy number"); } } } Sample output 1 Enter number: 1124 Spy number Sample output 2 Enter number: 1254 Not a spy number Question 6. Using switch statement, write a menu driven program for the following: [15] i) To find and display the sum of the series given below: S = x1 x2 + x3 x4 + x5 x20 (where x=2) ii) To display the following series: 1 11 111 1111 11111 For an incorrect option, an appropriate error message should be displayed. Ans. import java.util.Scanner; public class MenuDriven { public static void main(String[] args) { System.out.println("Press 1 for Sum of series"); System.out.println("Press 2 for Display Series"); System.out.print("Enter your choice: "); Scanner kb = new Scanner(System.in); int choice = kb.nextInt(); switch (choice) { case 1: double sum = 0; for (int i = 1; i <= 20; i++) { if (i % 2 == 1) { sum = sum + Math.pow(2, i); } else { sum = sum - Math.pow(2, i); } } System.out.println("Sum = " + sum); break; case 2: for (int i = 1; i<= 5; i++) { for (int j = 1; j<= i; j++) { System.out.print("1"); } System.out.print(" "); } break; default: System.out.println("Invalid choice"); break; } } } Sample output 1 Press 1 for Sum of series Press 2 for Display Series Enter your choice: 1 Sum = -699050.0 Sample output 2 Press 1 for Sum of series Press 2 for Display Series Enter your choice: 2 1 11 111 1111 11111 Sample output 3 Press 1 for Sum of series Press 2 for Display Series Enter your choice: 3 Invalid choice Question 7. Write a program to input integer elements into an array of size 20 and perform the following operations: [15] i) Display largest number from the array ii) Display smallest number from the array iii) Display sum of all the elements of the array Ans. import java.util.Scanner; public class MyArray { public static void main(String[] args) { Scanner kb = new Scanner(System.in); int[] arr = new int[20]; System.out.print("Enter 20 numbers in an array: "); for (int i = 0; i < 20; i++) { arr[i] = kb.nextInt(); } int smallest = arr[0]; int largest = arr[0]; int sum = 0; for (int i = 0; i < 20; i++) { if (arr[i] < smallest) { smallest = arr[i]; } if (arr[i] > largest) { largest = arr[i]; } sum = sum + arr[i]; } System.out.println("Smallest = " + smallest); System.out.println("Largest = " + largest); System.out.println("Sum = " + sum); } } Sample output Enter 20 numbers: 1 2 3 4 5 6 7 8 9 8 5 4 2 4 5 6 8 4 7 82 Smallest = 1 Largest = 82 Sum = 245 Question 8: Design a class to overload a function check() as follows: i) void check(String str, char ch) to find and print the frequency of a character in a string. Example : Input Output Str = success number of s present is=3 ch = s ii) void check (String s1) to display only the vowels from string s1 , after converting it to lower case. Example : Input: S1= computer output: o u e Ans. public class Overload { public void check(String str, char ch) { int result = 0; for (int i = 0; i < str.length(); i++) { char currentChar = str.charAt(i); if (ch == currentChar) { result++; } } System.out.println("number of s present is = " + result); } public void check(String s1) { s1 = s1.toLowerCase(); for (int i = 0; i < s1.length(); i++) { char currentChar = s1.charAt(i); if (currentChar == 'a' || currentChar == 'e' || currentChar == 'i' || currentChar == 'o' || currentChar == 'u') { System.out.print(currentChar + " " ); } } } } Question 9: Write a program to input forty words in an array. Arrange these words in descending order of alphabets, using selection sort technique. Print the sorted array. Ans. import java.util.Scanner; public class SelectionSort { public static void main(String[] args) { // Accept 40 words Scanner kb = new Scanner(System.in); String[] words = new String[40]; System.out.println("Enter 40 words: "); for (int i = 0; i < 40; i++) { words[i] = kb.nextLine(); } // Sort using selection sort for (int i = 0; i < words.length - 1; i++) { int largestWordIndex = i; for (int j = i + 1; j < words.length; j++) { if (words[j].compareTo(words[largestWordIndex]) > 0) { largestWordIndex = j; } } String temp = words[largestWordIndex]; words[largestWordIndex] = words[i]; words[i] = temp; } // Print sorted array for (int i = 0; i < 40; i++) { System.out.println(words[i]); } } }

Formatting page ...

Related ResPapers
ICSE Class X Board Exam 2020 : Computer Applications
by icse 
ICSE Class X Board Specimen 2024 : Computer Applications
by trengzmyfoot67568 
ICSE Class X Board Specimen 2025 : Computer Applications
by pawanhava 
ICSE Class X Board Exam 2020 : Computer Applications
by makali 

Formatting page ...

Top Contributors
to this ResPaper
(answers/comments)


Sumanta Pan

(3)

ResPaper Admins

(1)

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

 

  Print intermediate debugging step

Show debugging info


 

Additional Info : ICSE Class X Board Exam 2017 : Computer Applications (with Solutions)
Tags : ICSE Class X Board Exam 2017 : Computer Applications (with Answers),  


© 2010 - 2025 ResPaper. Terms of ServiceContact Us Advertise with us

 

sumanta4evr chat