Looping in C

Looping in C

University

10 Qs

quiz-placeholder

Similar activities

Arrays in C (II yr 02.07.2020)

Arrays in C (II yr 02.07.2020)

University

10 Qs

Week3

Week3

University

10 Qs

pointers and structures

pointers and structures

University

10 Qs

PRF192 C Programming

PRF192 C Programming

University

13 Qs

CC102 - Repetition Control Structures

CC102 - Repetition Control Structures

University

10 Qs

Computer programming-Array

Computer programming-Array

University

10 Qs

Plot the Code

Plot the Code

University

10 Qs

C Program Array and strings

C Program Array and strings

University

10 Qs

Looping in C

Looping in C

Assessment

Quiz

Computers

University

Hard

Created by

Dr. Singh

Used 3+ times

FREE Resource

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

The C code ‘for(;;)’ represents an infinite loop. It can be terminated by ___________

a goto statement
a continue statement
a return statement

a break statement

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be printed by the given code ?

#include <stdio.h>

int main()

{ int z = 1;

while (z <= 5)

{ if (z == 3)

{ z++; }

printf("%d ", z);

z++; }
return 0; }

2 3 4 5

1 2 4 5

2 3 4 5 6
1 2 3 4 6

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

what will be printed by the following code?

#include<stdio.h>

int main()

{while(1)

{printf("Hello ");}

return 0;

}

Hello Hello Hello ... (infinitely)

Hello is printed once

Run time error

Compile time error

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

The for statement

for(expr1;expr2;expr3)

{statement;}

is equivalent to

while(expr1 == expr2)

{

statement;

expr3;

}

while(expr1 != expr2)

{

statement;

expr3;

}

expr1;

while(expr2)

{

statement;

expr3;

}

None of the above

5.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

The code:

#include<stdio.h>

int main()

{int j = 0;

while(j<3)

{j++;

printf("In the loop");}

How many times 'j' value is checked?

2
3
5
4

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In which type of loop, the body of the loop is executed at least once

for loop
while loop

both for and while loop

do-while loop

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output?

#include<stdio.h>

int main()

{ int p=1;

while(p=8)

{ printf("Test ");

p++;}}

Prints 'Test ' followed by 'Done'
Single print of 'Test'
Infinite loop printing 'Test '
No output due to syntax error

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?