Data Types and Variables
Input/Output
Making Decisions (IFs and Operators)
Loops
Methods and Classes
100
Name a data type for whole numbers.
Int, long, short
100
What is the difference between input and output?
Input is information that the user puts into the program, output is information the computer sends out to the user.
100
Draw the symbol for less than or equal to
<=
100
What are loops used for in programming?
To repeat tasks
100
Name one built-in class we've used in Java.
math, scanner, string
200
What is a variable?
A storage container for a single piece of information
200
Name two different commands used to generate output.
System.out.print, System.out,println, System.out,printf
200
What is the symbol for "OR" ?
||
200
DAILY DOUBLE!!!
What is the difference between while and do-while loops?
200
Name a method associated with Class Math
max, min, pow, sqrt, exp, sin, cos, tan, log, log10, floor, ceil, round, etc
300
Is String a data type? Why or why not?
String is not a data type, it is a class. This is because Strings are comprised of chars, which are their own data type (for characters)
300
DAILY DOUBLE!!!!!
What is the name of the class associated with input?
300
Write the structure for IF statements
if (condition) {
//statements;
}
else if (condition) {
//statements;
}
else {
//statements;
}
300
What does the following loop do?

int a = 0;
while (a < 100) {
System.out.println(a);
a++;
}
Prints the numbers 1 through 99
300
What is an overloaded method?
Multiple methods with the same name but with different return types or parameters
400
Is this a legal variable assignment?
int y;
int x=5;
4 + x = y;
No. You cannot have mathematical operators on the left-hand side of the equation. It must be written as follows: y=4+x;
400
What is the package that must be imported in order to generate input?
java.util.*
400
What is the output?
int x = 25;
if (x > 46) {
x = x+5; System.out.println(x); } else { x = x - 10; System.out.println(x); }
15
400
Given the following code:

for (int i=12; i<= 25; i++) {
System.out.println(i);
}

What is the 7th integer printed?
18
400
Assume you've created a class called "Dice" that allows the user to create a set of dice. The object Dice can accept two parameters - the number of dice in the game and the number of faces the dice has. Write the code to create a dice object called Yahtzee that contains 5 six-sided dice.
Dice Yahtzee = new Dice(5, 6);
500
There are four rules for naming variables. What are three of them?
1. Cannot be a reserved word.
2. Can only consist of letters, numbers, _, $
3. Cannot begin with a number
4. Case sensitive
500
What is the difference between console.next() and console.nextLine()?
console.next() accepts Strings as input until a space is reached (spaces are not allowed in the String input).

console.nextLine() accepts the entire user input into a single variable, regardless of whether or not spaces are included in the String.

Example: if the user were to type in "Happy Monday!"
String word = console.next() would only save "Happy" into word, whereas String word = console.nextLine() would save "Happy Monday!" into word.
500
Write out the following logical statement as code:
(x is greater than y and z does not equal 14) or (x is less than y modulo 3 and z is greater than or equal to 5 more than y)
(x > 7 && z != 14) || (x < y%3 && z >= y+5)
500
What is the difference between counter-controlled, sentinel-controlled, and flag-controlled loops?
Counter - continue to run until a counter expires; counter changes each iteration.
Sentinel - continue to run until the sentinel value is encountered.
Flag - continue to run until the logic of a boolean loop condition is reversed
500
How does the class String method compareTo() work? In other words, how would you interpret the number it returns?
The method compareTo compares two Strings together. It returns 0 if the Strings are identical, otherwise it returns another number.