1.
This is how you create a Java multi-line comment to place the following into a comment.
/* Replace the image on the screen and
then move it right 10 pixels */
2.
Suppose you are given a variable named temperature that holds a value. This is how you would write an if-else statement that will display Above Freezing if temperature is greater than 32, Freezing if temperature is equal to 32, else it will display At or Below Freezing.
if (temperature > 32)
System.out.println("Above Freezing");
else (temperature == 32)
System.out.println("Freezing");
else
System.out.println("At or Below Freezing");
3.
Simplify the following expressions to either true or false:
Given:
x is an integer variable holding the value 3
y is an integer variable holding the value -5
z is an integer variable holding the value -4
(x > z) || (y < z) && !(y < x)
4.
True of False. Java is not case-sensitive
5.
This is how you write an if-else statement that will display JCCC 45% of the time, else it will display Cavaliers.
if (Greenfoot.getRandomNumber(100) < 45)
System.out.println("JCCC");
else
System.out.println("Cavaliers");
6.
Write a statement that will declare an integer instance variable called count and set its initial value to 0.
7.
To pass additional data to a method we specify a
A. 
B. 
C. 
D. 
8.
A compiler
A. 
Translates source code into executable code
B. 
C. 
Translates executable code to machine code
D. 
Maintains a collection of programs
9.
In object-oriented programming a class is
A. 
A group of people sharing the same relationship to the means of production.
B. 
A procedure for a calculation inside a program.
C. 
The term used for programs
D. 
A model or template from which objects are created
10.
Write one statement that declares a local variable named city and initializes it to Overland Park.
A. 
String city = “Overland Park”;
B. 
C. 
11.
The best example for the correct way to name a class is
A. 
B. 
C. 
D. 
12.
Write a method signature for a method named "randomMove". The method has no parameters, and it does not return a value.
13.
What the value of x is at the end:
int i=0;
int x=0;
while (i < 4)
{
x = x + i;
i++;
}
A. 
B. 
C. 
D. 
14.
Given the following variable declarations, evaluate the following Boolean expression:
int a= 7;
int b = 12;
int c = 12;
int d = 7;
(a ==c ||a ==b)
15.
Variable Declarations need a data type and a variable name
16.
Which of the following is not a data type in Java?
A. 
B. 
C. 
D. 
E. 
17.
An identifier can be named in Java using letters, digits, underscores and the $ sign. They may not begin with an underscore.
18.
Mark the following identifiers that are valid names to use in Java.
A. 
B. 
C. 
D. 
E. 
19.
Which is the best declaration for a variable that will hold monthly rainfall. It is initialized to 0?
A. 
Float totalMonthlyRainfall = 0.0 ;
B. 
Int totalMonthlyRainfall = 0;
C. 
Float totalMonthlyRainfall;
D. 
Int totalMonthlyRainfall;
20.
Practice with logical operators
Given:
int age1 = 21;
int age2 = 14;
int age3 = 15;
int birth = 0;
String name = “JCCC”;
age1 < age2 && age2 < age3
21.
Given the code below, what are the local variables?
public class MathStudent extends Actor
{
protected String firstName;
protected String lastName;
public MathStudent()
{
firstName = "";
lastName = "";
}
public void countToFive()
{
int i = 1;
int limit = 5;
while (i <= 5)
{
System.out.println(i);
i = i + 1;
}
}
}
A. 
B. 
C. 
FirstName, lastName, limit, i
22.
Mark the arrays that are declared correctly by good programming standard.
A. 
B. 
C. 
D. 
23.
Declare and create a new array of 5 elements for a scores array.
A. 
Int[] scores = new int[5];
B. 
Int[5] scores = new int[];
C. 
24.
Write a line of code to change the element at index 3 to 5 in the scores array.
25.
Objects are created from
A. 
B. 
C. 
D.