Formatting page ...
KRISHNAGAR ACADEMY Pre-Board Examination 2024-25 Class-X Subject: Computer Applications Maximum Marks.: 100 Time: 2 hours Section I (Theory) Question 1. Choose the correct answers to the questions from the given options. [20X1=20] (i) Name the feature of Java that is depicted in the following picture. (a) Encapsulation (b) Data abstraction (c) Polymorphism (d) Inheritance (ii) What will be the output of . ( . ( 10.23)) (a)10.0 (b)11 (c) -11.0 (d) 11.0 (iii) Which of the following expressions is illegal? (a) true && false (b) int j = 5 > 0; (c) char s = \0 ; (d) Integer b; (iv) The size of \n is: a) 1 byte b) 2 bytes c) 4 bytes d) 8 bytes (v) Which among the following is a non-primitive data type? (a) int (b) short (c) Math (d) long (vi) The return data type of trim() method of String class is: (a)int (b) boolean (c) char (d) String (vii) What will be the result produced by the following statement? . ( 8.5) + . ( . ( 8.5)) (a) 1.0 (b) 1 (c) 1 (d) 0 (viii) Evaluate the value of n, = 7, = 13; = %3 < + +/3 ? : ; a) 6 b) 12 c) 7 d) 13 (ix) Name the package that contains the String class. (a) java.lang (b) java.awt (c) java.io (d) java.util (x) Which of the following is invalid literal(s)? 1. 899 2. 24D 3. CHALK 4. \u0000 (a) 1 and 2 (b) Only 2 (c) Only 3 (d) 3 and 4 (xi) Which among the following is not a component of a method? (a) Method name (b) Data members (c) return type (d) Parameters (xii) Once a function is defined, it can be invoked repeatedly. What is this feature called? (a) Reusability (b) Restructuring (c) Interface (d) Reinitializing (xiii) Which of the following is not a jump statement? (a) return (b) continue (c) break (d) default (xiv) Predict the output: . . (" ". (3,8). ()); (a) ms (b) excel (c) ms excel (d) sheet X24-CompApp-Page 1 of 4 (xv) Assertion (A): No side effect occurs in pure function. Reason (R): In pure function, attributes of the passed objects remain unchanged. (a) Both Assertion (A) and Reason (R) are true, and Reason (R) is a correct explanation of Assertion (A) (b) Both Assertion (A) and Reason (R) are true, and Reason (R) is not a correct explanation of Assertion (A) (c) Assertion (A) is false, and Reason (R) is true (d) Assertion (A) is true, and Reason (R) is false (xvi) Identify the operator that gets the lowest precedence among the following: ?: , * , ==, = (a) = (b) * (c) ?: (d) == (xvii) Assertion (A): We always specify the class-name as the return type of a function. Reason (R): A function can return an object as well. (a) Both Assertion (A) and Reason (R) are true, and Reason (R) is a correct explanation of Assertion (A) (b) Both Assertion (A) and Reason (R) are true, and Reason (R) is not a correct explanation of Assertion(A) (c) Assertion (A) is true, and Reason (R) is false (d) Assertion (A) is false, and Reason (R) is true (xviii) The first line of the method definition is termed as: (a) Method prototype (b) Method signature (c) Name (d) Return type (xix) String s = @snvinternational ; then s.lastIndexOf('A') results in: (a) 20 (b) 21 (c) -1 (d) Syntax error (xx) ( , ) { . . ( + ); ( + ); } The above method is a _____ method. (a) Impure (b) Pure (c) Simple (d) static Question 2. [10X2=20] i. What is the data type returned by the following String library functions? a) compareTo() b) equals() ii. Write a statement each to perform the following task on a string: a) Extract the second last character of a word in the variable text. b) Check if the second character of the string str is in uppercase or not. iii. Sam performs bubble sort on the following array to organise the elements in ascending order: {5,1,2,3} After the first comparison the array is: {1,5,2,3} What would be the array after the next comparison? (a) {1,2,5,3} (b) {1,5,3,2} (c) {1,3,5,2} (d) {1,3,2,5} iv. Give the output of the following. . . (" ". ()); . . (" ". (" ")); v. What are the final values stored in x and y below? = . ( . ( 2.53, 5.75)); = . ( . (16.2)); X24-CompApp-Page 2 of 4 vi. Evaluate the given expression when the value of int a=4 and int b=8 = + + + ; vii. Write a java expression for the given mathematical expression. 3 5 + 0.5 3 viii. Rewrite the following code segment using while loop: = 5; ( = 40; >= 20; = 3) { . . ( ); = + 2; } ix. Analyze the following iterative structure and answer the questions with working: = 10, = 20; (+ + <= 20 || + + <= 30) { ( %7 == 0 && %8 == 0) ; . . ( + " " + ); } (a) How many times will the loop get executed? (b) What will be the output? x. State the output of the following code if the input value of int x is (i) 10 (ii)11 ( + +== 11) . . (" 11"); (+ + == 10) . . (" 10"); ( == 10) . . (" 10"); . . (" 10 11"); Section B (60 Marks) (Answer any four questions from this Section.) The answers in this section should consist of the programs in either BlueJ environment or any 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. Flowcharts and algorithms are not required. Question 3 Design a class Electric_Bill_Generation according to the following specifications: [15] Class name : Electric_Bill_Generation Member variables / Data members: long cnum - to store the consumer number long pno - to store the contact number of the consumer int unit - to store number of units consumed double amount - to store the amount to be paid as bill by the consumer Member methods: void accept() - to input the consumer number, consumer contact number and number of units consumed void calculate() - to compute the amount to be paid as bill as per the given slabs: X24-CompApp-Page 3 of 4 Units consumed Up to 100 Next 200 Next 400 Above 700 Charge per unit(in Rupees) 5.5 6.5 7.5 9.5 void show() - to display the consumer number, contact number, number of units consumed and the amount to be paid as bill. Now define a main() method to create an object and invoke the above member methods for obtaining the desired output. Question 4 [15] Define a class to accept a string in uppercase. Now create and display a new string by replacing each vowel by the immediate next letter in the alphabet list and every consonant by the immediate previous letter in the alphabet list while the other characters remain the same. Example: Input: ROYAL@ATS21 Output: QPXBK@BSR21 Question 5: [15] The school office keeps the records of all the students of a class by entering admission numbers and the names of the students. Write a program to store all names along with their corresponding admission numbers. Now, enter admission number of a student and search whether the name is present or not. If the name is present then display the name along with the admission number, otherwise display an appropriate message using Linear Search technique. Question 6 Write a menu driven program to generate the following patterns based on user s input. [15] a) C b) CL ***** CLA **** CLAS *** CLASS ** * Input a Word Input the no. of rows. Question 7 [15] Rahul was asked to create a class with methods to calculate the area of a triangle ( bh), the area of a square (s s), the area of a trapezium ( h(a+b)), the area of a rectangle (l b). He created a class by giving the same name to all the methods as area. Name the element of Java used in the program. Define a class with the four methods with the same name. Question 8 [15] A number is termed as Jupiter number if it is perfectly divisible by the sum of its first and last digits. Now design a class to accept a number, verify whether it is a Jupiter number or not and display the result accordingly with an appropriate message. Example: Suppose a number n = 126 Sum of first digit and last digit = 1 + 6 = 7 The original number 126 is completely divisible by 7. So, 126 is a Jupiter number. X24-CompApp-Page 4 of 4
|