Tracing Loops in Java
3 days ago
olsonl
Save
Edit
Host a game
Live GameLive
Homework
Solo Practice
Practice
17 QuestionsShow answers
  • Question 1
    180 seconds
    Q.

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

    answer choices

    var1 = 1, var2 = 1

    var1 = 2 , var2 = 0

    var1 = 3, var2 = -1

    var1 = 0, var2 = 2

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

  • Question 2
    180 seconds
    Q.

    What are the values of x and y when the code finishes executing?

    answer choices

    x = 5, y = 2

    x = 2, y = 5

    x = 3, y = 4

    x = 4, y = 3

    Infinite Loop

  • Question 3
    180 seconds
    Q.

    How many stars are printed?

    answer choices

    7

    3

    4

    5

    Infinite Loop

  • Question 4
    180 seconds
    Q.

    In total, how many times is the inner loop executed?

    answer choices

    5

    10

    15

    50

    Infinite Loop

  • Question 5
    180 seconds
    Q.

    How many times does the loop print a *

    answer choices

    40

    20

    24

    30

    Infinite Loop

  • Question 6
    180 seconds
    Q.

    What does the following code print?

    answer choices

    A rectangle of 8 rows with 5 stars per row

    A rectangle of 8 rows with 4 stars per row

    A rectangle of 6 rows with 5 stars per row

    A rectangle of 6 rows with 4 stars per row

    Infinite Looo

  • Question 7
    180 seconds
    Q.

    What does the following code print?

    answer choices

    A rectangle of 9 rows with 5 stars per row

    A rectangle of 6 rows with 6 stars per row

    A rectangle of 7 rows with 5 stars per row

    A rectangle of 7 rows with 6 stars per row

    Infinite Loop

  • Question 8
    180 seconds
    Q.

    How many times is "HI!" printed?

    answer choices

    15

    12

    10

    8

    Infinite Loop

  • Question 9
    180 seconds
    Q.

    What does the following code print?

    answer choices

    5 6 7 8 9

    4 5 6 7 8 9 10 11 12

    3 5 7 9 11

    3 4 5 6 7 8 9 10 11 12

  • Question 10
    180 seconds
    Q.

    How many times does the following method print a *?

    answer choices

    9

    6

    7

    10

  • Question 11
    180 seconds
    Q.

    What does the following code segment print?

    answer choices

    5 4 3 2 1

    -5 -4 -3 -2 -1

    -4 -3 -2 -1 0

  • Question 12
    180 seconds
    Q.

    How many times does the code print a * ?

    answer choices

    7

    8

    12

    13

  • Question 13
    180 seconds
    Q.

    How many times does this print a * ?

    answer choices

    4

    5

    6

    7

  • Question 14
    180 seconds
    Q.

    How many times does this code print at * ?

    answer choices

    5

    6

    7

    8

  • Question 15
    180 seconds
    Q.

    What does the code print?

    answer choices

    1 2 3 4

    1 2 3 4 5

    0 1 2 3 4

    0 1 2 3 4 5

  • Question 16
    180 seconds
    Q.

    How many stars are printed?

    answer choices

    10

    5

    25

    50

  • Question 17
    180 seconds
    Q.

    What is printed when the code segment is executed?

    answer choices

    0 2 4 6 8 10 12 14 16 18

    0 6 12 18

    1 4 7 10 13 16 19

    4 10 16

Report Quiz
Join a game