1. JOJI ILAGAN CAREER CENTER FOUNDATION, INC.
COLLEGE OF BUSINESS AND TOURISM
Gov. Chavez St., Davao City
Com Ed 6 – Programming with C++
FINAL EXAMINATION JEFF REY A. COMIDOY
2nd Sem SY 2012-2013 Com Ed Instructor
75 Points
I. Choose the letter of the correct answer.
1. Used to repeat a block of codes being able to have repeatedly executed block of codes belongs to what structure?
a. Iteration structures b. Conditional structures c. Jump statements d. Selective structures
2. The “if” keyword is used to execute a statement or block only if a condition is fulfilled. What structure do this belong?
a. Iteration structures b. Conditional structures c. Jump statements d. Selective structures
3. Using “break” we can leave a loop even if the condition for its end is not fulfilled. It can be used to end an infinite loop. This structure is called…
a. Iteration structures b. Conditional structures c. Jump statements d. Selective structures
4. The objective of this structure is to check several possible constant values for an expression. What do you call this structure?
a. Iteration structures b. Conditional structures c. Jump statements d. Selective structures
5. In what structure this syntax belongs: for (initialization; condition; increase) statement;
a. Iteration structures b. Conditional structures c. Jump statements d. Selective structures
6. In what structure this syntax belongs: if (condition) statement
a. Iteration structures b. Conditional structures c. Jump statements d. Selective structures
7. What structure in C++ does this syntax “break” belongs?
a. Iteration structures b. Conditional structures c. Jump statements d. Selective structures
8. In what structure this syntax belongs: switch (expression){case constant1: group of statements 1;...
a. Iteration structures b. Conditional structures c. Jump statements d. Selective structures
9. In what structure this syntax belongs: do statement while (condition);
a. Iteration structures b. Conditional structures c. Jump statements d. Selective structures
10. In what structure does “exit” code in C++ belongs?
a. Iteration structures b. Conditional structures c. Jump statements d. Selective structures
II. Fill in the blanks. Answer the following C programming source code. (10 pts)
#1____ <conio.h>
#include <iostream.h>
#include <stdio.h>
using namespace std;
void 2____ ()
{
int n;
3____(“Enter the starting number “ );
4____(“%d”, &5____);
while (n>0)
{
6____(“%d, ”, 7____)8____
--n;
}
9____("FIRE!n");
getch();
10____ 0;
}
III. Application (30 pts)
A. Rewrite the Test II code using for loop. (5 pts)
B. Rewrite the Test II code using the do-while loop. (5 pts)
C. Write the source code in C++ programming format (10 pts)
D. Write the C++ code using for loop. (5 pts)
E. Write the C++ code using do-while loop. (5 pts)
IV. Hands-on (25 pts). Type your Test III-C source code in C++ and run your program. Debug if necessary.