Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 2

Prelim Examination

Data Structure SCORE


SET B

NAME:___________________________________________________ STUDENT NO:______________________ SCORE


PROFESSOR: _______________________________________ ______ DATE OF EXAM:____________________
SECTION: _________________________________________________ SCHEDULE:________________________
INSTRUCTIONS:

 Please read the instructions carefully.


 Talking to or looking at your seatmate’s paper is automatically considered, as cheating that is subject to serious sanctions
as stipulated in the student handbook. (Automatically you will get 0.0 in your final grade).
 NO ERASURE. Any form of erasure will make your answer invalid.
 You have 1 hour to complete the test.

I. MULTIPLE CHOICE [50pts]. Write the letter corresponds to your answer. Write your answer on the space provided.

_____ 1. This statement allows you to control if a program enters a section of code or not based on whether a given condition is true or false.
A. Conditional Statement B. Relational Statement C. If statement D. Logical Statement
_____ 2. This is optional in the Switch Case Statement.
A. break B. Case C. Switch D. Default
_____ 3. It is a predefined variable C++ that indicates you are going to output a stream of characters to an output device.
A. cin B. cin.get() C. cout D. cin.getline()
_____ 4. This instruction is used to insert new line in the cout statement.
A. endl B. \t C. newline D. cin
_____ 5. It is a predefined variable in C++ that indicates you are going to input a stream of characters from an input device.
A. cin B. cin.get() C. cout D. cin.getline()
_____ 6. This operator evaluates an expression returning a value if that expression is true .
A. Assignment Operator B. Conditional Operator C. Arithmetic Operator D. Logical Operator
_____ 7. Given the following instructions, execute and find the result. Results are dependent from each other: int a=8, b=10; b=a++; a= - - b; c=+
+a; d=++b; What is the result of b?
A.10 B. 9 C. 8 D. 7
_____ 8. From Question #43, What is the value of a?
A.10 B. 9 C. 8 D. 7
_____ 9. From Question #43, What is the value of c?
A.10 B. 9 C. 8 D. 7
_____ 10. From Question #43, What is the value of d?
A.10 B. 9 C. 8 D. 7
_____ 11. All lines after these symbol are considered comments and do not have any effect on the behavior of the program.
A. () B. ; C. // D. **
_____ 12. This line corresponds to the beginning of the definition of the main function .
A. int main() B. return 0; C. int a; D. System(“pause”);
_____ 13. This escape code is for new line.
A. \r B. \n C. \t D. \v
_____ 14. This escape code is for horizontal tab.
A. \r B. \n C. \t D. \v
_____ 15. It the step-by-step sequence of instructions that describe how the data is to be processed to produce the desired output.
A. Algorithm B. Psuedocode C. Program D. Compile
_____ 16. It is a diagram showing the flow of instructions in an algorithm .
A. Linker B. Symbols C. Compiler D. Flowchart
_____ 17. It is a sequence of instructions written to perform a specified task for a computer.
A. Sequence B. Control C. Program D. Computer
_____ 18. This symbol is use to terminate each statement in C++ programming.
A. Colon B. Single Quote C. Question Mark D. Semicolon
_____ 19. They are numerical constants that identify integer decimal values. .
A. Integer Numerals B. Float C. Character D. Constant
_____ 20. There are only two valid Boolean values, true and false.
A. Values B. Non-Numeric C. Real Numbers D. Boolean Literals
A.10 B. 9 C. 8 D. 7
_____ 21. From Question #43, What is the value of a upon executing a= - - b?
A.10 B. 9 C. 8 D. 7
_____ 22. It is the symbol used to indicate a comment line in C++ program.
A. /* B. ; C. // D. #
_____ 23. It is the symbol used to indicate a directives in C++ program.
A. /* B. ; C. // D. #
_____ 24. It is the symbol used to terminate each statement in C++ program.
A. /* B. ; C. // D. #
_____ 25. It is the symbol used to indicate a block comment in C++ program.
A. /* B. ; C. // D. #
_____ 26. It is a line that corresponds to the beginning of the definition of the main function that indicates the point by where all C++ programs
start the execution.
A. int main() B. #include <iostream> C. using namespace std D. int a=2
_____ 27. From Question #43, What is the value of c upon executing c= ++ a?
A.10 B. 9 C. 8 D. 7

_____ 28. Which of the following is the proper way initializing variables?
A. B. C. D.

int count; int count = 0; ccount = 0; int count; count = 0;

count = 0; int count;

_____ 29. Which of the following is the proper way identifier declaration?
A. B.

intfirstNum; IntfirstNum,

intsecondNum; secondNum,

C. D.

IntfirstNum, secondNum, intfirstNum; intsecondNum;;

_____ 30. It is a named location in the memory that is used to hold a value that maybe modified by the program .
A. Constant B. Variable C. Integer D. Character
_____ 31. With this prefix you can declare constants with a specific type in the same way as you would do with a variable.
A. const B. int C. char D. float
_____ 32. This operator is used for assigning values to a variable .
A. Assignment Operator B. Relational Operator C. Arithmetic Operator D. Logical Operator
_____ 33. This operator first increments/decrements the value and then assign the value.
A. Suffix B. Postfix C. Implicit D. Prefix
_____ 34. This symbol increments a value by 1.
A. // B. + + C. - - D. /*
_____ 35. This operator first assigns the value and then increments/decrements the value.
A. Prefix B. Explicit C. Postfix D. Implicit
_____ 36. This symbol decrements a value by 1.
A. // B. + + C. - - D. /*
_____ 37. It is an object where a program can either insert or extract characters to/from it.
A. Value B. Variable C. Library D. Stream
_____ 38. These are also known as relational expressions.
A. Constant B. Variable C. Expression D. Condition
_____ 39. It is used to select which statements are performed next based on a condition.
A. Constant B. Repetition C. Expression D. Selection
_____ 40. From Question #43, What is the value of a upon executing b=a++?

II. PROGRAM SIMULATION [50pts].

1. Given the following expressions Num1 = 20, Num2 = 10. Evaluate and give the results. Note: results are dependent from each
other.(15pts)

Num1 = Num2 is ? =
Num1 *= Num2 is ? =
Num1 /= Num2 is ? =
Num1 %= Num2 is ? =
Num1 += Num2 is ? =
Num1 -= Num2 is ? =

2. Give the output of the code segment below:

#include <iostream>
Output:
using namespace std;
int main()
{
int i, j;
j = 10;
i = (j++, j + 100, 999 + j);
cout << i;
return 0;
}

You might also like