I. Multiple Choices. Write The Letter of Your Choice For Each of The Items On The Answer Sheet
I. Multiple Choices. Write The Letter of Your Choice For Each of The Items On The Answer Sheet
I. Multiple Choices. Write The Letter of Your Choice For Each of The Items On The Answer Sheet
SANTIAGO CAMPUS
PRELIM EXAM
CSCI05 (Data Structures and Algorithm)
No ID, No test booklet, No permit means NO EXAM.
Write your answers and solutions in your test booklet.
Too much erasure will deducted from your points.
(Perfect score is 50 points)
I. Multiple Choices. Write the letter of your choice for each of the items on the answer sheet
provided for. Use Capital Letter. Erasure means wrong. (100 points, 1 point each)
1. The values of this type of data are single symbols such as letter, number, or special symbol.
a. double
c. string
b. char
d. Long
2. What values is stored in quotient (if quotient is of type int), when the following expression is
evaluated.
quotient = 12 / 10 % 10 + 10;
a. 10.12
c. 12.3
b. 10.10
d. 11
3. What, if anything, prints when each of the following C++ statements is performed?
Assume x = 2 and y = 3. cout << x;
a. 2
b. 3
c. 5
d. 4
4. What, if anything, prints when each of the following C++ statements is performed?
Assume x = 2 and y = 3.
cout << x + x;
a. 2
b. 4
c. 5
d. 3
5. What, if anything, prints when each of the following C++ statements is performed?
Assume x = 2 and y = 3. cout << "x=";
a. 2
b. 3
c. x=
d. "x="
6. What, if anything, prints when each of the following C++ statements is performed?
Assume x = 2 and y = 3. cout << "x = " << x;
a. x=2
b. 2
c. x = x
d. 22
7. What, if anything, prints when each of the following C++ statements is performed?
Assume x = 2 and y = 3. cout << x + y << " = " << y + x;
a. x+y = y +x b. x+y = 5
c. 5 = 5
d. nothing
8. What, if anything, prints when each of the following C++ statements is performed?
Assume x = 2 and y = 3.
z = x + y;
a. x + y
b. 5
c. 2
d. Nothing
9. What do you call on the error where program runs to completion, but the results are wrong.
a. Link error b. Compile error
c. Logical error
d. Run time
error
10. Which of the following is TRUE about the break in switch statement?
a. it is optional
c. it is required
b. enters you to switch
d. found before each case
11. The Boolean expression if and if-else statement is always enclosed with what specific
symbols?
a. braces
c. brackets
b. slash
d. Parenthesis
12. What is the output of the following when included in a correct and complete program?
int x = 5;
if ( x <10 )
cout<< x;
x = x + 5;
a. 5
b. no output
c. 10
d. Error
18. What is the correct value to return to the operating system upon the successful
completion of a program?
a. -1
c. 0
b. 1
d. Programs do not return a value.
19. What is the only function all C++ programs must contain?
a. start()
c. system()
b. main()
d. program()
20. What punctuation is used to signal the beginning and end of code blocks?
a. { }
c. -> and <b. BEGIN and END
d. ( and )
c. While
d. Repeat Until
29. After the following block of code has run, what is the value of each variable? Write
values in the box. Show supporting
work for partial credit.
double a = 3.9;
double z;
int n = 3;
int y;
n = (a/n)*2;
y = n + 4;
z = (y+1)/2 + a;
What will be the value of n?
a. 2.6
b. 2.66
c. 2
30.
31.
34.
35.
36.
37.
38.
c. n
d. error
c. 4
d. Error
c. 4
d. error
c. 4
d. Error
c. 4
d. Error
c. 4
d. Error
c. 4
d. Error
else if (n > 5)
cout << "greater than 5" << endl;
else
cout << "not interesting" << endl;
39. What will be the output of the fragment above if the interactive user enters the integer
value 0 ?
a. less than 10
c. greater than 10
b. equal to zero
d. error
40. What will be the output of the fragment above if the interactive user enters the integer
value 15 ?
a. less than 15
c. equal to 15
b. greater than 15
d. error
41. What will be the output of the fragment above if the interactive user enters the integer
value 7 ?
a. less than 10
c. greater than 10
b. equal to zero
d. Error
42. Evaluate !(1 && !(0 || 1)).
a. True
b. False
c. Error
d. Unevaluatable
b. 2
c. i
d. Nota
b. 2
c. 3
d. 0
b. 2
c. 3
d. 0
b. 2
c. 3
d. 0
a. 1
b. 2
c. 3
d. 0
b. 2
c. 3
d. 0
b. 2
c. 3
d. 0
b. 2
d. 0
53.
c. 3
Curly braces
None of these
54.
55.
56.
58.
59.
60.
Prepared by:
Checked by:
Prepared by:
Approved by: