Formatting page ...
Pre Board Examination /Grade X / 1st Dec, 22/Thursday/ Computer Applications /Morning ________________________________________________________________________________ Time Limit: 2 hours MM: 100 Amrita Pandey - 16 Instructions 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 parts of questions are given in brackets [ ]. Section A (40 Marks) Q.1 (i) (ii) Choose the correct answer and write. The_____________ is called the instance of the class. (a) String (b) object (c) blueprint (d) None of these Polymorphism is implemented by using (a) (b) (c) (d) Function overriding Function prototype Function overloading Constructor (iii) Multiple branching statement in java is: (a) switch (b) while (c) for (d) if-else (iv) Find the output of the following code: int s=14; if(s>20) System.out.print( under ); else System.out.print( over ); System.out.print( the limit ); (a) under the limit (b) over the limit (c) under (d) the limit This document consists of 5 printed pages [20] (v) Which of the following keyword makes function non-returnable? (a) public (b) static (c) new (d) void (vi) Choose the odd one out from the following: (a) = (b) ! (c) && (d) || (vii) What will be the output of the expression given below: If a=14; then b= (++a * (a++ + 5)). (a) (b) (c) (d) 120 625 300 230 (viii) double x= Math.ceil(2.4) + Math.pow(2,3) What will be the final value stored in the variable x? (a) 11.0 (b) 12.0 (c) 13.0 (d) 11.5 (ix) The logical operator which is a unary operator (a) && (b) || (c) & (d) ! (x) The number of bytes occupied by the constant 78 is: (a) Four bytes (b) Two bytes (c) Eight bytes (d) One byte (xi) for(int k=1; k<=2; k++) { for(int m=1; m<=4; m++) { System.out.println( Bluej ); }} How many times the inner loop will execute? (a) Four times (b) Sixteen times (c) Two times (d) Eight times This document consists of 5 printed pages (xii) A method with the same name as of the class name and with arguments and with no return type is known as: (a) Wrapper class (b) Parametrized constructor (c) Non- parameterized constructor (d) Default constructor (xiii) Which of the following is not a part of the looping construct? (a) break (b) continue (c) close (d) for (xiv) If a string contains p characters, then what will be the last index? (a) p (b) p-1 (c) p-2 (d) 0 (xv) The output of Integer.parseInt( 23 )*2 is: (a) 23*2 (b) 23 (c) 2 (d) 46 (xvi) What will be the output of the following method KEYBOARD .substring(3,8) (a) (b) (c) (d) (xvii) The array double a[20] occupies : (a) (b) (c) (d) (xviii) 64 bits 8 bits 20 bits 1280 bits What will be the output: int x[]={23,6,3,9,6,12} System.out.println(x[0*2]); (a) (b) (c) (d) (xix) BOARD BOAR OARD B 3 46 23 6 Which of the following packages contain string functions? (a) java.lang (b) java.string (c) java.awt This document consists of 5 printed pages (d) java.math (xx) / by zero is which type of error? (a) (b) (c) (d) Run time error Logical error Syntax error Semantic error Q.2 (i) What will be the output of the given code: String str= STRING System.out.println(str.charAt(2)+ - +str.charAt(3)); [2] (ii) Solve the given expression: int a=6, b=4; z = a++ * ++b - ++a /++b [2] (iii) Identify the errors in the given line and re-write it. int names = {Avni, Rashmi, Nitya, Nivesh} [2] (iv) Write one difference between Linear search and Binary search. [2] (v) Differentiate between the following statements: abc p=new abc(); abc p=new abc(5,7,9); [2] (vi) Give the output of the following method definition: void test(char c) { System.out.println(c+10); } If e is passed to c. [2] (vii) Write a function prototype for the function discount() which accepts two double and one integer values and returns double. [2] (viii) What will be the output of the following loop: int a=5, t=0; while(a<10) { t= a++ + ++a; } System.out.println(t + , +a) [2] (ix) What will be the ouput of the following statements: int des[]={5,8,3,1,0,3,5} des[3]=des[5]; System.out.println(des.length); System.out.println(des[3]+des[5]); [2] (x) Write one difference between a variable and subscripted variable. [2] This document consists of 5 printed pages Section - B (Attempt any four questions in this section) Q.3 Define a class with the following specifications: Class name : employee Member variables: eNum- employee Number eName- employee name age age of the employee basic basic salary (Declare the above variables with appropriate data types) Member methods: employee()- default constructor to initialize all instance variables with their default values. void accept() to accept the details of the employee void calculate to calculate net salary as per the details: net=basic+da+hra-pf hra=15% of basic da = 20% of basic pf= 12% of basic If the age of the employee is 50 or above, then gets an additional allowance of Rs. 5000. void print()- to print the details of the employee- eNum, eName, age, basic and net pay. Write the main method to create an object and call all the methods. [15] Q.4 Write a program to accept a number and check whether it is a duck number or not. A number is called a duck number if it contains zero(0) in it. Examples of duck numbers: 3405, 5690, 2034 [15] Q.5 Write a program to overload a function print() as per the details given below: (a) void print (String st, Char ch) to display all vowels in the string if ch is v else display all the characters. (b) void print (String s1, String s2) to find the length of the strings and compare which string is larger out of two. (c) void print (int n) to check whether the number in n variable is prime number or not. [15] Q.6 Design a class to accept 10 integers in an array and arrange them in ascending order using the bubble sort technique. Display the sorted array. [15] Q.7 Write a program to accept the names of 30 students in an array and display all the names that starts with SH . [15] Q.8 Write a program to accept names of 20 books in string array and check for the existence of the given book name in the array using linear search. If found print the position of the name and if not found print the appropriate message. [15] .. . All the Best This document consists of 5 printed pages
|