Question
please do it in c++ programing language Replace answer in the program with your answer to each question below. Make no other changes to the
please do it in c++ programing language
Replace answer in the program with your answer to each question below. Make no other changes to the program You have 3 attempts at this quiz.
1. A loop will continue to execute as long as the condition is _.
A)True B)False
2. Each execution of the loop body is called an
A)run B)iteration C)execution
3. A do-while loop will execute the body of the loop once _ checking the condition.
A) after B) before
4. If there is no change that occurs inside the loop and the condition is always met you will have a(n) __.
A)perfect loop B)infinite loop
5. What is the output of this program?
i=0; while (i <= 10) { // Loop body i = i + 2; cout << i << ; } A) 2 4 6 8 10 12 B) 2 4 6 8 10 C) infinite loop
6. What is the output of this program?
int i =5; while (i >= 1) { // Loop body --i; cout << i << " "; } A) 5 4 3 2 1 B) infinite loop C) 4 3 2 1 0
7. What is the output of this program?
int x = 5; int y = 18; while (y >= x) { cout << y << " "; y = y - x; } A) 18 17 16 B) infinite loop C) 18 13 8
8. What is the output of this program?
int x = 10; while (x != 3) { cout << x << " "; x = x / 2; } A) infinite lop B) 10 5 2
9. What is the value of num when the program has completed?
int count = 0; int num = 4; do { num = num - 1; count = count + 1; } while (num > 2); A) 2 B) 3
10. Assume user would enter 'n', then 'n'. How many iterations will occur?
// Get userChar from user here while (userChar != 'n') { // Do something // Get userChar from user here } A) 2 B) none
code:
#include
int main() {
cout << "1: " << "answer" << endl; cout << "2: " << "answer" << endl; cout << "3: " << "answer" << endl; cout << "4: " << "answer" << endl; cout << "5: " << "answer" << endl; cout << "6: " << "answer" << endl; cout << "7: " << "answer" << endl; cout << "8: " << "answer" << endl; cout << "9: " << "answer" << endl; cout << "10: " << "answer" << endl;
return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started