Question

Language is C++ Complete the following Review Questions: 1. This is a control structure that repeats...

Language is C++

Complete the following Review Questions:

1. This is a control structure that repeats a group of statements in a program?

a. loop

b. switch

c. main() function

d. compiler

2. In the expression number++,the ++operator is in what mode?

a. Prefix

b. Pretest

c. Postfix

d. Posttest

3.This is a variable that controls the number of iterations performed by a loop.

a. Loop control variable

b. Accumulator

c. Iteration register variable

d. Repetition meter

4. The do-whileloop is this type of loop.

a. Pretest

b. Posttest

c. Prefix

d. Postfix

5. This type of loop has no way of ending and repeats until the program is interrupted.

a. Indeterminate

b. Interminable

c. Infinite

d. Timeless

6. This expression is executed by the forloop only once, regardless of the number of iterations.

a. Initialization expression

b. Test expression

c. Update expression

d. Pre-increment expression

7. This is a special value that signals when there are no more items from a list of items to be processed.  This value cannot be mistaken as an item from the list of items.

a. Sentinel

b. Flag

c. Signal

d. Accumulator

Analyze code question:

8. What are the 3 parts/components of any loop that control the repetition of the loop:

a. ______

b. ______

c. ______

9. Viewing the code snippet below answer the following questions:

int x = 5;

cout << x++;

a. What will the cout statement in the following program segment display? ___

b. What is the value of x?  __

10. Viewing the code snippet below answer the following questions:

int num=1, min=3, max=10;

int total=0;

while (num < max)

{

    if (num > min)

    {

        total += 10;

    }

    num++;

}

After the above code is executed:

a. What is value of num: ____________

b. What is value of total: _____________

c. What is value of min: _________________

d. What is value of max: ______________

11. Viewing the code snippet below answer the following questions:

int x=5;

int y=0;

for (int i=1; i < x; i++)

{

    y += x;

}

cout << “Value of x=“ << x << endl;

cout << “Value of y=“ << y;

After the above code is executed:

a. What is printed to console? ________________

12. Convert the following code to a for loop…:

int num=0;

int total=0;

while (num < 5)

{

     total += num;

     num++;

}

13. Viewing the code snippet below answer the following questions:

int num=0;

int total=0;

while (num < 5)

{

     total += num;

     num++;

}

After the above code is executed:

a. num=_________________

b. total=_______________

14. Viewing the code snippet below answer the following questions:

int num=0;

while (num <= 20)

{

     cout << “Hello \n”;

     num++;

}

After the above code is executed:

a. “Hello” printed how many times: ___________

b. What is value of num:  ____________

15. Viewing the code snippet below answer the following questions:

int num=10;

do

{

     cout << “Hello” << endl;

     num--;

} while(num > 1);

After the above code is executed:

a. “Hello” printed how many times: ___________

b. What is value of num:  ____________

16. Viewing the code snippet below answer the following questions:

int num=5;

for (int i=0; i<5; i++)

     cout << “Hello” << endl;

     num += 2;

cout << “Good-bye” << endl;

After the above code is executed:

a. “Hello” printed how many times: ___________

b. “Good-bye” printed how many times: ___________

c. What is value of num: ____________

17. Viewing the code snippet below answer the following questions:

int num=2;

