PART A
1. Fill in the blanks in each of the following statements:
- Typically, ______
statements are used for counter-controlled repetition and _____
statements are used for sentinel-controlled repetition.
- The ________repetition statement tests the loop-continuation condition at the end of the loop.
- The ______
statement can be used only for testing constant integral expressions.
- When used as a condition, any nonzero value implicitly converts to _____; 0 (zero) implicitly converts to ________.
- In addition to selection and repetition statements, the ________
and _________statements are used with control statements to alter the flow of control.
for
while
do…while
switch
true
break
continue
false
2. Fill in the third column in the following tables:
expression1 | expression2 | expression1 || expression2 |
false | false | |
false | true | |
true | false | |
true | true |
expression1 | expression2 | expression1 && expression2 |
false | false | |
false | true | |
true | false | |
true | true |
PART B
1. Write a program to output even numbers 1 to 20 using three types of loop statement (while, do-while and for).
- C++ program using 'while'
- C++ program using 'do-while'
- C++ program using 'for'
2. Write a program that input a grade. If the grade is less than 0 or greater than 100, your program should print the appropriate message informing the user that an invalid grade has been entered. Start with a pseudocode and flowchart.
- PSEUDOCODE
- FLOWCHART
2.3 C++ PROGRAM
- Write a program that input ten (15) integers. Print out the sum of those integers.
- PSEUDOCODE
- PSEUDOCODE
- FLOWCHART
3.3 C++ PROGRAM
Due date : / 03 /2011
No comments:
Post a Comment