Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Sam Dominique M.

Punzalan 05 – 31 – 22

10 – Mosely

SUMMATIVE TEST

I. Identification
1. Loop
2. Loop Control Condition
3. Counter Variable
4. 1
5. Do-while loop
6. Loop Body
7. Accumulator Variable
8. While Loop
9. Do-while loop
10. For loop
II. Multiple Choice
1. A
2. B
3. A
4. C
5. D
6. B
7. A
8. C
9. D
10. B
11. A
12. C
13. A
14. D
15. C
III. Answer as required
16. 20
17. 400
18.
#include <iostream>
using namespace std;
int main()
{
for(int x = 1; x <= 50; x++)
{
cout << x << endl;
}
}
19.
#include <iostream>
using namespace std;
int main() { int x = 1; do
{
cout << "Computer Science Gods" << endl;
}
while (x<=10);
}
}
20.
#include <iostream>
using namespace std;
int main()
{
int x = 1; while(x <= 20)
{
cout << "Viva MASCI" << endl; x++;
}
}
21-22.

int x = 99;

do

cout << x << endl;; x-=2;

} while (x > 0);

23-24.

int x;

for (x = 100; x > 0; x-=2)

cout << x << endl;

25.

#include <iostream>

using namespace std;

int main()

int x; for (x = 10; x >= 0; x--)

cout << "I LOVE COMPUTER SCIENCE X" << endl;

IV. Problem solving involving loop statement: Trace the


output.
1.
0-10
11-10
12-22
13-22
14-36
15-36
16-52
17-52
18-70
19-70
20-90

2.
RRRRRRRRR
RR-----RR
R-R---R-R
R--R-R--R
R---R---R
R--R-R--R
R-R---R-R
RR-----RR
RRRRRRRRR

3.
--------9
-------98
------987
-----9876
----98765
---987654
--9876543
-98765432
987654321

4.
-1357997531ILOVECS
--13577531ILOVECS
---135531ILOVECS
----1331ILOVECS
-----11ILOVECS
V. Programming

1.

2.
3.

You might also like