Formatting page ...
GARDEN HIGH SCHOOL CLASS X Half-Yearly Examination, 2022 23 Computer Applications (Theory) Time: 2 hours Full Marks: 100 This Question Paper has seven printed pages. Answers must be written in the script/s provided. You will not be allowed to write for the first 15 minutes. This time must be spent in reading the Question Paper. The time given at the head of this Paper is the time allowed for writing answers. This Paper is divided into two sections. Answer all the questions of Section A, and any four of Section B. Maximum marks for a question or parts of a question are given in brackets [ ]. SECTION A (40 marks) Answer all the questions. Question No 1 Choose the correct options: [20] (a) _____ is an example of a reference data type. (i) Class (ii) Object (iii) Double (iv) Integer (b) The package which contains the Math class is _____. (i) java.io (iii) java.util (ii) java.lang (iv) java.net (c) Math.ceil( 4.7) will return _____. (i) 4 (ii) 4.0 (iii) 5 (d) Find the output of the following: System.out.println("Incredible" +"\n" + "India"); (i) IncredibleIndia (iii) IncredibleIndia India (ii) Incredible India (iv) Incredible India (iv) 5.0 (2) (e) How many times will the following loop execute? int i; for(i=5; i>10; i++) System.out.println(i); System.out.println(i*4); (f) (i) 5 times (iii) 6 times (ii) 4 times (iv) Loop will not execute. Predict the output of the following: System.out.println(1+9+ "Ten"); System.out.println("Ten" + 1+9); (i) 19Ten (iii) 19Ten Ten19 Ten10 (ii) 10Ten (iv) 10Ten Ten19 Ten10 (g) What is the output of the following when ch = 'i' ? switch(ch) { case 'a' : case 'e' : case 'i' : case 'o' : case 'u' : System.out.println(" It is a vowel " ); break; default: System.out.println(" It is not a vowel " ); } (i) It is a vowel (ii) It is not a vowel (iii) It is a vowel It is not a vowel (iv) There will be no output. (3) (h) The prototype of a function func() which receives a word and an integer and returns 1 or 0 is: (i) (i) int func(String word, int num) (iii) func(String word, int num) (ii) boolean func(String word, int num) (iv) boolean func(String word, long num) What is the output of the following? System.out.println("TRANSPARENT".compareTo("TRANSITION")); (i) 6 (j) (ii) 7 (iii) 7 (iv) 6 The indexOf() function returns the index within the string of the first occurrence of the specified character or _____ if the character is not present. (i) 1 (ii) 1 (iii) 0 (iv) 2 (k) _____ methods are methods without any side-effects. (i) Impure (l) (ii) Pure (iii) Procedural (iv) Manipulative (iii) declaration (iv) instantiation Creating a new object is known as _____. (i) initialization (ii) referencing (m) A function s argument list is known as the function s _____. (i) prototype (ii) actual parameter (iii) return type (iv) signature (n) Name the data type that cannot be used as a switch case constant. (i) int (ii) char (iii) double (iv) String (o) Which of the following is not a jump statement in Java? (i) break (ii) continue (iii) return (iv) terminate (p) Identify the correct statement. (i) A constructor has void as the return type. (ii) A constructor does not accept any parameters. (iii) A constructor has the same name as the class name. (iv) A constructor can be used for calculations. (q) The Scanner class is present in the _____ package. (i) java.io (ii) java.util (iii) java.awt (iv) java.net (4) (r) Name the unit of a class which gets called when an instance of the class is created. (i) member method (iii) main() (ii) constructor (iv) data member (s) A _____ is a region in a program within which a variable is accessible. (i) constructor (t) (ii) scope (iii) function (iv) class Name the access specifier which when used makes the members available to all classes in the same package, but not available to any classes in other packages, even sub classes. (i) private (ii) protected (iii) friendly (iv) public Question No 2 (a) What is the value of y after evaluating the following expression? [2] int y=8; y+= ++y + y-- +--y; (b) Convert the following to a for loop: [2] int i=1, d=5; do { d=d*2; System.out.println(d); i++; } while(i<=5); (c) Differentiate between break and System.exit(0). [2] (d) char ch='y'; [2] char chr= Character.toUpperCase(ch); int p=chr; System.out.println(chr +" " + p); (e) Write the Java expression for the following: z= x3 + y3 (2xy 3) [2] (5) Question No 3 (a) Write the output of the following code snippet: [3] int i, j; for(i=3; i<=4; i++) { for(j=2; j<i; j++) { System.out.print(" "); } System.out.println("WIN"); } (b) Find the output of the following: (i) for( int i=5; i>=0; i--) [3] System.out.print(--i * ++i + ","); (ii) String x="information"; System.out.println((x.substring(1,5)).replace('o', 'e')); (c) Rewrite the following using an 'if' construct: [2] [2] int sales=30000; totsal= sales + (sales >=10000 ? 5.0/100 * sales : 2.0/100 * sales); SECTION B (60 marks) Answer any four questions. Answers should consist of programs in either Blue J environment or any program environment with Java as the base. Variable Descriptions/Mnemonic Codes should be used to write each program so that the logic of the program is clearly demonstrated. Flow charts and algorithms are not required. Question No 4 Write a program to input a number. Check and print whether the number is an Adam number or not. (Adam number: The square of the number and the square of its reverse are reverse to each other. Eg. n=13 and reverse of n is 31. 132=169 and 312=961 which is reverse of 169. Thus, 13 is an Adam number) [15] (6) Question No 5 Write a program to input a word in uppercase. Count and print the number of letters present in the word excluding the vowels. [15] Sample input: HAPPY Sample output: 4 Question No 6 Design a class to overload a function series() as follows: [15] (a) void series( int a ): returns the sum of the following series: s= a/2 -a/3 + a/4 + . + a/10 (b) void series( int x, int n ): returns the sum of the following series: s= x2/2! + x4/4! + x6/6! + ..+ xn/n! Question No 7 Write a menu-driven program to display the following patterns as per the user's choice: (a) ABCDE [15] (b) B ABCD LL ABC UUU AB EEEE A JJJJJ Question No 8 A non-palindrome word can be made a palindrome word just by adding the reverse of the word to the original word. Write a program to accept a non-palindrome word and display the new string after making it a palindrome. Sample input: ICSE Sample output : ICSEESCI [15] (7) Question No 9 Define a class Stream as described below: [15] Data members: String name, double phy, chem, bio, math, avg Member functions: (a) a parameterized constructor to initialize the data members (b) void choiceStream() to display the choice of Stream based on the following criteria: Average Marks Stream >90 Science >70 Commerce <=70 Humanities (c) void display() to display all the details of a student Write a main() method to create an object of the class and call the above methods.
|