Control Structures

Control Structures

Assessment

Flashcard

Computers

12th Grade

Hard

Created by

Wayground Content

FREE Resource

Student preview

quiz-placeholder

17 questions

Show all answers

1.

FLASHCARD QUESTION

Front

What will be the output of this program?
var number = 5;
var greater_than_zero = number > 0;
if (greater_than_zero){
println(number % 2);
}

Back

1

2.

FLASHCARD QUESTION

Front

What will be the output of this program?
var number = 5;
var greater_than_zero = number > 0;
if (greater_than_zero){
if (number > 5){
println(number);
}}

Back

Nothin will print

3.

FLASHCARD QUESTION

Front

What will print?
var isRaining = false;
var isCloudy = false;
var isSunny = !isRaining && !isCloudy;
var isSummer = false;
var isWarm = isSunny || isSummer;
println("Is it warm: " + isWarm);

Back

Is it warm: true

4.

FLASHCARD QUESTION

Front

What will be printed if var numApples = 10; var numOranges = 5; if(numApples < 20 || numOranges == numApples) { println("Hello, we are open!"); } else { println("Sorry, we are closed!"); } println("Sincerely, the grocery store");

Back

Hello, we are open!
Sincerely, the grocery store

5.

FLASHCARD QUESTION

Front

What will print?
var above16 = true;
var hasPermit = true;
var passedTest = false;
if (above16 && hasPermit && passedTest){ println("Issue Driver's License"); } else { if (above16 || hasPermit || passedTest) { println("Almost eligible for Driver's License"); } else { println("No requirements met."); }}

Back

Almost eligible for Driver’s License

6.

FLASHCARD QUESTION

Front

What will be printed by the following code? var numberOne = 5; var numberTwo = 10; if (numberOne == 5) { println(1); } if (numberOne > 5) { println(2); } if (numberTwo < 5) { println(3); } if (numberOne < numberTwo) { println(4); } if (numberOne != numberTwo) { println(5); }

Back

1 4 5

7.

FLASHCARD QUESTION

Front

We want to print the phrase “CodeHS is the best” exactly 25 times. What kind of control structure should we use?

Back

For loop

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?