Loops (Nested too)

Loops (Nested too)

9th - 12th Grade

8 Qs

quiz-placeholder

Similar activities

Solutions development: WORD PROCESSING

Solutions development: WORD PROCESSING

7th - 10th Grade

12 Qs

VEX Code Two Dimensional Lists

VEX Code Two Dimensional Lists

9th Grade

5 Qs

Comparación de objetos Java

Comparación de objetos Java

11th Grade

6 Qs

BTEC L3 U4 - VB Variables and Constants

BTEC L3 U4 - VB Variables and Constants

11th Grade

10 Qs

06_Tetris Worksheet

06_Tetris Worksheet

9th - 12th Grade

10 Qs

2doPar_4Prog_20251

2doPar_4Prog_20251

9th Grade

10 Qs

2.5 Translators & Facilities - OCR GCSE Computer Science

2.5 Translators & Facilities - OCR GCSE Computer Science

7th - 12th Grade

13 Qs

Code Evaluation

Code Evaluation

9th - 11th Grade

10 Qs

Loops (Nested too)

Loops (Nested too)

Assessment

Quiz

Computers

9th - 12th Grade

Medium

Created by

Raymond Chan

Used 488+ times

FREE Resource

AI

Enhance your content

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

8 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

15 mins • 1 pt

Media Image

What does the following code print?

5 4 3 2 1

-5 -4 -3 -2 -1

-4 -3 -2 -1 0

None of the above

2.

MULTIPLE CHOICE QUESTION

15 mins • 1 pt

Media Image

Consider the following code segment. Which of the following can be used as a replacement for the missing loop header so that the loop prints out “0 2 4 6 8 10”?

while (count == 10)

while (count < 10)

while (count <= 10)

while (count > 10)

3.

MULTIPLE CHOICE QUESTION

15 mins • 1 pt

Media Image

Consider the following code segment. What is count’s value after running this code segment?

0

1

16

6

4.

MULTIPLE CHOICE QUESTION

15 mins • 1 pt

What does the following code print?


for (int i = 3; i < 8; i++)

{

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

}

3 4 5 6 7 8

0 1 2 3 4 5 6 7 8

8 8 8 8 8

3 4 5 6 7

5.

MULTIPLE CHOICE QUESTION

15 mins • 1 pt

Media Image

What does the following code print?

7 rows with 5 columns

7 rows with 4 columns

6 rows with 5 columns

6 rows with 4 columns

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What does the following code print?

A rectangle of 4 rows with 3 star per row.

A rectangle of 5 rows with 3 stars per row.

A rectangle of 4 rows with 1 star per row.

The loops have errors.

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What are the values of var1 and var2 when the code finishes executing?

var1 = 1, var2 = 1

var1 = 2, var2 = 0

var1 = 3, var2 = -1

var1 = 0, var2 = 2

The loop will cause a run-time error with a division by zero.

8.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

Consider the following code segment. How many times is the string “Hi!” printed as a result of executing the code segment?

15

12

10

8