1. JOJI ILAGAN CAREER CENTER F OUNDATION , INC .
COLLEGE OF BUSINESS AND TOURISM
Gov. Chavez St., Davao City
Com Ed 6 – Programming with C++
MIDTERM EXAMINATION JEFF REY A. COMIDOY
2nd Sem SY 2012-2013 Com Ed Instructor
75 Points
I. Choose the letter of the correct answer.
1. When a C++ program must choose whether to take a particular action, you usually implement the choice with an IF statement.
a. Single Selection b. Double Selection c. Repetition Structure d. None of these
2. Let a program decide which of two statements or blocks are executed.
a. Single Selection b. Double Selection c. Repetition Structure d. None of these
3. allows the programmer to specify that an action is to be repeated while some condition remains true.
a. Single Selection b. Double Selection c. Repetition Structure d. None of these
4. C++ that provides three types of selection structures, which one of the following:
a. Single Selection b. Double Selection c. Repetition Structure d. None of these
5. A “special” character that sounds the system bell or an alert.
a. n b. t c. r d. a
6. A “special” character that position the screen cursor to the beginning of the current line; do not advance to the next line.
a. n b. t c. r d. a
7. A “special” character that move the screen cursor to the next tab stop.
a. n b. t c. r d. a
8. A “special” character that position the screen cursor to the beginning of the next line; it advances to the next line.
a. n b. t c. r d. a
9. Data type that can be stored as integer number.
a. int b. char c. double d. variable
10. Data type that can be stored as character.
a. int b. char c. double d. variable
11. Data type that can be stored as floating point number
a. int b. char c. double d. variable
12. Location in memory where a value can be stored for use by a program.
a. int b. char c. double d. variable
13. A program that initializes the tested variable before testing the condition.
a. If Loop b. Do While Loop c. While Loop d. For Loop
14. A program evaluates the test condition expression. If it is true, the program executes the statement( s) in the body.
a. If Loop b. Do While Loop c. While Loop d. For Loop
15. A program execute first the statement( s) in the body before evaluating the test condition expression.
a. If Loop b. Do While Loop c. While Loop d. For Loop
II. Write the code of the following problem using For loop (2 pts), While loop (2 pts), Do While loop (2 pts)
1. Ask the user 10 numbers and add all the 10 numbers. Output the total.
2. Ask the user 5 cocktail mixes using loops. Output one name in every line.
3. Ask the user a number from 1 to 10 and output “Correct” if it is equals to 5.
4. Ask the user to input 5 numbers and multiply every number to itself. Output the five results.
5. Output “Please Press A” on the monitor and exits the program when the user presses A.
III. (30 pts) Write an algorithm (10 pts), flowchart (10 pts) and C++ code (10 pts).
Ask the user two numbers and add the numbers. Show the total.