Output
Loops
Operators
Variables and Arrays
100

What is the output of the following:

Hello World!

100

What are the two basic kinds of loops?

for loop and while loop.
100

What does num++ do?

Add num to 1.

100

The type of variable used to store whole numbers.

int
200

What is the output of the following:

8

200

When should you use a for loop and when should you use a while loop?

Use a for loop when you want to do something a specific number of times. Use the while loop when you do not know how many times you want to repeat.

200

What does num += 5 do? 

Add num by 5.

200

The type of variable that can be true or false.

Boolean.

300

What is the output of the following:


25

300

What is the output of this loop?



Infinite loop.

300
What is the result of num after this code?


int num = 10;

num /= 3;


num = 3

300
What kind of variable is "5.0"

A string.

400

What's the output of this code?

String a. = "He"

String b = "llo";

String c = " World";

String sentence = a+b+c;

System.out.println(sentence);

"Hello World"

400

If we want to count from 10 to 20 by 2s what are X, Y, and Z in the code below:

X = 10, Y = 21, Z = 2

400

What is 15 % 6? 

The answer is 3. % finds the remainder.
400

Difference between a char and a string? 

A char holds one character and uses single quotes

Example:

char c = 'h' ;

String word = "hello";

500

What are the first two printed numbers for this loop?

25

9

500

Given a string input and an int n return a larger string that is n copies of the original string.

string_times('Hi', 2) → 'HiHi'

string_times('Hi', 3) → 'HiHiHi'

Fill in the missing code:


500

What does num1** do ?

This doesn't exist.

500

How do we define an integer array with storing 15 student's grades? 

int[] grades = new int [15]

M
e
n
u