0% found this document useful (0 votes)
17 views7 pages

Computer Qs 2024

Computer questions
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
17 views7 pages

Computer Qs 2024

Computer questions
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 7
CardGame is a game of mental skil card pile. built on the simple premise of adding and removing the cards from Je top of the Class cal Game Data members/ instance variabl cards|] : array to store integers as ¢ capacity of array 1 lex if possible,otherwise display the message void addCard(int y): to add the card at the top i “CARD PILE IS FULL” int drawCard(): to remove and return the card from the display): to display cards of card pile index of the card pile, if any, else return the value -9999 (i) Specify the class CardGame giving a and int drawCard(). Assume that the of ‘The main() function and algorithm need NOT be written, Gi) N 1¢ the entity described above and state its principle. A double ended queue is a linear data structure which enables the user to add and renove integers from either ends i.e., from front or rear. The details of the class dequeue are given below: Class name: dequeue Data menbers/ instance varial Qrr[]:array to hold integer elements Lim: maximum capacity of the dequeue front: to point the index of the front end ro point the index of the rear end Methods/Menber functions: deQueue(int 1):constructor to initialise ims 1, front = @ and rear = © void agdrront(int v):to add integers in the dequeue at the front ond if possible, otherwi: message "OVERFLOW FROM FRONT” void addRear(int v):to add integers in the d message "OVERFLOW FROM REAR" int popFront():renoves and returns the integers from the front end of the dequeue if an} int popRear(): removes and returns the integers from the rear end of the dequeue if any, ol: Void show():displays the elenents of the dequeue Specify the class deQueue giving details of the functions void addFront(int) and int popFront(). Assume that the other functions have been defined. The main() function and algorithm need NOT be written. lay the jeue at the rear end if possible, otherwise display the ise returns -999 returns -999 Design a class Munude to check if @ given number is 2 Dudeney nunb 1s a perfect cube, such that the sum of its digits 1s equal to the cal example: $832 = (5084342)=(18)? = 583% or not. (A Dudeney unt jot oF the number.) positive integer that bats ethods/Nenber functions: MunDude()idefault constructor to initialize the void input():t0 ace int sunbigits(int x void tsdude() set Specify the cla Biving details of the constructor(), 4s main() function to create an object and call the functions accor x° using recursive technique mney number by invoking the functsc migite() an 44 Amput(), Ant sumbigits(int) ingly to enable the t ‘A class CalSeries has been defined to calculate the sum of the series: HDB soe AAD Some of the members of the class are given below: Class nam Data members/instance variables: x: Integer to store the value of x 1 integer to store the value of n sum : integer to store the sum of the series ‘Member functions/methods: Calseries(): default constructor void input{ ):to accept the values of x and n int power(int p, int q) : return the power of p raised to q (p%) using recursive technique ‘void cal ) : calculates the sum of the series by invoking the method power() and displays the result with an appropriate message Specify the class CalSeries, giving details of the constructor, void input(), int power(int.int) and void call ).Define the ‘main) function to create an object and call the member function accordingly to enable the task. https://sites.google.com/site/javaprogramsisc/ LSC Thee Data Structure - (Stack & Queue) SCO Ce BORO MIG MTU oR IT | Clements with the restriction that an Somteenmce nn cinomrntitc nin p only Details of the class Stack is given below = Class name st PRIOR OUD CPA CLR clue on Sie] Vac bcp IO OMe CRIED Ca SCORN CRT ty the index of the topmost element of the stack. to count the number of elements of the stack. size roy) tg Member functions: Stack() TSM aCe Seveeniet)) MSOC NN ons oer TRC eT void pushname(String n): to push name into the stack. If the stack is full, display the message “OVERFLOW” Srsnta corti e) ROMER CS ORC Roa ce eC RCO eat If the stack is empty, display the message "UNDERFLOW” void display() ODM ROen CRS RICE ta (a) Specify the class Stack giving details of the constructor() void pushname(String n), Se COCO URety co Om THE MAIN( ) FUNCTION AND ALGORITHM NEED NOT BE WRITTEN. (b) Under what principle does the above entity work? https://sites.google.com/site/javaprogramsise/ Data Structure - (Stack & Queue) SRC acre RYSattel TT le of rings are displayed. The Nc ROm CeenCRCRCn ica y ct: ie column till it is full. It can hold 10 rings at the most. Once the column is full} the rings have to be removed from the top till the column is empty and then the game is over. Define the class RingGame SVU Meets colori eme CCT om foneee ent) RingGame Data members / instance variables : peta] array to hold rings(integer’ max integer to hold maximum capacity of ring array eeg com R OM ROR CR ome ias cartons tom ni taeco ics Beutnecsreta tater) Coram OBITS Lees Ra) Tom Onse Seat (iintes titre ed adds a ring to the top of the column, if possible, Pen MC DEO e TTT umes) eRe TTT Start removing rings” STOTT RaTiC Oo) Pen R ean CRC MT COCR Teen sm TRU STS Mnt ccc mercer on ma Ts Pern Rota Sec mC R ue RRM Cn aCe RnR Cot TORU RCC RT et hO ede crr neat emma kecc ecu) Gorge temenl Mertomers recesses mcoees ne Data Structure - (Stack & Queue) GEDCOM COO UCSSETLT Come Te LMC CR CtCMCCame | could be availed. Accordingly printers aré linked to a centralized system and the EULA CCS ea ay Pe UU ee ORC meee Red 70 network the computer resources OSCE ROS TT sis only. This is like the first TIO Coc Orn neo Cimino een nt ) | no more than 20 printing jobs can be added Pe eee Ur ECAC mI ont ac ects eRe Den ro) Se ferrerts thy ae Rear Som Cec PrintJob( ) Amaro em} Data Structure - void addJob(,) SoC ca titecl (a0 a ee ee mee NC eMC TCR Ce yeti Seem ue nn tae epee ee tre mantener strc Peach ease Cec Oe OCR Ce some et ROOM IMCL BU ul oey ore e ee e cc ae | Ue Cre rec) Meee ACN OORT Ces nin t at (Stack & Queue) PEER iting job to the end of the last printing jobyif possible, otherwise displays the message “Printjob is full, cannot add any more” Removes the printing job from the front if the printing job is not empty, otherwise displays the message Dost Cke nt ial a) Specify the class PrintJob giving details of the constructor and the function OCMC OM Retc Ormco C Me kel hme Come Om els need to write the main function. b) What is the common name of the entity described above? ACTOR MTC SELLS https://sites.google.com/site/javapi Data Structure - (Stack & Queue) PROC MO Lamy (alee tem ite eR Bil). 0 integers. Link enables the user to ERO UES MUMS incon | OES ORL ECOTST RO MUTCROTL Lay OTST ROCCE AL ALUM BC ony ireae cls Class name Link CRU OU Rem CCH eR Cec) oo ey . entity to hold the integer elements max stores the maximum capacity of the entity eat oe to point to the index of the front end et : to point to the index of the rear end Member functions: Link (int mm ) OCR CR NL) ahem sn eet void addlink(int v ): LORE one OUR scrim oe eto) Co otherwise display the message “OUT OF SIZE aaa h@} ORNS Cte ES oUonmie RUE Lie alte possible otherwise display the message “EMPTY...” CUO BCoU sree) 4 void display() displays the elements of the entity OMS eRe CROCS ee CCnatreo ntact ORCC RCC nT ten POM sOruchrock sy tna THE MAIN( ) FUNCTION AND ALGORITHM NEED NOT BE WRITTEN. (b) What type of data structure is the above entity?

You might also like