Search Header Logo

QP-LPS

Authored by Rajesh Yelchuri

others

QP-LPS
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

25 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a valid syntax for a for loop in C?

for (initialization; condition; update)
for (condition; initialization; update)
for (initialization; update; condition)
for (condition; update; initialization)

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How many times will the following loop execute? for (int i = 0; i < 5; i++) { printf("%d", i); }

4
5
6
Infinite

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code? int i = 0; while (i < 3) { printf("%d", i); i++; }

012
0123
123
1234

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which loop is guaranteed to execute at least once?

for loop
while loop
do-while loop
Both for and while

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is used to exit a loop prematurely?

continue
break
goto
return

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of this code? for (int i = 1; i <= 3; i++) { printf("%d", i); }

1 2 3
2 1 2
1 2 3 4
Error

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which statement skips the current iteration of a loop?

skip
pass
continue
break

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?