
For Loops Lecture Questions
Authored by Arasaka Teacher
Computers
9th Grade
Used 1+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
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
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
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

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
10 questions
Programming Terms
Quiz
•
8th - 10th Grade
10 questions
Test sul Software
Quiz
•
9th Grade
10 questions
KS4 Programming Techniques (1)
Quiz
•
8th - 10th Grade
10 questions
TUGAS KELAS 9 - CMS
Quiz
•
9th Grade
10 questions
KTTX-T4
Quiz
•
9th - 12th Grade
10 questions
Internet
Quiz
•
7th - 10th Grade
10 questions
Computer Hardware
Quiz
•
3rd - 11th Grade
10 questions
Virus Informáticos
Quiz
•
1st - 10th Grade
Popular Resources on Wayground
7 questions
History of Valentine's Day
Interactive video
•
4th Grade
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
15 questions
Valentine's Day Trivia
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
Discover more resources for Computers
10 questions
Exploring Valentine's Day with Charlie Brown
Interactive video
•
6th - 10th Grade
18 questions
Valentines Day Trivia
Quiz
•
3rd Grade - University
20 questions
El Verbo IR Practice
Quiz
•
9th Grade
10 questions
Valentine's Day History and Traditions
Interactive video
•
6th - 10th Grade
20 questions
Graphing Inequalities on a Number Line
Quiz
•
6th - 9th Grade
20 questions
Exponent Properties
Quiz
•
9th Grade
21 questions
Presidents Day Trivia
Quiz
•
6th - 12th Grade
10 questions
Valentine's Day: History and Modern Celebration
Interactive video
•
9th - 12th Grade