Download as pdf
Download as pdf
You are on page 1of 21
amuteeopntrs| Solved 2011 Question Paper ICSE Class 10 Computer Applications | ax, is} ———-| Works Where You Write Section A ‘uestion 1 (a) What isthe ciference between an object anda cass? Answer ‘Aclass isa blue prin that represents aso of obocs that share common characerisios and behaviour whereas an object is a specific instance ofa class having a specficidentiy, specific charactenstics and spectic behaviour (©) What does the token keyword" refer to Inthe context of Java? Give an example for keyword ‘Answer ‘Keywords are reserved words that have a special meaning forthe Java compiler. Java compler reserves these words ors otn use 0 Keywords cannot be wed asidenters, An example of eyoord is las. (c) State the itference between entry controlled loop and exit controled loop. answer Entry control loop Exit controlled loop Irenacke he condition st hei ot _IRenecks the conastion ater executing boxy it ‘entry Ont the conditions rue, the the condzon is tue, oop wil perform the next ‘rogram conte enters the body othe eraon ctherse program contol will move out oop. ofthe 0p, Loop dows not execute at alte The oop executes at ast ence even the ‘conction is false conditions ase Example: for and whe ops Example: dosh loop (4) What are the two ways of invoking functions? Answer “Two ways of invoking functions are: 1. Pass by value 2. Pass by relerence (6) nats the diference Between / and Yh operators? Answer Division operator Modulus operator Retums he quotient sien operaion Returns the remainder of dision operation Example: inta= 5/2; Here ail get te Example: int b= 6% 2 Here b wi get he ‘vision operation ‘duision operation ‘Question 2 (a) State the total size in bytes, ofthe arrays af] of char datatype and pA] of loat data ‘ype. answer ‘Size of cara] is 4 «2 «8 Bytes. ‘Sie of at pss 4-4 = 16 Bytes (©) () Name te package that contains Seanner clas, (i) Which unit ofthe class gets called, when the object of the class Is created? Answer ava Constructor (6) Give the output ofthe Following: fee prinen(s-sustringo, 8). concen subetesng(3)))2 fot prineln(a ensisen =): “onputertopeationt naubstng(@ 8 tus te aubsting on stang at idex OU 7 (2, 8 1 * 7) hich "Computer. substring) etuns the substring of m starting at index 9 te end ofthe string which 's"Aoolicatons. canct!) meth ois “Comouter" and “Aoatications" oases to ive the ouput as ComputerAppiations (4) Wire the output of the folowing: 1. System out printin(CharacterisUpperCase(R)}: 2 system out prntin(CharaetersoUppercase( 20 (6) hats the role of Keyword old in ectaring functions? Answer “The Keyword oid ignites that he function doesn retun a value fo he caing uncon. ‘Question 3 (2) Anatyze the following program segment and determine how many times the loop wil be executed and what wil be the output af the program segment? tne p = 0 hited Seip 20) , Sytem ot. prima ‘The loop executes 6 times . Remarks (200° nial Valve 100 1#neravon 180 2° eration 40 31 tration 120 aM neraton Fa lemma ‘8 eration Now p< 100 becomes true 9 beak statements executed terminating tne op, (©) What wil be the output of the following code? o sien cut prinein"h = 7+ 05 see prinein's == + 35 w paths 20400); fee printin'e = "+ 5 explana Ske5+6-10+6) okestt oke6 kes sak +4 increments jt 10 ® ouput Math abs(-15 6) gives 18.6, ath rit 15 6) gies 160. (c) Explain the concept of constructor overloading with an exampl answer ‘Consiucor overloading technique in Java trough which a cass can have more than one constructor with erent parameter iss. The diferent constructors of he cass are ferent bythe compiler using the number of parameters inthe it and thir types, For example, the Rectangle lass below has to constructors: cae nectrgle ( setae plac nectnele() ( Ange =| public Reetngleint 2, Sot ) § length = , public strc void weinString{] ers) { actangle obit = ew Rectan) ectagle sot = nev Retaneea2, 15); > (4) Give the prototype ofa function search which receives a sentence ‘sent and word W- and returns tor. Aanower Int seareSnng set. Sing W) (e) vite an expression in Java for oxi bay xy Answer HenerKe2 yey) (Write a statement each to perform the following tasks ona string: 1. Find and dsplay the position ofthe last space Ina string s. 2. Convert a number stored ina string variable x to double datatype. ‘Answer 4. Systemout pinta lange) 2 double num = Double parseDoubet) + Informs that an error has occurred in an inpuloutput operation, 2. dlstinguishes between instance variable and class variable Answer 1. throws IOException 2. state (0) What are brary classes? Give an example. Answer Java Libary classes ae ast of predefined classes inthe frm of packages tal ae proved to he programme as pat of Java instalation. Lary cass simply the job of programmers by rovaing bln methods for common ans non-trivial tke ihe taking input rom use, 4splying output to use, ee. For example, System cass in ava lang package of Jv Library ‘lasses provides the print) and print) methods fer displaying output use. (0) We one atference between Linear Search and Binary Search Answer Lear search works on unsorted as well as srted arays whereas Binary search works. on only sorted aay Section B ‘vestion 4 Destine a cats called! Mable’ wih the folloning spaciicaans: Data Members. Purpose incon ‘To toe he bike number intpino ‘To stre the phone numberof the customer ‘Stingrame To store the name ofthe customer mays 1 store we rurives OF Uys rE Om 1s wane UT TEE Intcharge To calculate and store he rental charge (Member Methods Purpose ve input) ‘Toinput and store te deta ofthe customer ‘void compute) To compute he retal charge oid display) To splay he detals inthe given format ‘The rent for a mobike is charged onthe folowing bass: Days charge Fortrstfve days €500 per day Formexttve days %400 per day Restotthe days %200 per day ouput answer ‘ bie vod snp) { Seman ins new Scamer(Spstn.in); spate cut. ortne(Entercustoner hoe: *) pve = Snvrentline(z Syete.cotprineEnter Carton Poe Mater“): nos Snient ant Syete.outprine( enter Bike Member: to = inne Sprtn-out rine (Enter Wunbar oF Cay“): dept incest , bic vid computa) ( 3 (dys) charge = days © 505 nee (doy ce 2) ‘charge = (3 500) + ((d8 — 9) * 60); ‘charge = (5 £80) 6 (5.6488) + ((days + 2) + 28); , polis vos stent) { Spete cot orsnn( Ne \eProne No area. of days chore"): Systerovtprintinginn + VG" opine # "Aero mane © "Vt + dee TET cara , public strc void wainstring ares) { ia obj = ner Monsees 3 S80 , > ouput Enter Custoner Name: Rohit sharma [Enter Customer Phone Number: 80412268 Enter Bike Nunber: 1234 Enter Number of Days: 12 ‘Bike No.Phane No. Name No. of days Charge 1234 “ao412204 Rohit Sharma 124900 ‘avestion 5 ‘ite a program to input ana sort he weight a en people. Sot and pay tem in descencing ‘oer using te selection sort technique Answer sore Soveutt. scanners ‘ pons static ve rat(sering ors) { Saat eee eta ube weigeaet] w nem deblel6}; ‘Syete cit printing “enter nests oF 39 peoples“) for net ney te 38; 0) { eEerser[s) = iniestboubie(): > for (nt 1 = 65 1.695 409 ¢ bre tere ts for Gre $2 8S aH; $00) iF Gonigheare(3} > wegreartiae) ‘ ove t= weights); Frees Soest sesprseriaed) = > systeno rin Srted eben seen): for Cant 4 = 05 8c a8; $60) Syrten cut prsneuasgneenis) ©" Sorted Weights Array: 95.7 95.4 91.0 88.4 84.9 78.3 76.2 65.75 65.3 59.6 | ‘Question 6 ite @ program to input a number an pint whether he numbers a special number or not (Anumoer i said tobe @ special number, the sum of he factorial ote apts of he number Is same asthe original number. Bam: 145 fs. special number, because 1! +41 +5121 + 26 + 1202 145, (hare! tancs for tocol ofthe number and he factorial value ot 2 number ete product ot ll ntegers tom 1 to that number example 1» 1"2"3"4"5 = 120) ‘Answer ‘ Le ease owtspectattin bic atric int fectCint 1) for (ne te 85 Len ys 0) { ea > , pale state vo nain(String ares) { Seamer in = nen eamer(apeten in) Syete cot grine(enternuteer”"]2 Ene = denote, waite (12) ¢ > 4 (om == un) Syotenoutorintinnun ©" Ss © specie) naber*): ‘syste.ovt.printin(oun ©“ ts ot 2 spacial wunbe"); “2 Bier mil 6 = ops lEnter number: 145 [145 is a special number usstion 7 Ue program te accept 2 word and convartt its loner casa, ite in uppercase Display the new word by replacing only the vowels wth the eter tow Sample Input computer ‘Sample Output: comp Answer ‘ pole state vo nainString ares) { Seanar in = nar Seannr(Syeton. tm Syste out. print enter nord"): String ser Snares ine()s ser nstrctotouareateOs ine dens a8 lnet8O; for (nt £05 $< 2am $50) ¢ chee ene serene) 56 (atrenarect) seeceante() Serene) Serceanat() ‘tar mantena = (eae)(08 295 > ose > yet cot priaen(necs): ouput 2 deem opto Enter a word: computer lepmpvtfr ‘vestion & Design a clas o overoad a function compare 2s flows 1. voi compart int) — to compare to intogers values and print the greater ofthe two intagers, 2. old comparechar char) —to compar the numeric value of two characters and pit with ‘he higher sumerc value 8. yold compare(Snng, Sving) — to compare ne lengin a ne two stings and pnt he longer of he two Answer ole vole cenpre(int ay At 8) ( fee Syotenout prints): > te ( ‘sjeten.outprintin(®) > , pole vo conpara(chan 2, har ») ‘ne x= (re) ne y= Gre): Oot Syete out printings > tee ( ‘syete.ont tnt): > , Pie vo compara(String 2, String 8) ( ne = etenethO: dae bs hlaneth: wens ay ‘siate.ovt printings): » cet Ssietenout pristine): > : public stric void eainstring ares) { Seman in = ner Samer(apecen.in) esetcanpace oop nou Wostecomare): systen cut print (Enter First Snteters nt at = dn nextane(ds Spoten.cutorine(lnter second Sateger *): Soe = innerene(}e syrton cut pring (Enter fires narsctor Sher eh = dmnertOvcherhQ(@)s Spetencotrune(Enter second charactars Skerea = dnnertQ chert@) cosseorpre( ete 2) yet out print (Enter Fleet strings “3s String st = invnetiineO: Spaten.outprine(-Entersacond stn: String #2 = in netuineOy scoratsty 3) > “Be nal Window 21934 ones Enter first integer: 78 Enter second integer: 23 78 Enter first character: K Enter second character: ¢ lEnter first string: ICSE Computer Applications lEnter second string: BlueJ is an IDE for Java ICSE Computer Applications ‘auestion 8 ite a menu deven program to perform the flowing tasks by using Sulleh cage statement (@)To pint ie sores: 0.3.8, 15,24... nterms. value of Wis tobe an input by the user) (©) Toind ho sum of the sens: = (12) + (4) + (56) + (18) 6. (18720) Answer ponte es ‘ Ls montsarestans le state vo main(String ares) { Sener in = nen Semmer(spetn.in) See Syren Syme sister Siete Seer Seen cut gruneinnype te print arte ut prsntin"9, BB, Ley absentee sere) so 9a): fut rine (Enter your choices “s ine cice »in-eonttneQs een evoiee) ‘system out pdt (Patan 8: © ines intention () tar (ine dns A coms te) syreancot primes) 2) 47s system out printing: fer it $24) beets bee D ton = 1 eowsintt © 3); system aut pintin'som = + sun): ‘system out. printan("Incorrect chose” Beet eral Wado O18 =o x ope ‘Type 1 to print series le, 3, 8, 15, 24,....ton terms ‘Type 2 to find sum of series (1/2) + (3/4) + (5/6) + (7/8) +....+ (19/28) lEnter your choice: 1 lEnter n: 10 12 3 8 15 24 35 48 63 60 99 Beet eral Wasa O18 =o x ope ‘Type 1 to print series le, 3, 8, 15, 24,....to n terms ‘Type 2 to find sum of series (1/2) + (3/4) + (5/6) + (7/8) +....+ (19/28) lEnter your choice: 2 ‘sum = 8.535515873615873 ey

You might also like