Looping in C

Looping in C

University

10 Qs

quiz-placeholder

Similar activities

SLG IPC Week 7

SLG IPC Week 7

University

13 Qs

C-Basic

C-Basic

University

10 Qs

Quiz on Functions#1

Quiz on Functions#1

University

15 Qs

javaquizvivek

javaquizvivek

University

12 Qs

Java Control Flow statements

Java Control Flow statements

University

10 Qs

POP QUIZ !

POP QUIZ !

University

8 Qs

Quiz 1 - Intro to C

Quiz 1 - Intro to C

University

10 Qs

Basic C Knowledge Exercise

Basic C Knowledge Exercise

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?