Formatting page ...
LAMARTINIERE FORBOYS, KOLKATA REHEARSAL EXAMINATION 2024-25 SUBJECT: COMPUTERAPPLICATIONS TIME:2 hrs. + 15min. (Readingtime) CLASS: X FULL MARKS: 100 Answers 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 in reading the question paper. The time given at the head of the question paper is the time allowed for writing 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 of the questions or part of the question are given in [ SECTIONA (Attempt all questions from this Section.) (20] Question 1: Choose the correct answers to the questionsfrom the given options (Do not copy the questions, write the correct answers only) Which among the following is not an example of an infinite loop O. while(true) .forlint i=1;i<2;itt) forl:) d. forlint i=2;i<6;) C. The String class in Java is apart of which package in Java a. java.util Lb. java.lang C. java.io d. java.string Assertion (A): We can have more than one type of constructor in a class Reason (R) :Constructors can be overloaded C. Assertion (A)and Reason (R) both are true and R is the correct explanation of A Assertion (A)and Reason (R) both are true and Ris not the correct explanation of A Assertion (A) is true and Reason (R) is false d. Assertion (A) is false and Reason (R)is true b. 1Comp. App-1/9 (LMB) The expression 4+8%2 will evaluate to 6 b V 2 C. 4 d 1 What wil be the output of the following Javo statement System.out.println("LINGUISTIC". indexOf(T,2): 1 b 5 C -1 d. 7 Variable that is declared with in the body of a method is termed as: a. Instance variable bclass variable G. Local variable d. Argument variable vi. If the statement str.compareTo(str1) returns a value greater than 0, then it implies str is alphabetically lower than str1 1bstr is alphabetically greater than strl C d vii. Both the strings are equal Nothing can be implied from the above statement Assertion (A): Passing arrays as parameters to a function is an example of pure method Reason (R): Impure methods are methods that change the state of an object Assertion (A) and Reason (R)both are true and Ris the correct explanation of A b Assertion (A) and Reason (R )both are true and Ris not the correct explanation of A C. Assertion (A)istrue and Reason (R) is false Assertion (A) is false and Reason (R) is true ix. Ifa user forgets to define a constructor inside a class then, Compilation error occurs b Runtime occurs Logical error occurs d Compiler provides a default constructor C. 1-Comp. App-2/9 (LMB) What is meant by the following statement, X Strings are immutable in Java. a. C. d. X0. Strings cannot be created Strings Cannot be modified once created Strings cannot be used in loops Strings can be changed in Java What will be the output of the statement: System.out.printIn ("A;PHABETS".substring(1,4).charAt(1)); b p d xii. A Consider the following array declaration int arr[]=(60,40,30,20,10}; What will be the output of the following Java statement System.out.printin(arr[1]+arr(2]+) b 70.75 70.0 d Logical error 70 xii. What does the given picture depict Your ID, Pleasel Welcome Ma'em! Good Securlty Guard Moming Sir! Inheritance b. Polymorphism C. d Autoboxing Encapsulation 14-Comp. App-3/9 (LMB) X0V. What is implied, if the value returned by the indexOf(char) method and the lastlndexOflchar) are same and greater than 0 The character has multiple occurrences in the String b. The character has no occurrence in the String The character has only 1occurrence in the String C. d. No inference can be drawn XV. What will be the output of the following code int k=0; for(System.out.printin(Character.isLowerCase('u'));k<1;k++) System.out.printin("Java "); a. It will result in a syntax error b. Java C No output will be displayed true Java xvi. jumbled, choose the Consider the following program segment in which the statements are Uppercase correct order of statements that checks whether the first letter of astring, strlis in or not String str-(k==true)?"begins in Uppercase":"does not begin in Uppercase" (2) char ch=str1.charAt(0); -- boolean k=Character.isUpperCase(ch);a. 2 b xvii. 3 (3) 1 1 3 2 C. 3 1 2 d 3 2 1 Which of the following is a valid declaration of a char? char ch = lu0000: char ca = 'Imb' C. d char cr = \u067; char cc = ilmb'; 10-Comp. App-4/9 (LMB) (1) Which among the following methods toturn an int value a. h toUpperCase() equals() compare To C. d. XIX. isUpperCase() The number of bits occupied by a variable of double data type is 32 b 64 C. 16 XX. The wrapper classcorresponding to the data type char is: character char Character d. The data type char does not have a wrapper class QUESTION 2: (2! Write the Java stutement for the fo!lowing expression AX + vbx +c (2] Evaluate the expression when the valu of p=10 p*= --p + ptt + --p error. ldentify the student is trying t execute the following program but gets an A error, and correct the same to Get the output 5 statement which gets an String str =1CSE 2025' char ch=str.charAt(str.length()), Consider the following array declaration and answer the questions (2] given below [2] int al]|]|=({10,20,30}, (40,50,60}), (70,80,90}}: Whot is the position of the element 90 b. System.out.println(arr[0][1]+arr[1][0]%arr[0|[0|): State one point of difference between autoboxing and unboxing 10-Comp. App-5/9 (LMB) (2] vi. What willbe the output of the following code segment (2) int k=256, m=25,p=0; while(m<30) p+=k%10+ ++m; m+=2; System.out.printin(p); vi. What will be the output of the following code snippet [2) String str="HELLO": String str1=new String("HELLO"); System.out.printin(str==str1); System.out.println(str. compare To(str1)); vii. Classify the following as literals, identifiers or keywords int,sum, "java" (2) ldentify the function prototypes which are overloaded (21 int func(int a, int b) -- double func(int a, int b)-double func(double a, double b) -- X 1 2 - 3 What will be the output of the following code segment String str="HELLO" System.out.printin(str.charAt(1)+5); 10 Comp. App-6/9 (LMB) (2] SECTION B (Answer any four questions from this Section.) The answers in this section should consist of the programs in either Bluel 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. Buffered Reader / Data Input Stream should not be used in the programs. (15) Question 3: Design aclass School with the following specifications : Class name: School Member variables : name -to store the name of the student eng - to store the marks obtained in English maths- to store the marks obtained in Mathematics comp -to store the marks obtained in Computer avg - to calculate and store the average marks obtained by a Student Declare the above methods using appropriate data type Member functions Schooll) - default constructor to initialize the member variables with default values void accept() - to accept the name, marks obtained in English, Mathem atics and Computer void calculate() -to calculate the average and display the grade according to the average obtained as per the following criteria Average Grade Obtained >=90 A 80- 89 B 70-79 60-69 <60 obtained in English, Mathematics, Computer, void display() - displays the name,marks average and the grade obtained. of the class and call Write amain function to create an object 14-Comp. App-7/9 (LMB) the above functions Question 4: (15] Write a program to accept 20 letters in alphabetical order and store them in.a character array. Convert each letter into UpperCase. Accept a letter and search for the presence of the letter in the array usingBinary Search technique. If found display 'character found' otherwise output the message "Character does not exist" Question 5: [15) Define a class to accept a String and display the count of the words that begin with an Uppercase Vowel. For example: Input: EAGLE FLIES IN THE SKY Output:2 Question 6: (15) Design aclass to overload the method calc as follows void calc() - to display the following pattern using nested loop 1 00 00 0 1 0 0 0 001 0 0 000 1 0 000 0 1 int calc(String s) - returns 1 if the string 's' begins and ends with the same letter, else returns 0 double calcfint n) - returns the sum of the following series upto n terms 1.0 + 1.2 + 1.4 + 1.6 + 1.8 + + upto n terms Question 7: (15] Write a program toaccept a number and display each digits of the number in words. For example,if the number is 21355, the output will be Two One Three Five Five 10-Comp. App-8/9 (LMB) Qu stion 8: (15) Design a class to accept values into a 5X5 matrix and find the sum of the non-boundary elements For example, if the array is 1 2 3 5 4 3 2 1 1 5 2 1 1 2 1 1 1 1 1 1 Sum of boundary elements :4+3+2 +0+1 +0+1 +1 +2 =14 14-Comp. App-9/9 (LMB)
|