Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
35 views
Computer SC (Ha)
Uploaded by
Saira Khalid
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Computer Sc (Ha) (1) For Later
Download
Save
Save Computer Sc (Ha) (1) For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
35 views
Computer SC (Ha)
Uploaded by
Saira Khalid
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Computer Sc (Ha) (1) For Later
Carousel Previous
Carousel Next
Save
Save Computer Sc (Ha) (1) For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 4
Search
Fullscreen
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 of2Teterio 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 2Time 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
The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
From Everand
The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
Mark Manson
4/5 (6129)
Principles: Life and Work
From Everand
Principles: Life and Work
Ray Dalio
4/5 (627)
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
From Everand
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
Brené Brown
4/5 (1148)
Never Split the Difference: Negotiating As If Your Life Depended On It
From Everand
Never Split the Difference: Negotiating As If Your Life Depended On It
Chris Voss
4.5/5 (934)
The Glass Castle: A Memoir
From Everand
The Glass Castle: A Memoir
Jeannette Walls
4/5 (8215)
Grit: The Power of Passion and Perseverance
From Everand
Grit: The Power of Passion and Perseverance
Angela Duckworth
4/5 (631)
Sing, Unburied, Sing: A Novel
From Everand
Sing, Unburied, Sing: A Novel
Jesmyn Ward
4/5 (1253)
The Perks of Being a Wallflower
From Everand
The Perks of Being a Wallflower
Stephen Chbosky
4/5 (8365)
Shoe Dog: A Memoir by the Creator of Nike
From Everand
Shoe Dog: A Memoir by the Creator of Nike
Phil Knight
4.5/5 (860)
Her Body and Other Parties: Stories
From Everand
Her Body and Other Parties: Stories
Carmen Maria Machado
4/5 (877)
The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
From Everand
The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
Ben Horowitz
4.5/5 (361)
Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
From Everand
Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
Margot Lee Shetterly
4/5 (954)
Steve Jobs
From Everand
Steve Jobs
Walter Isaacson
4/5 (2923)
Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
From Everand
Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
Ashlee Vance
4.5/5 (484)
The Emperor of All Maladies: A Biography of Cancer
From Everand
The Emperor of All Maladies: A Biography of Cancer
Siddhartha Mukherjee
4.5/5 (277)
A Man Called Ove: A Novel
From Everand
A Man Called Ove: A Novel
Fredrik Backman
4.5/5 (4972)
Angela's Ashes: A Memoir
From Everand
Angela's Ashes: A Memoir
Frank McCourt
4.5/5 (444)
Brooklyn: A Novel
From Everand
Brooklyn: A Novel
Colm Toibin
3.5/5 (2061)
The Art of Racing in the Rain: A Novel
From Everand
The Art of Racing in the Rain: A Novel
Garth Stein
4/5 (4281)
The Yellow House: A Memoir (2019 National Book Award Winner)
From Everand
The Yellow House: A Memoir (2019 National Book Award Winner)
Sarah M. Broom
4/5 (100)
The Little Book of Hygge: Danish Secrets to Happy Living
From Everand
The Little Book of Hygge: Danish Secrets to Happy Living
Meik Wiking
3.5/5 (447)
Yes Please
From Everand
Yes Please
Amy Poehler
4/5 (1987)
Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
From Everand
Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
Gilbert King
4.5/5 (278)
The World Is Flat 3.0: A Brief History of the Twenty-first Century
From Everand
The World Is Flat 3.0: A Brief History of the Twenty-first Century
Thomas L. Friedman
3.5/5 (2283)
Bad Feminist: Essays
From Everand
Bad Feminist: Essays
Roxane Gay
4/5 (1068)
The Outsider: A Novel
From Everand
The Outsider: A Novel
Stephen King
4/5 (1993)
The Woman in Cabin 10
From Everand
The Woman in Cabin 10
Ruth Ware
3.5/5 (2641)
A Tree Grows in Brooklyn
From Everand
A Tree Grows in Brooklyn
Betty Smith
4.5/5 (1936)
The Sympathizer: A Novel (Pulitzer Prize for Fiction)
From Everand
The Sympathizer: A Novel (Pulitzer Prize for Fiction)
Viet Thanh Nguyen
4.5/5 (125)
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
From Everand
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
Dave Eggers
3.5/5 (692)
Team of Rivals: The Political Genius of Abraham Lincoln
From Everand
Team of Rivals: The Political Genius of Abraham Lincoln
Doris Kearns Goodwin
4.5/5 (1912)
Wolf Hall: A Novel
From Everand
Wolf Hall: A Novel
Hilary Mantel
4/5 (4074)
On Fire: The (Burning) Case for a Green New Deal
From Everand
On Fire: The (Burning) Case for a Green New Deal
Naomi Klein
4/5 (75)
Fear: Trump in the White House
From Everand
Fear: Trump in the White House
Bob Woodward
3.5/5 (830)
Manhattan Beach: A Novel
From Everand
Manhattan Beach: A Novel
Jennifer Egan
3.5/5 (901)
Rise of ISIS: A Threat We Can't Ignore
From Everand
Rise of ISIS: A Threat We Can't Ignore
Jay Sekulow
3.5/5 (143)
John Adams
From Everand
John Adams
David McCullough
4.5/5 (2544)
The Light Between Oceans: A Novel
From Everand
The Light Between Oceans: A Novel
M L Stedman
4.5/5 (790)
The Unwinding: An Inner History of the New America
From Everand
The Unwinding: An Inner History of the New America
George Packer
4/5 (45)
Little Women
From Everand
Little Women
Louisa May Alcott
4/5 (105)
The Constant Gardener: A Novel
From Everand
The Constant Gardener: A Novel
John le Carre
3.5/5 (109)
Related titles
Click to expand Related Titles
Carousel Previous
Carousel Next
The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
From Everand
The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
Principles: Life and Work
From Everand
Principles: Life and Work
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
From Everand
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
Never Split the Difference: Negotiating As If Your Life Depended On It
From Everand
Never Split the Difference: Negotiating As If Your Life Depended On It
The Glass Castle: A Memoir
From Everand
The Glass Castle: A Memoir
Grit: The Power of Passion and Perseverance
From Everand
Grit: The Power of Passion and Perseverance
Sing, Unburied, Sing: A Novel
From Everand
Sing, Unburied, Sing: A Novel
The Perks of Being a Wallflower
From Everand
The Perks of Being a Wallflower
Shoe Dog: A Memoir by the Creator of Nike
From Everand
Shoe Dog: A Memoir by the Creator of Nike
Her Body and Other Parties: Stories
From Everand
Her Body and Other Parties: Stories
The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
From Everand
The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
From Everand
Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
Steve Jobs
From Everand
Steve Jobs
Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
From Everand
Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
The Emperor of All Maladies: A Biography of Cancer
From Everand
The Emperor of All Maladies: A Biography of Cancer
A Man Called Ove: A Novel
From Everand
A Man Called Ove: A Novel
Angela's Ashes: A Memoir
From Everand
Angela's Ashes: A Memoir
Brooklyn: A Novel
From Everand
Brooklyn: A Novel
The Art of Racing in the Rain: A Novel
From Everand
The Art of Racing in the Rain: A Novel
The Yellow House: A Memoir (2019 National Book Award Winner)
From Everand
The Yellow House: A Memoir (2019 National Book Award Winner)
The Little Book of Hygge: Danish Secrets to Happy Living
From Everand
The Little Book of Hygge: Danish Secrets to Happy Living
Yes Please
From Everand
Yes Please
Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
From Everand
Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
The World Is Flat 3.0: A Brief History of the Twenty-first Century
From Everand
The World Is Flat 3.0: A Brief History of the Twenty-first Century
Bad Feminist: Essays
From Everand
Bad Feminist: Essays
The Outsider: A Novel
From Everand
The Outsider: A Novel
The Woman in Cabin 10
From Everand
The Woman in Cabin 10
A Tree Grows in Brooklyn
From Everand
A Tree Grows in Brooklyn
The Sympathizer: A Novel (Pulitzer Prize for Fiction)
From Everand
The Sympathizer: A Novel (Pulitzer Prize for Fiction)
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
From Everand
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
Team of Rivals: The Political Genius of Abraham Lincoln
From Everand
Team of Rivals: The Political Genius of Abraham Lincoln
Wolf Hall: A Novel
From Everand
Wolf Hall: A Novel
On Fire: The (Burning) Case for a Green New Deal
From Everand
On Fire: The (Burning) Case for a Green New Deal
Fear: Trump in the White House
From Everand
Fear: Trump in the White House
Manhattan Beach: A Novel
From Everand
Manhattan Beach: A Novel
Rise of ISIS: A Threat We Can't Ignore
From Everand
Rise of ISIS: A Threat We Can't Ignore
John Adams
From Everand
John Adams
The Light Between Oceans: A Novel
From Everand
The Light Between Oceans: A Novel
The Unwinding: An Inner History of the New America
From Everand
The Unwinding: An Inner History of the New America
Little Women
From Everand
Little Women
The Constant Gardener: A Novel
From Everand
The Constant Gardener: A Novel