Search Header Logo

Loops in C++

Authored by Shiny Verghese

Computers

Used 25+ times

Loops in C++
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

13 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What output is produced by the following segment of code:


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

cout << i << " ";

0 1 2 3 4 5 6 7 8 9 10

0 1 2 3 4 5 6 7 8 9

1 2 3 4 5 6 7 8 9 10

1 2 3 4 5 6 7 8 9

Infinite Loop

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What output is produced by the following segment of code:


for(int fun = 20; fun > 1; fun -=3)

cout << fun << " ";

20 17 14 11 8 5 2 -1

20 17 14 11 8 5 2

17 14 11 8 5 2 -1

20 17 14 11 8 5

Infinite Loop

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What output is produced by the following segment of code:


int start = 5;

int end = 20;

for(; start <= end; start +=2)

cout << start << " ";

5 7 9 11 13 15 17 19 21

7 9 11 13 15 17 19 20

7 9 11 13 15 17 19 21

5 7 9 11 13 15 17 19

Infinite Loop

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What output is produced by the following segment of code:


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

cout << x << " ";

10 9 8 7 6 5 4 3 2 1

10 9 8 7 6 5 4 3 2 1 0

9 8 7 6 5 4 3 2 1

No Output

Infinite Loop

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What output is produced by the following segment of code:


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

cout << * << " ";

* * * * *

* * * * * *

*

No Output

Infinite Loop

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Media Image

What is the output of the above program?

0 1 2 3 4

0 1 2 3

0 1 2 4

0 1 2

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Media Image

What is the output of the above program?

0 1 2 3 4

0 1 2 3

0 1 2

0 1

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?