for (int i=0; i<5; i++

{

for (int j=0; j<5; j++)

          cout << “*”;

     cout << endl;

}

After the above code is executed:

a. What is printed to the console?: ___________

0 0
Add a comment Improve this question Transcribed image text
Answer #1

according HomeworkLib terms and conditions first four questions are compulsory

Remaining all are optional

But I provided first 9 questions with perfect answers

Some questions not there any explanation

So I provided direct answers

Anything doubtful or not understand or missing or incorrect just comment

I will touch with you and help in future

Thank you and all the best

Don't be dislike

Add a comment
Know the answer?
Add Answer to:
Language is C++ Complete the following Review Questions: 1. This is a control structure that repeats...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • ,,1. Which of the following statments are valid C++ statements? A) cout << "Hello World" :...

    ,,1. Which of the following statments are valid C++ statements? A) cout << "Hello World" : B) cout << Hello World; C) cout << "Hello " << "World" ; D) cout << "Hello" << "World" ; 2. What is the difference between the literals 'A' and "A"? ,3. Read the input from user; Check for valid entries If input is invalid: print an error message; else: calculate the result and print to the console; exit; The code snippet above may...

  • What is the output of the following code snippet? (If there is some kind of syntax...

    What is the output of the following code snippet? (If there is some kind of syntax error indicate this by marking "error" in your answer choice) 1.        int fly = 5; int x;        if (fly-- > 5)               x = 5;        else               x = 2;        if (x++ > 3)               cout << x;        cout << fly << endl; 2.   int i = 0;        bool b = i == 0 || i++ > 0;        if (!b)               cout << i << endl;        else               cout...

  • 51. What is the output of the following code snippet? int number = 0; int ptr_num...

    51. What is the output of the following code snippet? int number = 0; int ptr_num -&number ptr_num 60; number-80 cout < "ptr num << endl b, 60 c. 80 d. the address of number Answer 52. What is the output of the following code snippet? double num-0.0; double* ptr = &num; num = 15.0; ptr ptr 15.0 cout << num <<"ptr <<endl; a. 15 15 b. 15 30 С. 30 15 d. 30 30 Answer: 53. What is the...

  • Class: C++ Final Exam Dates Multiple Choice Identify the choice thar best completes the statement or...

    Class: C++ Final Exam Dates Multiple Choice Identify the choice thar best completes the statement or answer the question N 1. In s tructures, the computer repeats particular statements a certain number of times depending on some condition(s) a. looping C. selection b. branching d. sequence 2. What is the output of the following CH code? count = 1; num - 25; while (count < 25) numnum - 1: count++; cout << count << " " << num << endl;...

  • C++ 5.How many times will the following loop run? int i=5; while (i19) 6 . What...

    C++ 5.How many times will the following loop run? int i=5; while (i19) 6 . What is the output of the following code snippet? int time 1; int year2 int rate = 1; int principal = 5; int interest-0 cout <<i < endl while (year< 5) interest (principal * time rate) /1 ; cout << interest << endl; year++

  • What is the output of the following C++ code? int count = 1; int num =...

    What is the output of the following C++ code? int count = 1; int num = 25; while (count < 25) { num--; count++; } cout << count « " " « num << endl i 25 1 0 24 1 0 25 0 0 24 0 In this while loop statement, while (counter < 10), where counter is an int variable. Which statement below is an equivalent way to write this while statement? while (10 < counter) while (9...

  • A. What is the output of the following C++ code fragment? (all variables are of type...

    A. What is the output of the following C++ code fragment? (all variables are of type int) int count-1; int y-100; while (count 3) y=y-1 ; count+t cout << y << endl; cout<< count <<endl What is the value of x after control leaves the following while loop? (all variables are of type int) B. int x0 while (x < 20) sum- sum+x cout << sum<< endl;

  • QUESTION 1 What is the output of the following code snippet? int main() { bool attendance...

    QUESTION 1 What is the output of the following code snippet? int main() { bool attendance = false; string str = "Unknown"; attendance = !(attendance); if (!attendance) { str = "False"; } if (attendance) { attendance = false; } if (attendance) { str = "True"; } else { str = "Maybe"; } cout << str << endl; return 0; } False True Unknown Maybe QUESTION 2 What is the output of the following code snippet? #include <iostream> #include <string> using...

  • It's a C++ code. 2. Answer the following questions in a word document. 6. What is...

    It's a C++ code. 2. Answer the following questions in a word document. 6. What is the output of the following C++ code? (2, 3) int inti - 26 int int2 = 45; int intPtr - Einti; int int2Ptr - Gint2: intPtr -89; int2Ptr - 623 intiptr - int2Ptr intPtr - 80 intl -57 cout << inti «..« int2 << endl; cout << *intiptr «« int2Ptr << endl; 7. Given the following statements: int num; int numPtr write C++ statements...

  • Please, explain your answer clearly (step-by-step) What output does this loop generate? int j = 1;...

    Please, explain your answer clearly (step-by-step) What output does this loop generate? int j = 1; do { int value = j * 2; j++; cout << value << ", "; } while (j <= 5); What is the output of the following code snippet? int my_fun (int A[], int size) {   int result = 0;   for (int i = 0; i < size; i++)   {    result = result + A[i];   }   return result; } int main() {   int...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT