0% found this document useful (0 votes)
35 views

Computer SC (Ha)

Uploaded by

Saira Khalid
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
35 views

Computer SC (Ha)

Uploaded by

Saira Khalid
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 4
BERBER eR eRe eR Re RRR RRR Ree eee eee Sit (OMOMOMEO) Answer Shest No. Sign. of Candidate Sign. of invigilator © ® ©0600 ©0@¢ © ©®00 ©®00 ©0202000 0000 Ce OMOMOMOMG) ®00®8 ®@©02020080 fete usmle Atel 2 COMPUTER SCIENCE tance ‘ovet te te Cane Surender HSSC-I Rea pancie eS rstatenes Denekse SECTION — A (Marks 18) Time allowed: 20 Minutes Lil hy Mifare P paiaLying Sid net gut emia hee Fill the relevant bubble against each quostion: efron Compare wo Combine two Comparetwo Combine ivo 1, The 88 and | operators: O numeric rumerle Boolean ©) Boolean values values values vaties : ay Oniyityou ‘To member Only to pubic 2, I @ class defnon, data or functions (> function in the C) know the functions of — C) members of designated private ore accossile Aneto ea thatcase the cass IF jae integer type and kis ong ype, KH) e : 3. ould represent whic ype of value’ Mteuer © Float O bong Crete In time sherng system, the term Unt reters _ — 4. {0 allocation of resources to program for () Time slice © Response time © Timeevent ©) siccation Tnitedarouns of imei alee Retumsa Reluns a Disrlays@ “Does not charater charactor aepay a 5.” The getche( library function: oO when any key when Enter is Mis ecteen character on is pressed pressed when any Key the eeaon . Airstindrst 6 The det member Anindex 6. Anarray element is accessed using or oan Ou \Which ofthe foowina state tenons NOT + filocked to Ready to Blocked to Running 0 7 possible? O Running = © Running OO Ready Blocked In which SDLC stage the process of trining + System system system system 8 personnel tose the new system is done?” Analysis. © © Design © bevetopment © implementation | When the process is having all the resources 9. excopt processor then its considered in) Waling -C) Ready =) Ruming ©) New State? Which SDLC stage is lnvowed in the 20. monitoring, evaluation, repairing and () Development © Maintenance ©) Analysis © Testing improving in an already developed system? Page 1 of2 Teterio ihe rer owe pee ‘ae tthe “The expression ‘test can be sald to: Bepointeo © coiantsof — C) Rerelerenee © variable fea pamtd by Relat Apa adcres ot Anineaton pvarabe for The dala ype 12 Apple's: The adress of (> ofthevaratle sleing Catan adress toe nent attretses varie Who spend most of The time in the - Bevin stages of SOLS In TBKNg VN gam roe a 13. enbusea, geterng” inematen, CY rseet Top Manager © System documenting system and processing anal ° Manager ° Pestana souls? Wakes Takes Consens Rana vale a he Varble able C> warabe vse) metry hen when Be deel) Wg O wrseversi OQ toonyone © atunetionis funtion is not iincions noon hateweeuing executing : The progam The fray furcion ext causes an edt cy Theloopin. > The bockin Cy Thefuncfonin ca TG 3 from O whieh itoccurs Q which t oscars O which teccurs © inven cecurs 2a 22128121 (HA) ROLL NUMBER T LI Page 2 of 2 Time allowed: 2:40 Hours COMPUTER SCIENCE HSSC-I Total Marks Sections B and C: 60 NOTE: Answer any twelve parts from Section ‘B’ and any three questions from Section ‘C’. Use supplementary answer sheet i.e. Sheet-B if required. Write your answers neatly and legibly. Statistical table will be provided on demand. SECTION -B (Marks 36) Q.2 Attempt any TWELVE parts. All parts carry equal marks. (12x3 = 36) () Whois programmer? List any four responsibilities of the programmer. (ii) Briefly describe how is the functionality of a system ensured? (ii) What kind of program elements are the following? a4 bo 4 «42 4. class e —oless() f class" (iv) Answer the following questions: a. Write a statement that displays the variable FBISE in a field 10 characters wide. b. Write a statement that gets a numerical value from the keyboard and places itn the variable temp. c. What header file must be included in program to use setw()? (Vv) What is process? And state different process states with their functions, (vi) Write a do-while loop that displays the numbers from 100 to 10. (vii) List key differences between process and thread (ull) Answer the following questions: a. Write a statement that defines a one-dimensional array called ABC of type double that holds 100 elements, b. Write a statement that takes element jof array PR and writes it to couts< Write a statement that defines an array BILLS of type int and initializes it to the values of Pakistani curreney notes (10,20,50, 100,500, 1000,6000). (ix) Look at the following array definition int sales (8](10} a. How many rows does the array have? b. How many columns does the array have? . _ Howmany elements does the array have? d. Write a statement that stores a number in the last column of the last row in the array. 2. Write a statement that stores @ number in the 7% column of the 3" row in the array. f. Write a statement that replaces the value of the 7 column of the last row in the array. (%) Write declarations for two overloaded functions named FBISE(). The both have return type int. The first takes one argument of type char, and the second takes two arguments of type char. If this is impossible, justify why? (xi) Answer the following questions: ‘a, Whats the significance of empty parentheses in a function declaration? b. What is the purpose of using argument names in a function declaration? ©. How many values can be returned from a function? (xi) Write a code that uses a for loop to write the numbers 1 to10 to a file and reads all of the numbers from the file, and displays them, (xii) What is a pointer variable? Differentiate between reference operator (&) and dereference operator (*)? age 1 of 2 (Computer Science) a4 as (xiv) Answer the following questions: a. Write statements that will create an object called XYZ of the ofstream class and associate it with the file called SALES. te b. Write an if staternent that checks whether an ifstream object called XYZ had reached the end of file. ©. Write a statement that writes a single character to an object called XYZ, which is of class ofstream. (xv) Answer the following questions a Write switch code that prints Yes if variable ch is 'y’, prints No if ch is‘n’, and prints Unknown response otherwise, b. Write a statement that uses a conditional operator to set ticket to 1 if speed is greater than 55, and to 0 otherwise ©. Write an expression involving a logical operator that is true if limit is equal to 65 and speed is greater than 55. (xvi) What three steps must be taken when a file Is used by a program? SECTION C (Marks 24) Attempt any THREE questions. All questions carry equal marks. (3x8 24) a. Whatis an array? Write its advantages. (04) b. Write a program that lets the user enter 10 values into an array. The program should then display the largest and smallest values stored in the array. (04) Create the equivalent of a four-function calculator. The program should ask the user to enter a number, an operator, and another number. It should then carry out the specified arithmetical operation: Adding, subtracting, ‘multiplying, or dividing the two numbers. Use a switch statement to select the operation. Finally, display the result. When it finishes the calculation, the program should ask whether the user wants to do another calculation. ‘The response can be ‘y’ or 'n’. Some sample interaction with the program might look like this: (08) Example Output Ener first number, operator, second number: 10/3 Answer = 3.333333 Do another (yin)? y Enter first number, operator, second number: 12+100 Answer = 112 Do another (yin)? n Raising a number n to a power p is the same as multiplying n by itself p times. Write a function called power() that takes a long int value for n and an int value for p, and returns the result as a long int value. Use a default argument of 2 for p, so that if this argument is omitted, the number n will be squared. Write ‘@ main() function that gets values from the user to test this function. (08) a. Write a class declaration named Circle with a private member variable named radius. Write set and get functions to access the radius variable, Add a default constructor to the Circle the constructor should initialize the radius member to 0. Add on overloaded constructor to the Circle class the constructor should accept an argument and assign its value to the radius member variable. (04) . Describe the terms: (Inheritance (i) Polymorphism Each with an example from our daily life. (04) —2HAI 2212 (HA) — Page 2 of 2 (Computer Science)

You might also like