Formatting page ...
COMPUTER APPLICATIONS (Theory) (Two Hours) Answer to this paper must be written on the paper provided separately. You will not be allowed to write during the first 15 minutes. This time is to be spent in reading the question paper. The time given at the head of this paper is the time allowed for writing the answers. This paper is divided into two Sections. Attempt all questions from Section A and any four questions from Section B. The intended marks for questions or part of questions are given in brackets[]. Section A (40 Marks) Attempt all questions Question 1 a) What is the output of the following code snippet? [2] char ch1 = # , ch2= 8 ; System.out.println(Character.isDigit(ch1)); System.out.println(Character.isDigit(ch2)); System.out.println(Character.isLetter(ch1)); System.out.println(Character.isLetter(ch2)); b) What will be the output of the following statements when executed one after other? char a[]={ J , A , V , A }; int b=1; System.out.println(a[++b]); System.out.println(a[b]++); [2] c) Give the output of the following: String st1= Computer Knowledge , st2= Computer Applications ; System.out.println(st1.substring(0,9).concat(st2.substring(10))); System.out.println(st1.lastIndexOf( e )); [2] d) i) Name the keyword that makes the variable constant in a program. ii) Name the keyword that makes the system to report an error. [2] e) Differentiate between equals() and equalsIgnoreCase() [2] 1 ICSE (Grade : X) | COMPUTER APPLICATIONS (Theory) | Pre Board Exam-II Question 2 (a) What is access specifier? Name any two access specifiers. [2] (b) String S1= computer , S2= computers ; System.out.println(S1.compareTo(S2)); [2] (c) What is the purpose of new operator? Give an example where new operator is used. [2] (d) What is library class? Name any two library classes. [2] (e) Name the wrapper class of the following primitive data types. (i) int (ii) boolean (iii) long (iv) char [2] Question 3 a) Predict the output of the following : double a=-23.4, b=12.4; int c=49; (i) System.out.println(Math.sqrt(c)); (ii) System.out.println(Math.ceil(Math.(min(a,b)))); [2] b) Name the methods of scanner class that: (i) is used to input an integer data from standard input stream. (ii) is used to input a String data from standard input stream. [2] c) Differentiate between Linear search and Binary search. [2] d) Write the statement to perform the following task: (i) to find and display the position of the first space in a string Str. (ii) to find and display the position of the last space in a string Str. [2] e) Predict the output of the following code : int a[]={1,3,5,7,9,11}; int l=a.length,i,j; for(i=0,j=l-1;i<l/2;i++,j--) { a[i]=a[j]-a[i]; } for(i=0;i<l;i++) { System.out.print(a[i]+" "); } [2] f) Write the output of the code given below: double ans=Math.pow("345".indexOf('5'),3); System.out.println(ans); [2] g) Write the total memory required in bytes for the arrays a[5] of character data type and p[4] of float data type. [2] 2 ICSE (Grade : X) | COMPUTER APPLICATIONS (Theory) | Pre Board Exam-II h) Write a statement to perform the following: (a) to store the number 123 as a String. (b) to convert the String St to an integer value. [2] i) Differentiate between length() and length functions [2] j) What is error? How logical error differs from syntax error? [2] Section B (60 Marks) Attempt any four questions from this Section. The answers in this Section should consist of the Programs in either Blue J environment or any other program environment with Java as the base. Each program should be written using Variable description/Mnemonic codes so that the logic of the program is clearly depicted. Flow-Charts and Algorithm are not required. Question 4. Write a program to accept a word from the user and print as the pattern below. [15] Sample input : BASIC B BA BAS BASI BASIC BASI BAS BA B Question 5. Design a class Salary with the following description. Instance Variables/Data Members: name[] array to store names of 20 employees netsal[] - array to store net salary of 20 employees 3 ICSE (Grade : X) | COMPUTER APPLICATIONS (Theory) | Pre Board Exam-II [15] Member Functions: void input() - to accept the names of 20 employees and their corresponding net salaries. void selection() - to sort the array netsal[] in descending order and arrange the name accordingly using selection sort technique void print() - to display sorted data in the following format Name Net salary .. Question 6 [15] Write a program to accept a sentence from the user and print the number of words that starts and ends with a vowel (ignore the case) Sample Input : India is my country. Sample output: 1 Question 7 [15] Write a program to store 20 different names in a Single Dimensional Array .Enter a name from the console and search weather the name is present or not using Linear Search technique. If the name is present then display the name and the location from the array otherwise, display the message Name is not present in the list . Question 8 [15] Write a program to input a sentence from the user and arrange the words in alphabetical order. (Assume that the input is in lower case) Sample Input : learning computer is fun Sample output: computer fun is learning Question 9 [15] Write a program to accept 10 names in an array. Arrange the names in alphabetical order by Bubble sort technique and print the sorted list. 4 ICSE (Grade : X) | COMPUTER APPLICATIONS (Theory) | Pre Board Exam-II
|