Unit 4 Quiz 2 Review

Unit 4 Quiz 2 Review

9th - 12th Grade

24 Qs

quiz-placeholder

Similar activities

Python Next Steps Homework Quiz

Python Next Steps Homework Quiz

8th - 10th Grade

20 Qs

Java Loops

Java Loops

10th - 12th Grade

24 Qs

AQA GCSE Computer Science - 3.2.2 Programming Concepts

AQA GCSE Computer Science - 3.2.2 Programming Concepts

8th - 10th Grade

20 Qs

pra PSPM SC025 (F02 KML)

pra PSPM SC025 (F02 KML)

6th Grade - University

24 Qs

Programming With Karel Vocabulary Quiz

Programming With Karel Vocabulary Quiz

9th - 12th Grade

20 Qs

CODEHS KAREL

CODEHS KAREL

7th - 9th Grade

20 Qs

Javascript

Javascript

11th Grade

20 Qs

for loops quiz coding

for loops quiz coding

9th - 12th Grade

23 Qs

Unit 4 Quiz 2 Review

Unit 4 Quiz 2 Review

Assessment

Quiz

Computers

9th - 12th Grade

Medium

Created by

Bret Dillon

Used 7+ times

FREE Resource

24 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which general for loop definition is written correctly?

for(true)

{

// code

}

if(i<5)

{

// code

}

for(int i = 0; i < count; i++)

{

// code

}

while(condition)

{

// code

}

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Why do we use for loops in Java?

To break out of some block of code

To do something if a condition is true


To do something while a condition is true


To repeat something for a fixed number of times

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Why do we use while loops in Java?

To break out of some block of code

To do something if a condition is true

To repeat some code while a condition is true

To repeat something for a fixed number of times

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which general while loop definition is written correctly?

while(x is true)

{

// code

}

if(i<5)

{

// code

}

while(int i = 0; i < count; i++)

{

// code

}

while(condition)

{

// code

}

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is NOT a reason a programmer should indent their code?


Helps show the structure of the code


Easier for other people to understand


Indenting is a key part of good programming style

Helps shorten the code

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

To maintain good style, where should brackets go in Java programming?


Before defining the run method


Always on their own line


Right after defining a method


Two brackets per line

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Why do we use if statements in Java?


To break out of some block of code


To do something only if a condition is true

To do something while a condition is true

To repeat something for a fixed number of times

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?