Вы находитесь на странице: 1из 9

COMPRO1 STI COLLEGE ZAMBOANGA ZAMBOANGA CITY ______________ MID-TERM EXAMINATION

SCORE: _________ NAME: ________________________ YR. & SECTION: DATE: ______________

I. MULTIPLE CHOICE: Read each statement carefully. Write only the letter among choices. Strictly no erasure or any alteration.(1 point each) 1. It permits a sequence of instructions to be executed repeatedly until certain condition is reached. a. Sequential Construct b. Selection Construct c. Repetiti e Construct d. !ump Statements ". It does not force the termination of a loop# it merely transfer control to the next iteration. a. goto b. continue c. brea$ d. return %. It terminates the nearest enclosing s&itch or loop. a. goto b. continue c. brea$ d. return '. It is a procedure for sol ing a problem in terms of the actions to execute and the order in &hich these actions execute. a. (rogram Control b. )lgorithm c. (suedocode d. Control Structure *. It refers to the order in &hich statements (actions) execute. a. (rogram Control b. )lgorithm c. (suedocode d. Control Structure +. It a selection statement that enables program to choose from se eral alternati es. a. for loop b. do &hile loop c. if else statement d. s&itch statement ,. It is a statement used to terminate execution of the current function and pass the return alue contained in the expression to the function that in o$ed it. a. goto b. continue c. brea$ d. return

-. It a selection statement that lets you e aluate a condition in the program and ta$e a course of action based on the result. a. for loop b. do &hile loop c. if else statement d. s&itch statement .. It is an artificial and informal language that helps programmers de elop algorithms. a. (rogram Control b. )lgorithm c. (suedocode d. Control Structure 1/. It is consist of statements in a program that execute one after the other in the order in &hich they are &ritten. a. (rogram Control b. )lgorithm c. (suedocode d. Control Structure 11. 0ne category of control structures that allo&s program to be transferred from one part of the program to another automatically. a. Sequential Construct b. Selection Construct c. Repetiti e Construct d. !ump Statements 1". It is the simplest of all the structures. Instructions are executed sequentially# one-by-one# from top to bottom. a. Sequential Construct b. Selection Construct c. Repetiti e Construct d. !ump Statements 1%. Its frequent use is usually not recommended because its use could result in 1spaghetti codes2 that &ill difficult to debug. a. goto b. continue c. brea$ d. return 1'. 3hese are C44 operator symbols that pro ides t&o unary operators for adding 1 to or subtracting 1 from the alue of a numeric ariable. a. 55 and 66 b. 77 and 88 c. 44 and 99 d. 4: and :4 1*. It is an operator used to decrement the ariable by 1# then use the ne& alue of ariable in the expression in &hich ariable resides. a. (re9Increment b. (ost9Increment c. (re9;ecrement d. (ost9;ecrement

1+. It is an operator used to increment the ariable by 1# then use the ne& alue of ariable in the expression in &hich ariable resides. a. (re9Increment b. (ost9Increment c. (re9;ecrement d. (ost9;ecrement 1,. It is an operator use the current alue of ariable in the expression in &hich ariable resides# then increment the alue by 1. a. (re9Increment b. (ost9Increment c. (re9;ecrement d. (ost9;ecrement 1-. It is an operator use the current alue of ariable in the expression in &hich ariable resides# then decrement the alue by 1. a. (re9Increment b. (ost9Increment c. (re9;ecrement d. (ost9;ecrement 1.. It is a C44 operator that used to assign alue to your identifier. a. )rithmetic 0perators b. Relational 0perators c. <ogical 0perators d. )ssignment 0perators "/. 0ne category of control structures that allo&s instructions to be executed non9sequentially. a. Sequential Construct b. Selection Construct c. Repetiti e Construct d. !ump Statements "1. What is the output of the follo&ing program= main() > int a# b# c? a : 9"? b : a 4 *? c : b 6 "? cout@@1 2@@a@@2 2@@b@@2 2@@c? getch( )? return /? A a. 9" 9% 9+ b. 9" % + c. 9+ 9% 9" d. Bo output. 3he program &ill not run due to syntax error.

"". Co& many errors does the follo&ing program ha e= main() > int x? float y? x : 1? y : %.*? D :: 1? coutEE x 4 %)? cout@@28n2 y)? A a. ' b. * c. + d. , "%. What are the alues of statements is executed= x : 1? y : x44? a. x : 1 and y : " b. x : " and y : 1 c. x : " and y : " d. x : 1 and y : 1 "'. What are the alues of statements is executed= x : 1? y : 44x? a. x : 1 and y : " b. x : " and y : 1 c. x : " and y : " d. x : 1 and y : 1 x and y after the follo&ing

and

after

the

follo&ing

