while and do while Loop

while and do while Loop

10th Grade

11 Qs

quiz-placeholder

Similar activities

Loops

Loops

9th - 12th Grade

10 Qs

Java: repetition control structure for & while

Java: repetition control structure for & while

10th - 12th Grade

10 Qs

Python Beginner

Python Beginner

9th - 10th Grade

16 Qs

CodeHS While Loops

CodeHS While Loops

9th - 12th Grade

12 Qs

CSP-A114 Quiz

CSP-A114 Quiz

9th - 12th Grade

12 Qs

Python - Loops & Lists

Python - Loops & Lists

7th - 11th Grade

15 Qs

Recursion Contest

Recursion Contest

10th - 12th Grade

10 Qs

Loops

Loops

9th - 12th Grade

12 Qs

while and do while Loop

while and do while Loop

Assessment

Quiz

Computers

10th Grade

Hard

Created by

Neeraj Kumar

Used 59+ times

FREE Resource

11 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In a While loop a code will be repeated until the condition becomes

FALSE

TRUE

User choice

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Print i as long as i is less than 6.

What will be the code?

i = 1

while i < 6:

print(i)

i += 1

i = 1

when i < 6;

print(i)

i += 1

i = 1

i < 6:

print(i)

i += 1

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In programming, what is iteration?
The repetition of steps within a program
The order in which instructions are carried out
A decision point in a program
Testing a program to make sure it works

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which is the correct format of a do-while loop?

do-while(condition);

{

//code

}

do{

//code

}while(condition);

do-while(condition)

{

//code

}

do{

//code

}while(condition)

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

14) What is the output of the below Java program?

int a=1;

while(a<4)

{

System.out.print(a + " ");

a++;

}

1 2 3 4

1 2 3

6

Compiler error

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the below Java program with a decrement operator and WHILE-loop?

int a=4;

while(a>0)

{

System.out.print(a + " ");

a--;

}

4 3 2 1

3 2 1

Compiler error

None

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the main difference between a WHILE and a DO-WHILE loop in Java?

WHILE loop executes the statements inside of it at least once even if the condition is false.

DO-WHILE loop executes the statements inside of it at least once even if the condition is false.

WHILE loop is fast.

DO-WHILE loop is fast.

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?