Formatting page ...
II TERM EXAMINATION : 2020-21 Class - X (ICSE) Subject - Computer Applica on Time : 2 hrs. M.M. : 100 Answers to this paper must be written on the paper provided separately. You will not be allowed to write during the rst 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 to write the answers. This paper is divided into TWO sections. Answer ALL the questions in Section A and any FOUR questions from Section B. The intended marks for questions or parts are given in [ ]. SECTION - A [40 MARKS] Attempt ALL questions from this section. Q.1- a. b. c. d. e. Q.2- a. b. c. d. e. Q.3- a. What do you understand by the term abstraction? Explain with an example. Why is Java a platform independent language? Name the primitive data type in Java that is : i. A 64 bit integer and is used when you need a range of values wider than those provided by int. ii. A single 16 bit Unicode character whose default value is \u0000 . What is the use of escape sequence '\n' and '\t ? Find the output of z if : int y = 14; int z = ++y * ( y + y ); Differentiate between equals( ) and compareTo( ) methods with appropriate example. Name the wrapper classes of char type and boolean type. Write different ways of writing comments in Java programs. Distinguish between Math.ceil( ) and Math. oor( ) with the help of examples. Rewrite using if-else : comm = (sale > l 5000) ? sale * 5/l 00:0; Write a Java expression for the following: a+b - cd a + b2 Write the output for the following statements: String strl = "Java is Fun"; String str2 = "amytime"; System.out.println(str2.replace('m',,n')); System.out.println(strl.concat(str2)); Give the output for the following statements: i. Math. oor(8.96); ii. Math.min(10, 23) + Math.pow(2, 3); f= b. c. [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] 2 [2] [2] This paper consists of 3 printed pages and 1 blank page. Turn Over d. e. f. g. h. i. Analyse the following program segment and answer the following segment: [2] i. Write the output of the program segment. ii. How many times the body of the loop gets executed. for(int a = 10; a <= 50; a += 4) { if(a% 6 = 0) break; else if(a% 5 == 0) System.out.println(a); } If int n[ ] = {l, 2, 3, 5, 7, 9, 13, 16} what are the values of x and y? [2] x = Math.pow(n[4],n[2]); y = Math.sqrt(n[5]+n[7]); Differentiate between auto-boxing and auto-unboxing. [2] Write the wrapper class and also the return type of function isLetterOrDigit( ). [2] Convert the following if-else-if construct into switch case: [4] if(var == 'A') { System.out.println("good"); } else if(var == 'B') { System.out.println("very good"); } else if(var == 'C') { System.out.println("excellent"); } else { System. out.println("work hard"); } Convert the following segment into an equivalent while loop [2] int x, c; for(x = 10, c = 20; c >10; c = c 2) x++; 2 SECTION - B [60 MARKS] Attempt any FOUR questions from this Section. The answers in this section should consist of the programs either Blue J environment or any program environment with JAVA as the base. Each program should be written using variable description/mnemonic codes such that the logic of the program clearly depicted. Flow charts and algorithms are not required. Q.4- Write a program to accept a sentence. Display the longest word and also the length of the longest word of the sentence. [15] Q.5- Write a program to input a number and check whether it is a magic number or not. A number is said to be Magic number if the sum of its digits are calculated till a single digit is obtained by repeatedly adding the sum of its digits. lf the single digit comes to be 1 then the number is a magic number. Example : 199 1 + 9 + 9 = 19 1 + 9 = 10 1 + 0 = 1 After repeatedly adding the digits till it comes to single digit we get l, thus 199 is a magic number. [15] Q.6- Write a program to create an integer array of 20 elements. Sort the array using bubble sort technique and display the sorted array. [15] Q.7- The Electricity Board charges the bill according to the number of units consumed and the rate is as given below:: Units consumed Rate per unit First 100 units 80 paise per unit Next 200 units ` 1 per unit ` 2.50 per unit Above 300 units Write a program to accept the total units consumed by a customer and calculate the bill. Assume that meter rent of ` 500 is charged from the customer. [15] Q.8- Write a menu driven program to display the following patterns on the screen depending on the user's choice. [15] a. 5 4 3 2 1 b. E 4 3 2 1 E X 3 2 1 E X A 2 1 E X A M Q.9- Write a program that inputs a string and a word separately. The program then nds the frequency of the word in the string. [15] Sample Input : The red bottle is kept on the table. The Sample Output : Frequency of The is 2. ##### 3
|