For Loops Lecture Questions

For Loops Lecture Questions

9th Grade

6 Qs

quiz-placeholder

Similar activities

Xcode and Playgrounds

Xcode and Playgrounds

9th - 11th Grade

9 Qs

สอบเก็บคะแนน ไพทอน ม.4

สอบเก็บคะแนน ไพทอน ม.4

9th - 12th Grade

10 Qs

ÔN TẬP CUỐI KÌ 1_TIN 9

ÔN TẬP CUỐI KÌ 1_TIN 9

9th Grade

10 Qs

Kuiz ASK T3 - BAHAGIAN B SET 1

Kuiz ASK T3 - BAHAGIAN B SET 1

9th Grade

11 Qs

PBO XII RPL

PBO XII RPL

9th - 12th Grade

10 Qs

Internet

Internet

7th - 10th Grade

10 Qs

AI and Python: Ch.1 Revision

AI and Python: Ch.1 Revision

9th Grade

10 Qs

For Loops Lecture Questions

For Loops Lecture Questions

Assessment

Quiz

Computers

9th Grade

Practice Problem

Medium

Created by

Arasaka Teacher

Used 1+ times

FREE Resource

AI

Enhance your content in a minute

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

6 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

for(int i = 3; i > 0; i--) {

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

}

What is the output of the code above?

3 2 1 0

1 2 3
3 2 1
3 2

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

for (int i = 0; i < 4; i++); {

System.out.println(i);

}

What is the error in the code above?

There is no semicolon ( ; ) after the for loop

The code is correct

The print statement should be outside of the curly braces {}

The curly braces {} should be square brackets[]

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

for (int i = 0; i < 11; i++) {

System.out.println(i);

}

I want to change the above code so that it counts from 5 to 10 instead of 0 to 10. What code should I change?

for (int i = 1; i <= 5; i++)

{ System.out.println(i); }

for (int i = 5; i < 11; i++)

{ System.out.println(i); }

for (int i = 5; i < 11; i++)

{ System.out.println(i); }

for (int i = 0; i < 11; i+=2)
{ System.out.println(i); }

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

int count = 0;

for (int i = 10; i > 0; i--)

System.out.println(i);

count++;

What is the problem with the code above?

There is a missing semicolon ( ; )

There are no curly braces {}

There are no square brackets []

The code is correct

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

for (int i = 10; i < 20; i += 3) {

System.out.println(i);

}

What is the output of the code above?

13

16

19

22

10

13

16

19

22

13

16

19

10 13 16 19

6.

OPEN ENDED QUESTION

3 mins • 1 pt

int[] nums = {1, 2, 3, 4};

int index = 0;

while (index < nums.length) {

  nums[index] *= 2;

  index += 2;

}

Rewrite the above code so that it uses a for loop instead of a while loop.

Evaluate responses using AI:

OFF

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?