while and do while Loop

while and do while Loop

10th Grade

11 Qs

quiz-placeholder

Similar activities

ICS Test #4 review

ICS Test #4 review

9th - 12th Grade

15 Qs

MK Java for-Loop Quiz 2

MK Java for-Loop Quiz 2

8th - 12th Grade

10 Qs

Recursion Contest

Recursion Contest

10th - 12th Grade

10 Qs

For Loops HW

For Loops HW

9th - 12th Grade

12 Qs

Intro to Java Loops

Intro to Java Loops

9th - 12th Grade

15 Qs

Python Iteration

Python Iteration

10th Grade

13 Qs

For and While Loops in Python

For and While Loops in Python

9th - 12th Grade

16 Qs

Programming - Iteration, Basic Programming Constructs & Loop

Programming - Iteration, Basic Programming Constructs & Loop

2nd - 12th Grade

10 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?