Formatting page ...
Pege 1 cof S ST. AUGUSTINE'S DAY SCHOOL BARRACKIORE SELECON EXAMINAiON SESsIoN 2024- 2024 TIME CLASS.X COMPUTER APPLICATIONS SECTION AUem A 40 Mfarks tl qestions rom this Seetion: Question Choose the correct ansser to the questiots from tlie given options Do not copy the questions, wrile the eorect answers only.) Consider the given pieture and choose the coTect statenent with reference lo java. The pieture correettly represents (a) Polymorphism b Data Hiding (c) Platfom Independence (d1 Lnheritance (ii) Temary operator is a ic) relational operator (iii) When un aay is passed to a method, what does the method receive? 6Copv of the array (a) Reference of the array (d) Copy of the first element (c) Lengh of the array cases? the (iv) Autormatic type conversion is pssible in which o>(c) charfollowing to boolen (a) Jogical operatur (b) arithmetic operater (a) double te loa! (d onditional operutor (ds char to int (b) boalean to char (v) ldentify the incorect statement. ) return (s,p): (d) if(a>b) return(a); clse return(b): (vi) The statement Systen.out.println("Eight"+8+2); will give the following output. (d) Eight+8+2 (c) Eight82 (b) Eigh1s+2 (a Eight10 (vii)) The output of Math round($.6 -Math.ceil(2.4)) is: (c) 8 (b)9 ie19.0 a String? not return does (vii) Which of the following method (c) toUpperCaset (aj trimO (b) replace in the switch (ix) Which of the following is truc for the defaut keyword (a) Produces syha d) euualslgnoreCaset ) case onstruet? instiny the switch....case construc (c) Always executed before executing any other statement ofthe switch.. case construct Executedonly when there is no match in the switeh ....case construct (x) Whal is the output of the given statement? char ch | = !'p','g', 'r, 's: System.ou printint String valuefich)}. (a) Syntux Eror (xi) State the output (b) p, q. I, S (CrGarhage value (d) purs Page 2 of5 clnss Exam static void maint ) int fim, dur: Exan utl - new Exum (50,60): fm is full marks and dur is durstion in minutes ! Exann ut2 - new Exun (20, 35). Fxum( int marks, int time) Exam sel new Exat1 (I00, 120): Systemo println utl.fn +" "* ut2,dur tim marks: dur sel.fm). time (a) 20 60 120 b) 50 3s (a)6 byies (h) 12 byies 100 (c) S0 35 60 d) SU 20 120 ()An uray declared as char chrf =new clar (61. What is the aTouni of niemors space occuied tby the aTay (c) 24 bytes (dii) whielh of the following loopy will iterute for 5 times (a) for (it i 4.1> 30,i ) : U) imi 4; while i<40) (c) int i , do iiH2v3 :) whileli < 10, 36 byses !i-2:1 (di lor tnt j-4, i-20: ij4), (xiv) Consider the arruy given below: int ch ]- (65,66,67,68) Write the output of the following Sysiem.oIt.printin('Ateh[5- (ch lengl11 A66 c) AB d) 132 b) 131 (xv) ln and 't are cxamples of (c) Coment ssmbols Idi ASCIT 6 Special characters (a) Escape sequence a loweicasc letter or not is (xvi) The method to cteck if the token is char. (c) Charcter hasLower'asct toLowencasc ) (b) (a) String.toLowerCase( ) (d) Character. isL.ouerCaset ) ofelements in the aay. of an array is cqual to the number element oflast The index (xvii) Asertion (A): oins frorn 2ero. of the Assertion. Reason ( R): IndeN of an a apd Reason ( R)Na correct explanation true e t Reason a correct explanation of the Assertion (a) Both Assertion(A) and R) are trc and Reason (R) is pot h Roth Assertion(A) ha (Assertion (A) is true and (d) Assertion ( A) is false on ( is false dReason (R) 0s true deogruphy" , which is Civics and Geo "History text from the output. the wurd and" hut fails to get the desired following (xvii)A student wants to extract str. the written She has stored in the variahle namedSystemout, prin1ln(suhstring( 13. I6)): stem out.printIn(str.substring 15.18))). (B) System.ou println(str. substring( IS.17) printintsubstringt .(y+): out System System.out (A) y= indexO(d'), (C) int x index0fr search("and") : HSystem.oul printBn(str Page 3 of 5 Which suggestion is cotreet"? (a) OnlyA (b) Only B fBothC and D lBoth Band C (x0N) Cons der the folluwing segment where the statements are jurnbled. Choose the currect order of stalemcnts to obtain the reverse of a number storcd in the variable named n. whilen0) int s-0; (2) nn|0: (3 (41 rem =n%10; (S sustrem: s=s10: - )2)4)GroA (a)3(5)(6) 6) of2)0)(3) (4)(5)(6) (c)(2) ()(4) (6) (5) (3) (x) Assertkoa (A): Aclass can have ndefault construetor even if no constructors are explicitly defincd. Reasoning (R): The Java conpiler automatically provides a default constructor when none arc defined. orBoth Assertion( A) and Reason ( R) are true and Reason ( R) isa correct explanation of the Assertion (b) Both Assction(A) and Reason ( R) are true and Reason (R) is not acorrect explanation of the Assertion. (c) Assertion (A) is true and Rcason ( R) is false (d) Assertion (A) is false and Reason (R) is true Questioa 2. i) Write the java expression for (i ) Evaluate the cxpression when the value +=xt+-++xtx of x=2 +x (i ) Astudernt cxecutes the following code and gets an error in the underlined statement. ldentify the error and correet the same so that the student gets the output as "GOOD". int x-5, y-2, z-0; swilch (z (x>y ylx:y) case 2: Systern.out.println ("GOOD"; break; case System.out.println ("GREAT"); break,; ? ovSudip exeeutes the following program segment and the answer displayed is always the same value, irespective of any values that is given as input. Name the error How the progrum can be modified to get the correct answer? void Pythagoras (double b, douhle p) (double h- Math. pow{(b b +p'p) i2): System.out.printin(Hypotenuse="+h): (v) How many times will the following loop exccute? What value will be returned? Page &of5 int a=T0, ys0 da ywhilcx-y; Sysiem.out printin(y) i (vi) Write the output of the String s - following ptatemeds with string methods "EARNINGS, S2EARRINGS". (0) System out print hn(sl ,subdring(0,3)equals(s2.stbstringt0.) (b) System.out println(sl.conpareTo(s2)k () Write java stalementts for each to Store a) a prfom the lollowing task number 800 o0 as a String Detete the from a string tbefore and (vii) Predict the output of space the following code srippet: after) String a-"22": int b24. iot p-Integer.parselintca). Lnl q-Integer.parseBat(b). Systern.oul print p+ String valucOb)): (ix) Diferentiate between the keswords void and return (x) Consider the given program segment and answer the given questios. int z{ ]1- ((20,-9,6,51. (0.9,-7,-15). (1,32,19| 1: a) z isa 3x4 aay ora 4x3 aray? b) What is the value of z(0,1) - 2,0)" (Answer aySECTIONB(6 fonr escrinNarks)ls Section) Each program should he written using variabie Ionte codes so th the loic o the pgram ts clearly depicted Buftered Reader or Duta Input Stream shold nat he tsed in the prugam Question 3. Define a class with the following specifications. istance Member Variahles int xl and x2- where xl and x2 are the coordinatcs int yl and y2 - where yl and y2 are coordi douhle d- stores the distance between the Member Methods of apoint A. ts A and R void accept () - Input values of xl, x2, yl and y2 sing Scanner class methods onty vojd culeulate ()-Calculate the distuncu between the two points using the given expression da2-x1)-(2-yl void display ( )- Print the coordinates of the points Aand B. Display the distance between the two points. Write the main method to create an object and call the above mEthods. Page 5 of 5 urstion 4. Wte aprogram to sccept the nanes of 15 tlowetsbefure in anmd aynftetandSorting use bubble sort techrique to atarge the ames n descending order. Display Quention S Write a program to accert a line of text. Encode the tevt in such a way that the following thing ake pixe All Capital letters are replaced hy its ASCH vnlues AlI Sniall letters are replaced hy L All saces are replaced by ) " ed Display che orisinal texl us tyell as the moifed lext Sampie Input - Class X Sample Output - 671i i088 Question 6. Given asquare matrix M|||oforder 'n'. The minimum and maximurn value possible for n' s ito 7ele print "WRONG INPU" Aceept the ciements of the matrix and print the matrix alog with the SU Mof left diagonals clements. first row all elements and last column all elements separaiely t Wrone Innut utpui INPUT =] OUTPUT left dianal Surt:-15 column Sum:-18 Question 7, Using the switeh statement, write a menu driven program: To check und display whether a nunber input ly the user is an additive Prime number or not (A number is said to be an additive prime. if number is prime and addition of digits also prime). Example: 29 (29 is aprime number and addition of digit is 9+2=11 als aprime munber Accept a number and print the Smallest digit.Input:-3694 output:-3) For an incorrect choice, an appropriale ertor nessage should be displayed. hafrass to overload the method show () us follows : vojd show()-To print the following format using nested loon of z where void shuw (int p. int q)- To calculate the valuc Xpry. p'q 1
|