Search Header Logo

while and do while Loop

Authored by Neeraj Kumar

Computers

10th Grade

Used 62+ times

while and do while Loop
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

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.

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?