Formatting page ...
Vile Parle Mahila Sangh s ORION SCHOOL (ICSE) Grade : X DURATION : 2 Hrs Preliminary Examination I (2022-2023) Sub : Computer Applications DATE : 29-11-2022 Max Marks : 100 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 on the reading of the Question Paper. The time given at the head of this Paper is the time allowed for write 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 parts of questions are given in brackets []. Section A (40 Marks) (Attempt all the questions from this section) Question 1 Choose the correct answer and write the correct option. 1. Variables declared within the method body are called (a) Instance variables (b) class variables (c) local variables (d) parameters 2. Find the odd one among the following (a) == (b) *= (c) != (d) >= 3. The operator used to access the members of a class (a) obj (b) new (c) dot (d) this 4. The java package that contains the String class (a) java.string (b) java.lang (c) java.text (d) java.util 5. Which of the following is an exit-controlled loop? (a) while loop (b) do while loop (c) for loop (d) None of these 6. A function is used to set the values of instance variables. (a) Impure (b) Mutator (c) Constructor (d) All of these 7. A function with parameters of primitive data type is. (a) Called by value (b) Calles by reference [20] (c) (a) or (b) (d) None of these 8. Is used to describe a group of objects that have some common attributes and behavior? (a) abstraction (b) inheritance (c) class (d) polymorphism 9. The file with extension .class represents Java (a) Source code (b) Byte code (c) Object code (d) None of these 10. The method of the Scanner class that is used for reading a character from user (a) next() (b) nextChar() (c) nextShort() (d) nextByte() 11. Which of the following is not an access specifier in Java? (a) Private (b) Public (c) Package (d) protected 12. Which primitive data type is converted to object of its corresponding class, it is called as (a) Type conversion (b) Autoboxing (c) nboxing (d) None of the above 13. The operator is right associative. (a) + (b) = (c) && (d) == 14. Number of bits occupied by short data type is: (a) 8 (b) 16 (c) 32 (d) 64 15. What is the output of the following code? System.out.printIn(Math.pow(49,1/2) + Math.sqrt(81)); (a) 0 (b) 9.0 (c) 10.0 (d) 16.0 16. An indentifier is the name given to (a) Variable (b) Method (c) Class (d) All of these 17. The array double[10] occupies: (a) 10 bytes (b) 20 bytes (c) 40 bytes (d) 80 bytes 18. What does the statement System.out.printIn(12/0); result in? (a) Run time error (b) Syntax error (c) Infinity NaN Question 1. Predict the output of the following code : String A = 98.0 , B = 152 ; Double C = Double.parseDouble(A); Double D = Double.parseDouble(B); System.out.printIn( Sum= + C+D); 2. How many times will the following loop get executed? What will be the output? For(int i=1; i<=10; i++) { If(i%2= = 0) Continue; System.out.print(i + , ); } 3. Evaluate the expression to find the final value of x: X += x++ - ++x + x%2 +--x; where x=4 4. Write Java expression for: m(|a3| + 3b2/2) 5. Give output of the following program segment: System.out.printIn(Math.min(-15, Math.floor(-13.8))); System.out.printIn(Math.min(31.5)+Math.floor(-32.-33))); 6. Convert the following code to equivalent ternary statement: If (n%2 == 0) System.out.printIn( Even ); Else System.out.printIn( Odd ); 7. Explain implicit conversion. 8. Rewrite the following code using for loop: Int x=1, s=0; While (x<0) { s=s+x; x++; } System.out.printIn(s); 9. What will be the output of the following code? String x= extra ; String x= experience ; System.out.printIn(x.compareTo(y)); System.out.printIn(y.indexOf(y.charAt(6))); Section B (Answer any four questions.) The answers in this section should consist of programs with Java as the base. Each program should be written using Variable Description / Mnemonic codes such that the logic of the program is clearly depicted. Question 3. [15] Define a class for a Finance company to store information about fixed deposit (FDI) holders, described as below: Data Members: name, amount, term, rate, interest Member Methods: 1. A constructor to initialize the data members. 2. To compute the interest amount and maturity value, based on the number of years of term: Term(years) Interest Rate Up to 1 year 6.25% >1 and up to 3 years 7% >3 and up to 5 years 7.5% >5years 8.25% Note : interest = amount*term*rate/100 Maturity value= amount + Interest 3. To display all the details including the maturity value of Fixed Deposit. 4. main() method to accept the name of the FD holder, amount and term if the FD and create an object of the class to call the other methods. Question 4 [15] Design a class to overload a function display(): void display(): Print the pattern: 1234 567 89 10 boolean display (int n): Check and print if the number n is a palindrome or not; also return true or false accordingly. (A palindrome is a number which reads the same forward and backward) void display (String s): Print the no of vowels in the String. Call the overloaded methods from the main() method. Question 5 [15] Write a Java program to declare an integer array of size N and accept the elements into the array. Search for an element input by the user using Binary Search techniques, display the element with its position if it is found, otherwise display the message NO SUCH ELEMENT . Question 6 [15] Define a class to declare two corresponding arrays to store the name and salary (double datatype) of 20 employees of a company, Accept the elements into the arrays and perform the following: a) Calculate and print the total salary paid to the employees by the company. b) Find the name of the highest paid employee and print it along with the salary. Question 7 [15] Write a program to input a sentence and convert it to uppercase and print each non-space character with its ASCII value. Ex. Input: I am good Output: I 73 A 65 M 77 G 71 O 79 O 79 D 68 Question 8 [15] Write a program to store the names of cities given below, convert them to lowercase and arrange them in alphabetical order. Print the sorted list. Delhi, Visakhapatnam, Bengaluru, Mumbai, Hyderabad, Ahmedabad, Chennai, Kolkata, Surat.
|