"*. What is the alue of x after the follo&ing statements is executed= x : 1? y : *? x 4: y? x 7: "? a. " b. % c. ' d. 3here is a syntax error "+. If x : 91# y : /# and D : *# &hat is the output of the follo&ing program segment= if (x F: 91) > cout@@ x? cout@@ y? cout@@ D? Aelse > cout@@ 1y2? cout@@ 1D2? A a. 91 / * b. x y D c. / * d. y D

",. 3he arithmetic expression + 6 * 7 % 4 * 6 % 4 " 6 ' 91/ 7 " is equal to a. +* b. %* c. "d. 3here is a syntax error "-. If x : 9, and y : ,# &hat &ill be the D after the operation D : x 4469y a. D : '.# x : 9,# y : + b. D : 9*+# x : 9+# y : + c. D : 9'"# x : 9+# y : + d. D : 9%+# x : 9 +# y : , alues of x# y# and

".. What is the output of the follo&ing program= main() > int x : ,? &hile (x E: /) > cout@@2 1@@x? x : x 9 "? A A a. , * % 1 91 b. , * % 1 c. * % 1 91 d. * % 1 %/. What is the output of the follo&ing program= main() > int x : ,? &hile (x E: /) > x 9: "? cout@@2 1@@x? A A a. , * % 1 91 b. , * % 1 c. * % 1 91 d. * % 1 %1. What is the output of the follo&ing program= main() > int x : ,? &hile (x E: /) x9:"? if (x::*)> cout@@28n2 x? A A A a. , b. * c. 1 d. 91

%". What is the output of the follo&ing program= main() > int x : 1? &hile (x::1) > x9:1? cout@@28n2 x? A A a. 1 b. / c. 91 d. 9" %%. What is the output of the follo&ing program= main() > int x : 1? &hile (x::1) x 9: 1? cout@@ x? A A a. 1 b. / c. 91 d. 9" %'. What is the output of the follo&ing program= main() > int code : "? if(code :: 1) > cout@@1ta$e oneF8n2? if (code::")> cout@@13a$e t&oF8n2? Aelse> eout@@1ta$e threeF8n2? A Aelse> cout@@13a$e fourF8n2? A A a. 3a$e oneF b. 3a$e t&oF c. 3a$e threeF d. 3a$e fourF

%*. Can the follo&ing program segment if (xEmax)> max : x?A if (x@min)> min : x?A be replaced by the program segment if (xEmax)> max : x?A else> min : x?A a. GesF b. BoF c. I donHt $no&F d. I donHt careF %+. What is the output of the follo&ing program= main() > int x : *? if (x@")> cout@@ x? Aelse> if (x@')> cout@@ "6x? Aelse> if (x@+)> cout@@ %6x? Aelse> cout@@'6x? A A A A a. * b. 1/ c. 1* d. "/ %,. What is the output of the follo&ing program= main() > int x:+? if (x@")> cout@@ x? Aelse> if (x@')> cout@@ "6x? Aelse> if (x@+)> cout@@ %6x? Aelse> cout@@ '6x? A A A A

a. b. c. d.

+ 1" 1"'

%-. What is the output of the follo&ing program= main() > int x : ,? if (x@")> cout@@ x? >else> if (x@')> cout@@ "6x? Aelse> if (x@+)> cout@@ %6x? Aelse> cout@@ '6x? A A A A a. + b. 1" c. 1d. "%.. What is the output of the program belo&= Iinclude @iostream.hE main() > int n : %? &hile (n E: /) > cout @@ n 6 n @@ 1 1? 99n? A cout @@ n @@ 1 1? &hile (n @ ')> cout @@ 44n @@ 1 1? A cout @@ n @@ 1 1? &hile (n E: /)> cout @@ (n 7: ") @@ 1 1? A return /? A a. b. c. d. . . . ' ' ' ' 1 1 1 1 / 91 / 1 " / 91 / 1 " / 91 / 1 " / 1 / 1 " % % % % ' ' ' ' ' ' ' ' " " " " 1 1 1 1 / / / / / / 1 1 [endlessly] [endlessly] [endlessly] [endlessly]

'/. What is the output &hen the follo&ing code fragment is executed= Re&rite the fragment to obtain an equi alent code fragment in &hich the body of the loop is a simple statement instead of a compound statement. int i : *? &hile (i E /) > 99i? cout @@ i @@ A a. 1 " b. 1 " c. * ' d. ' %

1 1? % % % " ' * ' " 1 1

II Programming : Read and understand the problem analysis. Write your C44 program using your test boo$let to sol e this problem. Write you program statements legibly. ('/ points) 1. Create a C44 program that prompts the user t&o integer alues. 3he program &ill then t&o numbers to determine if the first di isible by the second# and then appropriate message. ("/pts) to type in test these is e enly output an

". Write a C44 program that prompts the user to enter his annual income. 3he program should then compute and output his total tax due based on the follo&ing table. ("/pts)

Life may seem to be difficult from the start. But it will get better when you do your part.

Вам также может понравиться