Formatting page ...
Page 1 of 4 THE ASSEMBLY OF GOD CHURCH SCHOOL 125/1, Park Street, Kol 17 Half Yearly Examination - 2024-25 Computer Application Class: 10 Time: 2 Hr [+1S min reading time] Date: Full Marks : 100 Section A[40 Marks] (All questions are compulsory ) Question 1: Choose the correct answer and write the corect option along with its content: i. [20x1=20] Observe the given image and choose the most applicable O0P concept Mufasa, the king of Pride Rock Territory' is killed in a plan conspired by Scar, his cousin. Mufasa's son Simba is blamed and sent away. MUFASA Later when Simba grows up, he wins back his father's kingdom and grows it further. SIMBA (a) Encapsulation ii. (c) Polymorphism (d) Abstraction (b) cquals( ) (c) toUpperCase( ) (d) floor(0 Find the odd one out : (a) replace() ii. (b) Inheritance A member visible to its own class and to all its subclasses is declared with which of the following access? (d) none of these (b) protected (c) private (a) public is mainly used to initialize values to instance variables. (b) A constructor (c) A class (a) A method Which one of the below is a binary relational operator? (b) J (a) == vi. vii. vii. ix. X. xi. What is the return type of a constructor? (b) double (a) int Given that : GS.0 Type of String is (a) primitive (b) reference Whigh of the following is not a wrapper class: (YBoolean (c) + (d) && (c) void (d) No return type double x-Math.ceil(Math.abs(-7.3); (a) 7.0 (b) Double (d) An object final value in x will be (c)6.0 (d)9.0 (d) none of these (c) Long The method that is used to extract a set of characters om a string: (b) endsWith( ) substring ) (a) charAt() (d) Int (d) startsWith( ) returns their sum: The pfototype for a method addNum( ) that has two integers as argument and (b) void addNum(int nl, int n2) K int addNum(int a, int b) (d) int addNum(int nl, int n2); (c) double addNum(double a, double b) Page 2 of 4 xi. The method that returns the index of the last occurrence ofa specifiedcharacter in a string: (a) compareTo( ) (b) indexOf() lastindexOf) (c) charAt( ) Which of the following is not a keyword: (a) object (b) void (c) public (a this The class used to convert a primitive data type to its corresponding object is: (a) String (d) Math class (b)value0f (c) Wrapper Assertion(A): Runtime errors are detected while the program is running. Reason(R): The compiler does not detect them because they are syntactically correctl. a) Both Assertion (A) and Reason (R) are true and Reason (R) is a correct explanation ofAssertion (A) b) Both Assertion (A) and Reason (R) are true and Reason (R) is not acorrect explanation ofAssertion(A) c) Assertion (A) is true and Reason (R) is false dYAssertion (A) is false and Reason (R) is true xvi. Which of the following has least memory requirement short (b) byte xvii. It is an ability to have same name but to behave diffegently under different situations (a) Encapsulation xviii. (d)double (c) long (b) Inheritance Polymorphism (d) Abstraction R-7{4*2. The result of R is 22. Assertion(A): Given Precedence of operator * is more than that of operator + Reason(R): (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 x0x. XX. The statement: "COLLECTION".indexOf(A): will return (c) -1 (b) 0 (a) Syntax error A variable declaration can occur (a only in the beginning of (C) anywhere before its use in (d) valueNotFound Exception a JAVA method. (b) anywhere after its use in (d) at the end of [10x2=20]) Question 2: using the following values: Write the syntax to create a 5 element String array AAA, ccc, EEE, ggg, JJJ ii. Rewrite using while loop: for(int i=1, j=7; i<6; it+,j--) System.out.printin (i +". "+i*i): i. What is Autoboxing? Give example. arrays: How many locations are reserved for the following (b) char al ]= new char[201; (a) int x]= new int(25]; V. Given that : yt=y- - t-y+ 12; What will be the final value in y, ify = 8 initially ? Page 3 of 4 vi. Given the following code, what will be the output? int n=2, S; while( n<=10) $=3*n +2; if( s%4 == 0) continue; n+=2; System.out.print( s ) ; vi. Given: switch (r) case 7: k= 49; break; case 14: k=7; case 21 : k=3: break: default: k=1; What will be the final value of k vii. Given: if: (a) r= 14 (b) r= 10 am =(p*2 > q+100 ) ?p:q : What will be the value of am (a) p= 100 if : ix Write two properties of a constructor. X. What will be the output of the given code snippet: int PMI] = {5, 10, 20, 40, 80, 160}; q=125 (b) p= 175 q=75 for (int p= 2; p< 6;p+=2) System.out.print (" * "+ -PM[p-1] ): Section B[15 x 4 = 60 marks | [Aempt any fourprograms from this section. Write a program in Java for the following. Also write variable description table for each program. Give comments wherever applicable] Auestion 3. Define a class PARK, described as below : Member Variables : EpiryFee (double) Age (int) Discount (double) Amount (double) Member Methods : )PARK() Constructor to initialize member data to null. Ki) void Input() - To input values for member data - EntryFee, Age. (ii) void Calculate()--To calculate theamount payable by giving the discount as per the following chart: Age (in years) Discount on EntryFee <=12 >=50 otherwise (iv) void Display() 45% 50% 10% To display all the member data Write a main() method to create an object of class PARK and call the above member methods. Page 4 of 4 Question 4. Define a class to accept values in a character array of size 10. Using Bubble sort technique, arrange them in ascending order. Display the unsorted and the sorted array. Question 5. ea ldss to accept a sentence and convert it to upper case. Display each word in a separate line Input : Example: Output: India is my country INDIA IS MY COUNTRY Qhestion 6. Deiine a class to accept values into a sum of elements of each column of the3x4 array, Display the elements in the matrix form. Also calculate and print the array. Example: A[ I[ ]= {{4,5, 6, 3), {5,3,2, 6), (4,2, 6, 7} }: Array in matrix form: 4 5 6 3 $3 2 6 4 2 6 7 Sum of elements of Ist column = 4 + 5 +4 = 13 Sum of clements of 2nd column = 5+ 3 +2 = 10 Sum ofelements of 3rd column 3 =6+2+6= 14 Sum of elements of 4th column I =3 +6+7= 16 Question 7. Define a class to accept a number and check whether it is a Strontio Number or not. The number has to be a four-digit number. Strontio numbers are those four-digit numbers when multiplied by 2 give the same digit at the hundreds and tens place. Example 1: Input: 1386 Output: 1386 is a Strontio number. As 1386x 2= 2772, where the digits in the hundreds and tens place are same. Example 2: Input: 1764 Output: 1764 is not a Strontio number. As 1764x 2= 3528, where the digits in the hundreds and tens place are not same. Question 8. Define a class to overload a method named Pack), given that : (a) void Pack(int a, int b) - to print the average of the arguments. (b) void Pack(int n) - to print the square of the numbers from I to n (c) void Pack(String s)- to print the last character of the argument. --X-.
|