Sunteți pe pagina 1din 303

1. Which line of code does not assign 3.5 to the variable x?

double x=3.5
x=3.5;
3.5=x; (*)
x=7.0/2.0
 
2. What is the output of the following lines of code?
int j=7,k=5,m=8,result;
result=j/m*k;
System.out.println(result)
0 (*)
4.375
0.175
280
 
3. Consider the following:
You are writing a class and are using a global variable. Inside a method you declare a local
variable with the same name as the global variable.
This programming style is poor because inside the method the global variable will have
precedence over the local variable with the same name.
True or false?
True
False (*)
 
4. Which of the following statements displays 12345?
I. System.out.println( 123 * 100 + 45);
II. System.out.println(“123” + 45);
III. System.out.println( 12 + “345”);
All of the above. (*)
I only.
I and II only.
II and III only.
None of the above.
 
5. What is the output of the following lines of code?
int j=6,k=4,m=12,result;
result=j/m*k;
System.out.println(result);
48
2
0 (*)
24
 
6. Eclipse provides views to help you navigate a hierarchy of information. True or False?
True (*)
False
 
7. In the image below, identify the components.

A-Main Method, B-Class, C-Package


A-Class, B-MainMethod, C-Package
A-Package, B-Main Method, C-Class (*)
None of the above
8. In Eclipse, when you run a Java Application, where may the results display?
Editor Window
Console View (*)
Debug View
Task List
None of the above
 
9. The following defines a package keyword:
Defines where this class lives relative to other classes, and provides a level of access
control. (*)
Provides the compiler information that identifies outside classes used within the current
class.
Precedes the name of the class.
 
10. When importing another package into a class you must import the entire package as well
as the package classes that will be called. True or False?
True
False (*)
 
11. The following defines an import keyword:
Defines where this class lives relative to other classes, and provides a level of access
control.
Provides the compiler information that identifies outside classes used within the current
class. (*)
Precedes the name of the class.
 
12. Which of the following defines a driver class?
Contains a main method and other static methods. (*)
Contains classes that define objects.
Contains a main method, a package, static methods, and classes that define objects.
None of the above.
 
13. Consider the following code snippet. What is printed?
String ocean = new String(“Atlantic Ocean”);
System.out.println(ocean.indexOf(‘a’));
3 (*)
11
2
0
12
 
14. The String methods equals and compareTo perform the exact same function. True or
false?
True
False (*)
 
15. Suppose that s1 and s2 are two strings. Which of the statements or expressions are
valid?
(Choose all correct answers)
String s3 = s1 + s2; (*)
s1 <= s2
s1.compareTo(s2); (*)
String s3 = s1 – s2;
int m = s1.length(); (*)
 
16. In Eclipse, when you run a Java Application, the results may be displayed in the Console View.
True or False?
True (*)
False
 
17. What symbols are required for a compiler to ignore a comment?
/*/
/*
*/
// (*)
 
18. In a project, 2 of the classes must contain a main method. True or False?
True
False (*)
 
19. What are Java’s primitive types?
boolean, thread, stringbuffer, char, int, float, long and short
object, byte, string, char, float, int, long and short
boolean, byte, char, double, float, int, long, and short (*)
boolean, byte, string, thread, int, double, long and short
boolean, thread, char, double, float, int, long and short
 
20. Which of the following statements correctly assigns “3 times 10 to the 4th power” to the variable
number?
double number=3*10^4;
double number=3*10e4;
double number=3e4; (*)
double number=3(e4);
 
21. Given the following declaration:
int z=5,m=6;
Which line of Java code properly casts one type into another without data loss?
double x=(double)(z/m);
double x=z/m;
double x= double z/m;
double x=(double)z/m; (*)
 
22. Which of the following is the name of a Java primitive data type?
int (*)
String
Rectangle
Object
 
23. Given the following declaration, which line of Java code properly casts one type into
another without data loss?
int i=3,j=4; double y=2.54;
double x=(double)i/j; (*)
double x=(double)(i/j);
int x=(double)2.54;
double x=i/j;
double x= double i/j;
 
24. Which of the two diagrams below illustrate the general form of a Java program?

Example A
Example B (*)
 
25. The following defines a class keyword:
Provides the compiler information that identifies outside classes used within the current
class.
Defines where this class lives relative to other classes, and provides a level of access
control.
Precedes the name of the class. (*)
 
26. When importing another package into a class you must import only the package classes
that will be called and not the entire package. True or false?
True
False (*)
 
27. When importing another package into a class you must import only the package classes
that will be called and not the entire package. True or false?
True
False (*)
 
28.  Consider the following code snippet. What is printed?

An ArrayIndexOutofBoundsException is thrown.
87668 (*)
The code does not compile.
AtlanticPacificIndianArcticSouthern
55555
 
29.  The following code is an example of a correct initialization statement:
char c=”c”;
True
False (*)
 
30. What is printed by the following code segment?

albatross
a1
alligator (*)
albatross alligator
 
31. Four variables are required to support a conversion of one unit of measure to another
unit of measure. True or False?
True
False (*)
 
32. A workspace can have one or more stored projects. True or false?
True (*)
False
 
33. The following program prints “Not Equal”. True or false?
True
False (*)
 
34. Given the code
String s1 = “abcdef”;
String s2 = “abcdef”;
String s3 = new String(s1);
Which of the following would equate to false?
s1 = s2
s3.equals(s1)
s1 == s2
s3 == s1 (*)
s1.equals(s2)
 
35. Semi-colons at the end of each line are not required to compile successfully. True or
False?
True
False (*)
 
36. In a project, 1 of the classes must contain a main method. True or False?
True (*)
False
 
37. What will the method methodA print to the screen?

6
3
18 (*)
15
 
38. Which line of Java code assigns the value of 5 raised to the power of 8 to a?
int a=Math.pow(5,8);
int a=Math.pow(8,5);
double a=15^8;
double a=Math.pow(5,8); (*)
double a=pow(8,5);
 
39. A local variable has precedence over a global variable in a Java method. True or false?
True (*)
False
 
40. Write a declaration statement that will hold a number like 2.541.
float number; (*)
boolean number;
char number;
int number;
 
41. Which of the following creates a String named Char?
char string;
String Char; (*)
char Char;
char char;
String char;
 
42. Consider the following code snippet
String forest = new String(“Black”);
System.out.println(forest.length());
What is printed?
Forest
Black
5 (*)
6
7
 
43. You can return to the Eclipse Welcome Page by choosing Welcome from what menu?
Edit
Help (*)
File
Close
 
44. Tabs are used when more than one file is open in the edit area. True or False?
True (*)
False
 
45. Examine the following code:
6
2 (*)
14
2.5
 
46. Which of the following is not a legal name for a variable?
zero
2bad (*)
year2000
theLastValueButONe
 
47. Which of the following examples of Java code is not correct?
int x=6;
char c=’r’;
boolean b=1; (*)
double d=4.5;
 
48. What will the following code segment output?

“”\”
“”\<br> ” (*)
“””\<br> “”
“”\\”
“”\<br> “”
 
 
1.     What is a loop?     Mark for Review
(1) Points
A keyword used to skip over the remaining code.
A set of logic that is repeatedly executed until a certain condition is met. (*)
A segment of code that may only ever be executed once per call of the program.
None of the above.
[Incorrect]         Incorrect. Refer to Section 5 Lesson 2.
2.     For both the if-else construct and the for loop, it is true to say that when the condition
statement is met, the construct is exited. True or False?     Mark for Review
(1) Points
True
False (*)
[Correct]         Correct
3.     Which of the following correctly initializes a for loop that executes 5 times?     Mark for
Review
(1) Points
for(int i = 0; i < 5; I++)
for(int i = 1; i < 6; i++) (*)
for(int i = 1; i < 5; I++)
for(int i = 0; i == 6; i++)
[Correct]         Correct
4.     A counter used in a for loop cannot be initialized within the For loop statement. True or
False?     Mark for Review
(1) Points
True
False (*)
[Correct]         Correct
5.     When the for loop condition statement is met the construct is exited. True or false?   
Mark for Review
(1) Points
True
False (*)
[Correct]         Correct
6.     One advantage to using a while loop over a for loop is that a while loop always has a
counter. True or false?     Mark for Review
(1) Points
True
False (*)
[Correct]         Correct
7.     Which of the following are types of loops in Java?     Mark for Review
(1) Points
(Choose all correct answers)
while (*)
for (*)
do-while (*)
if/else
[Correct]         Correct
8.     How would you use the ternary operator to rewrite this if statement?
if (balance < 500)
fee = 10;
else
fee = 0;     Mark for Review
(1) Points
fee = ( balance < 500) ? 0 : 10;
fee = ( balance >= 5) ? 0 : 10;
fee= ( balance < 500) ? 10 : 0; (*)
fee = ( balance >= 500) ? 10 : 0;
fee = ( balance > 5) ? 10 : 0;
[Correct]         Correct
9.     switch statements work on all input types including, but not limited to, int, char, and
String. True or false?     Mark for Review
(1) Points
True
False (*)
[Correct]         Correct
10.     Determine whether this boolean expression evaluates to true or false:
!(3 < 4 && 5 > 6 || 6 <= 6 && 7 – 1 == 6)     Mark for Review
(1) Points
True
False (*)
[Correct]         Correct
11.     The six relational operators in Java are:     Mark for Review
(1) Points
>, <, =, !, <=, >=
>, <, ==, !=, <=, >= (*)
>, <, =, !=, =<, =>
>, <, =, !=, <=, >=
[Correct]         Correct
12.     How would you use the ternary operator to rewrite this if statement?
if (skillLevel > 5)
numberOfEnemies = 10;
else
numberOfEnemies = 5;     Mark for Review
(1) Points
numberOfEnemies = ( skillLevel < 5) ? 10 : 5;
numberOfEnemies = ( skillLevel > 5) ? 10 : 5; (*)
numberOfEnemies = ( skillLevel >= 5) ? 10 : 5;
numberOfEnemies = ( skillLevel > 5) ? 5 : 10;
numberOfEnemies = ( skillLevel >= 5) ? 5 : 10;
[Correct]         Correct
13.     The three logic operators in Java are:     Mark for Review
(1) Points
!=, =, ==
&&, ||, ! (*)
&&, !=, =
&, |, =
[Correct]         Correct
14.     In an if-else construct, the condition to be evaluated must be contained within
parentheses. True or False?     Mark for Review
(1) Points
True (*)
False
[Correct]         Correct
15.     Which of the following expressions will evaluate to true when x and y are boolean
variables with opposite values?
I. (x || y) && !(x && y)
II. (x && !y) || (!x && y)
III. (x || y) && (!x ||!y)     Mark for Review
(1) Points
I only
II only
I and III
II and III
I, II, and III (*)
[Correct]         Correct
1. In Alice, which procedure is used to assign one object as the vehicle of another? Mark for
Review
(1) Points
setObjectVehicle
Vehicle
setVehicle (*)
setClassVehicle
[Incorrect] Incorrect. Refer to Section 2 Lesson 6.
2. In Alice, Do In Order and Do Together: Mark for Review
(1) Points
Are move statements
Are control statements (*)
Are complex statements
None of the above
[Correct] Correct
3. Which button is selected in the Alice file menu to save a different version of an animation?
Mark for Review
(1) Points
New
File
Save As… (*)
Open
[Correct] Correct
4. Which Alice execution task corresponds with the following storyboard statement?
Cat rolls to the left. Mark for Review
(1) Points
Cat roll Left 1
roll Left 1
this.Cat roll Left 1.0 (*)
Cat roll Right 1
[Correct] Correct
5. A complete Alice instruction includes which of the following components? Mark for Review
(1) Points
(Choose all correct answers)
Amount (*)
Procedure (*)
Image
Class
Direction (*)
[Correct] Correct
6. The Alice move procedure contains which arguments? Mark for Review
(1) Points
(Choose all correct answers)
Direction (*)
Amount (*)
Object
Text
[Incorrect] Incorrect. Refer to Section 2 Lesson 3.
7. Which of the following is not a reason for why comments are helpful in an Alice program?
Mark for Review
(1) Points
Comments can outline the programming instructions.
Comments help during debugging and testing so the tester knows how the programming
statements are supposed to work.
Comments change the functionality of the program. (*)
Comments describe the intention of the programming instructions.
[Incorrect] Incorrect. Refer to Section 2 Lesson 3.
8. What is the first step to entering comments in an Alice program? Mark for Review
(1) Points
Drag and drop the comments tile above a code segment. (*)
Select the instance from the instance menu.
Drag and drop the comments tile below a code segment.
Type comments that describe the sequence of actions in the code segment.
[Incorrect] Incorrect. Refer to Section 2 Lesson 3.
9. Which of the following are ways to open an existing Alice project file after launching Alice?
Mark for Review
(1) Points
(Choose all correct answers)
Browse for the project using the File System tab. (*)
Select the project from the My Projects tab. (*)
Click and drag the file from your computer into Alice 3.
Double-click on the project file name in the folder it is stored in on your computer.
[Incorrect] Incorrect. Refer to Section 2 Lesson 2.
10. In Alice, where does an instance’s axes intersect? Mark for Review
(1) Points
At the instance’s feet.
At the instance’s head.
At the instance’s center point. (*)
At the world’s center point.
11. In Alice, where can you view the list of functions available for an object? Mark for Review
(1) Points
Functions tab in the methods panel. (*)
Properties tab in the methods panel.
Class description in the Scene editor.
Instance pull-down menu.
[Correct] Correct
12. In Alice, functions are dragged into the control statement, not the procedure. True or
false? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 2 Lesson 7.
13. From your Alice lessons, which of the following is a tool to show the logic of an
animation? Mark for Review
(1) Points
Pie chart
Flowchart (*)
Class chart
Visual storyboard
Scene editor
[Incorrect] Incorrect. Refer to Section 2 Lesson 5.
14. A textual storyboard helps the reader understand the actions that will take place during
the animation. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
15. In Alice, which of the following are benefits of separating out motions into their own
procedures? Mark for Review
(1) Points
(Choose all correct answers)
It can allow subclasses of a superclass to use a procedure. (*)
It makes the animation easier to run.
It simplifies code and makes it easier to read. (*)
It allows many objects of a class to use the same procedure. (*)
It makes the scene easier to view.
[Correct] Correct
1. What Alice tool can be used to diagram the If conditional execution statement?
Cause and effect diagram
Process flow diagram (*)
Conditional flow diagram
2. A conditional loop is a loop that will continue forever. True or false?
True False (*)
3. From your Alice lessons, the If control structure can process one true and one false
response. True or false
True (*)
4. From your Alice lessons, a textual storyboard provides a detailed, ordered list of the
actions each object performs in each scene of the animation. True or false?
True (*) False
5. Identify an example of an Alice expression.
“I feel happy.”
If or Where
3×3=9 (*)
None of the above
6. In Alice, Do In Order and Do Together:
Are move statements
Are control statements (*)
Are complex statements
None of the above
7. In Alice, the vehicle property will associate one object to another. True or false?
True (*) False
8. In Alice, functions are dragged into the control statement, not the procedure. True or
false?
True False (*)
9. Do In Order and Do Together are the only control statements available in Alice. True or
false?
True False (*)
10. In Alice, objects inherit the characteristics of their:
Code
Project
Class (*)
Program
11. In Alice, when a new procedure is declared, its motions are coded in a separate tab.
True or false?
True (*) False
12. In Alice, a person object inherits its procedures, functions, and properties from which of
the following classes? (Choose all correct answers)
Object subclass
Biped class (*)
Quadruped class
Person subclass (*)
13. From your Alice lessons, variables are fixed and cannot be changed. True or false?
True False (*)
14. Define the value of the variable LapCount based on the following math calculation:
LapCount + 10 = 15
2
4
5 (*)
15
10
15. A variable is a named location inside the computer’s memory; once there, the
information can be retrieved and changed. True or false?
True (*) False
16. Which of the following does not describe variables?
A place in memory where data of a specific type can be stored for later retrieval and use.
Has a unique name.
Has a type associated with it.
Arranged in rows and columns. (*)
17. A typical application uses various values and these values continuously change while the
program is running. True or false?
True (*) False
18. Which of the following is a procedure to precisely position an Alice object?
Move
Turn
Roll
MoveToward
All of the above (*)
19. All objects in Alice have three dimensional coordinates on which axes? (Choose all
correct answers)
x (*)
y (*)
z (*)
w
All of the above
20. From your Alice lessons, how do you add an instance to a scene in Alice?
Select the instance from your computer’s network.
Write code that places the instance in the scene.
Select the class, then drag the object into the scene. (*)
Call the addObject method.
21. Which of the following is not an example of the logic of an IF control structure?
Play the video three times. (*)
If the play button is pressed, then play the video one time.
If the doorbell rings, then the door opens.
If the bird rings the bell, a treat is dispensed.
22. Each parameter is listed with its name first, then its data type. True or false?
True False (*)
23. Which Alice execution task corresponds with the following storyboard statement?
Cat turns to face mouse.
this.mouse turnToFace this.cat
mouse turnTo cat
this.cat turnToFace this.mouse (*)
cat TurnTo mouse
24. In Alice, which of the following procedures make an object say something?
talk
speak
say (*)
audible
25. From your Alice lessons, random numbers are set in the distance and duration
arguments in a procedure. True or false?
True (*) False
26. In Greenfoot, what type of parameter does the keyDown method expect?
String (*)
Boolean
Integer
Method
27. From your Greenfoot lessons, the keyDown method is located in which class?
Actor
Greenfoot (*)
GreenfootImage
World
28. From your Greenfoot lessons, if the condition in an if-statement is true, the first code
segment is executed. True or false?
True (*) False
29. Use your Greenfoot knowldege: Abstraction occurs in many different ways in
programming. True or false?
True (*) False
30. From your Greenfoot lessons, abstraction techniques can only be used once in a class’s
source code. True or false?
True False (*)
31. In Greenfoot, you must first create an instance before you create a class. True or false?
True False (*)
32. From your Greenfoot lessons, an instance inherits all of the characteristics of the class,
and those characteristics
cannot be changed. True or false?
True False (*)
33. From your Greenfoot lessons, how do you call a defined method?
Call the method from the act method. (*)
Call the method from the defined method.
Write the method in the World superclass.
Write the method in the instance.
Write the method in the source code.
34. Use your Greenfoot knowledge to answer the question. One reason to write a defined
method in a class is to change the behavior
of the class. True or false?
True (*) False
35. From your Greenfoot lessons, to save space in the act method, you can write an entirely
new method below it, called a _____________.
Class method
Instance method
Defined method (*)
World method
Code method
36. In Greenfoot, which of the following statements could prevent an infinite loop from
occurring?
I = 100 + i
i=1
i=i
i = i + 1 (*)
37. In Greenfoot, which statement is a correct example of string concatenation?
Duke duke = new Duke(keyNames[i], soundNames[i]);
Duke duke = (keyNames[i], soundNames[i] + “.wav”);
Duke duke = new Duke(keyNames[i], soundNames[i] + “.wav”); (*)
Duke duke = (soundNames[i] + “.wav”);
38. From your Greenfoot lessons, which of the following logic operators represents “and”?
&
&& (*)
=
!
39. We can use the Actor constructor to automatically create Actor instances when the
Greenfoot world is initialized. True or false?
True False (*)
40. Use your Greenfoot knowledge to answer the question: Where are defined variables
typically entered in a class’s source code?
In the defined method in the source code.
Between the constructors and methods in the source code.
After the constructors and methods in the source code.
At the top of the source code, before the constructors and methods. (*)
41. Using the Greenfoot IDE, when is a constructor automatically executed?
When source code is written.
When a new image is added to the class.
When a new instance of the class is created. (*)
When the act method is executed.
42. From your Greenfoot lessons, which axes define an object’s position in a world?
(Choose all correct answers)
x (*)
z
y (*)
w
43. When a Greenfoot code segment is executed in an if-statement, each line of code is
executed in sequential order. True or false?
True (*) False
44. From your Greenfoot lessons, which of the following comparison operators represents
“greater than”?
> (*)
<
==
!=
45. In Greenfoot, you will not receive an error message if your code is incorrect. It will simply
not work, and you will have to determine why the code doesn’t work. True or false?
True False (*)
46. In the Greenfoot IDE, which of the following is not a property of an instance?
Position
Inherited methods
Scenario name (*)
Defined methods
47. What does the following Greenfoot programming statement do?
turn(18);
Turn the object 36 degrees.
Turn the object 18 degrees. (*)
Turn the object 18 steps forward.
Move the object 18 steps forward.
48. In the Greenfoot IDE, which of the following are components of a parameter?
(Choose all correct answers)
Parameter type (*)
Parameter return
Parameter name (*)
Parameter method
Parameter void
49. From your Greenfoot lessons, what is incorrect in this code example:
setLocation(getX(), (int) (altitude);
Spacing
Capitalization
Parenthesis (*)
Comma
50. In Greenfoot, in which programming task are the objects identified?
Define the problem.
Design the solution.
Program the solution. (*)
Test the solution.
MIDTERM
1. Examine the following code. What are the variables?
� args
� n (*)
� i (*)
�t
2. In Java, which symbol is used to assign one value to another?
�<
�>
� = (*)
� //
3. Alice uses built-in math operators; they are:
� Add and subtract
� Multiply and divide
� All of the above (*)
� None of the above
4. In Alice, functions are dragged into the control statement, not the procedure. True or
false?
True False (*)
5. From your Alice lessons, where should comments be placed?
� Above each set of programming statements. (*)
� At the end of the program.
� In the scene editor.
� In their own procedure.
6. An Alice object can move in four directions. True or false?
True False (*)
7. From your Alice lessons, comments do not affect the functionality or behavior of objects.
True or false?
True (*) False
8. In Alice, inheritance means that the superclass inherits its traits from the subclass. True or
false?
True False (*)
9. In Alice, declaring a new procedure to shorten code and make it easier to read is a
procedural abstraction technique. True or false
True (*) False
10. In Alice, a person object inherits its procedures, functions, and properties from which of
the following classes
� Object subclass
� Biped class (*)
� Quadruped class
� Person subclass (*)
11. A scenario gives the Alice animation a purpose. True or false
True (*) False
12. From your Alice lessons, random numbers are set in the distance and duration
arguments in a procedure. True or false
True (*) False
13. In Alice, which of the following instructions turn the Blue Tang fish right one half of a
meter?
� this.blueTang turn Right 5
� this.blueTang turn Right 0.5 (*)
� blueTang turn Right 5
� blueTang turn Right 0.5
14. The move procedure moves an object in how many different possible directions
�1
�4
�3
� 6 (*)
15. A loop can be infinite (continue forever) or conditional (stops upon a condition). True or
false?
True (*) False
16. In Alice, we use the While control statement to implement the conditional loop. True or
false?
True (*) False
17. A conditional loop is a loop that will continue forever. True or false?
True False (*)
18. The value that a variable holds must be a whole number, not a decimal. True or false?
True False (*)
19. From your Alice lessons, what can be used as a guideline to ensure your animation
fulfills animation principles
� The Internet
� Animation checklist (*)
� A close friend
� None of the above
20. An Alice event is considered what?
� A party with at least 20 people
� An object’s orientation
� Error handling
� A keystroke or mouse click (*)
21. Besides invoking a procedure, another way to precisely position an Alice object is to
enter values in the x, y, and z coordinates in the Position property. True or false
True (*) False
22. From your Alice lessons, what is a one-shot procedural method?
� A procedure that is invoked when the Run button is clicked.
� A procedure that is used to make a scene adjustment. (*)
� A procedure that is dragged into the code editor.
� A procedure that is used to launch the program.
23. From your Alice lessons, how do you add an instance to a scene in Alice?
� Select the instance from your computer’s network.
� Write code that places the instance in the scene.
� Select the class, then drag the object into the scene. (*)
� Call the addObject method.
24. When you want specific code to be executed only if certain conditions are met, what type
of Java construct would you use
� while loop
� if (*)
� array
� boolean
25. What do lines 7, 10 and 13 do in the following code?
� Export files called A, B, and num3.
� Create a single file containing A, B, and the value of num3.
� Print “A”, “B” and the value of num3 on the screen. (*)
� None of the above.
26. From your Greenfoot lessons, abstraction techniques can only be used once in a class’s
source code. True or false?
True False (*)
27. From your Greenfoot lessons, which of the following are examples of abstraction?
� Playing a range of sounds when keyboard keys are pressed. (*)
� A single instance displays a single image.
� Assigning a different keyboard key to each instance. (*)
� Programming a single movement for a single instance.
� Assigning a different image file to each instance. (*)
28. In Greenfoot, a constructor has a void return type. True or false
True False (*)
29. From your Greenfoot lessons, what is the parameter of the following constructor that
creates a new image, and designates it to the Actor class?
setImage (new GreenfootImage(“duke100.png
� setImage
� GreenfootImage
� duke100.png (*)
� new
30. Use your Greenfoot knowledge to answer the question: Where are defined variables
typically entered in a class’s source code
� In the defined method in the source code.
� Between the constructors and methods in the source code.
� After the constructors and methods in the source code.
� At the top of the source code, before the constructors and methods. (*)
31. In Greenfoot, a variable can be saved and accessed later, even if the instance no longer
exists. True or false ?
True False (*)
32. From your Greenfoot lessons, when a method needs additional data to perform a task,
this data comes from parameters. True or false?
True (*) False
33. In the Greenfoot IDE, which type of variable allows instances to store information
� Method variable
� Instance variable (*)
� Class variable
� World variable
34. From your Greenfoot lessons, how do you call a defined method?
� Call the method from the act method. (*)
� Call the method from the defined method.
� Write the method in the World superclass.
� Write the method in the instance.
� Write the method in the source code.
35. To execute a method in your Greenfoot game, where is it called from?
� The world
� The act method (*)
� The actor class
� The gallery
36. From your Greenfoot lessons, to save space in the act method, you can write an entirely
new method below it, called a _____________.
� Class method
� Instance method
� Defined method (*)
� World method
� Code method
37. Which method is used to play sound in your Greenfoot game
� getSound method
� findSound method
� playSound method (*)
� importSound method
38. In Greenfoot, which method checks if a key on the keyboard has been pressed
� keyPress method
� keyUp method
� keyDown method (*)
� keyClick method
39. In the Greenfoot IDE, what symbols indicate that the variable is an array?
� Square brackets [ ] (*)
� Curly brackets { }
� Semicolon ;
� Colon :
40. In Greenfoot, which of the following statements could prevent an infinite loop from
occurring?
� I = 100 + i
� i=1
�i=i
� i = i + 1 (*)
41. In Greenfoot, what happens if the end to a while loop isn’t established?
� The code will keep executing and will never stop. (*)
� The code will execute once and then stop, due to controls in Greenfoot.
� The code will prompt you to enter a loop counter.
� The code will not execute.
42. In Greenfoot, in which programming task are the objects identified
� Define the problem.
� Design the solution.
� Program the solution. (*)
� Test the solution.
43. Use your Greenfoot skills to answer the question. What is incorrect in this code?
� Spacing missing
� Curly brace missing
� Parenthesis missing (*)
� Comma missing
44. From your Greenfoot lessons, a problem statement defines the purpose for your game.
True or false
True (*) False
45. From your Greenfoot lessons, where do you review a class’s inherited methods
� Act method
� Documentation (*)
� Inspector
� If-statement
46. From your Greenfoot lessons, the reset button resets the scenario back to its initial
position. True or false?
True (*) False
47. Which of the following Java syntax is used to correctly create a Duke subclass
� private Dog extends World
� public class Dog extends World
� public class Duke extends Animal (*)
� private class extends Actor
� private class extends Duke
48. When a Greenfoot code segment is executed in an if-statement, each line of code is
executed in sequential order. True or false? True (*) False
49. In a Greenfoot if-else statement, if the condition is true, the if-statement is executed, and
then the else-statement is executed. True or false
True False (*)
50. Read the following method signature. Using your Greenfoot experience, what does this
method do?
public static int getRandomNumber (int limit)
� Returns a random number less than 10.
� Returns a random coordinate position in the world.
� Returns a random number between zero and parameter limit. (*)
� Returns a random number for instances in the animal class only.
Review your answers, feedback, and question scores below. An asterisk (*) indicates a
correct answer.
Section 2
(Answer all questions in this section)
1. In Alice, when two objects are synchronized and move together, this means that one
object is: Mark for Review
(1) Points
A vehicle of another (*)
A class of another
An object of another
An instance of another
Incorrect. Refer to Section 2 Lesson 6.
2. In Alice, which procedure is used to assign one object as the vehicle of another? Mark for
Review
(1) Points
setObjectVehicle
Vehicle
setClassVehicle
setVehicle (*)
Incorrect. Refer to Section 2 Lesson 6.
3. In Alice, a walking motion for a bipedal object can be achieved without the Do Together
control statement. True or false? Mark for Review
(1) Points
True
False (*)
Incorrect. Refer to Section 2 Lesson 6.
4. A variable is a named location inside the computer’s memory; once there, the information
can be retrieved and changed. True or false? Mark for Review
(1) Points
True (*)
False
Correct
5. Define the value of the variable LapCount based on the following math calculation:
LapCount + 10 = 15 Mark for Review
(1) Points
5 (*)
4
15
10
2
Correct
Section 2
(Answer all questions in this section)
6. In Alice, procedural abstraction is the concept of making code easier to understand and
reuse. True or false? Mark for Review
(1) Points
True (*)
False
Correct
7. In Alice, when a new procedure is declared, all subclasses of the superclass will inherit
the procedure. True or false? Mark for Review
(1) Points
True (*)
False
Incorrect. Refer to Section 2 Lesson 5.
8. What does a visual storyboard help the reader understand? Mark for Review
(1) Points
(Choose all correct answers)
The components of the scene. (*)
The code that is debugged.
How the initial scene will be set up. (*)
The actions that will take place. (*)
Incorrect. Refer to Section 2 Lesson 5.
9. An event is any action initiated by the user that is designed to influence the program メ s
execution during play. Mark for Review
(1) Points
True (*)
False
Correct
10. You want an event to happen when an object collides with another object, which
category of event handler would you choose? Mark for Review
(1) Points
Position/Orientation (*)
Mouse
Scene Activation/time
Keyboard
Correct
Section 2
(Answer all questions in this section)
11. Which of the following elements of the Alice animation should be tested before the
animation is considered complete? Mark for Review
(1) Points
Math calculations operate as expected.
Objects move with smooth timing.
Comments are added to each sequence of instructions.
Control statements are operating as expected.
All of the above. (*)
Incorrect. Refer to Section 2 Lesson 12.
12. In Alice, as part of the recording process you can demonstrate the events that are
programmed within your animation. True or false? Mark for Review
(1) Points
True (*)
False
Incorrect. Refer to Section 2 Lesson 12.
13. Functions answer questions about an object, such as its height, width, depth and even
distance to another object. True or false? Mark for Review
(1) Points
True (*)
False
Correct
14. What do moving objects provide to your scene? Mark for Review
(1) Points
The procedures
The non-moving scenery
The sky and ground
The action (*)
Correct
15. If you need to repeat a group of Java statements many times, which Java construct
should you use? Mark for Review
(1) Points
(Choose all correct answers)
if
while loop (*)
repeat…until
do while loop (*)
Incorrect. Refer to Section 2 Lesson 14.
Section 2
(Answer all questions in this section)
16. If you need to repeat a group of Java statements many times, which Java construct
should you use? Mark for Review
(1) Points
(Choose all correct answers)
while loop (*)
repeat…until
if
do while loop (*)
Correct
17. In Alice, where are arithmetic operators available? Mark for Review
(1) Points
(Choose all correct answers)
If control
Amount argument (*)
Size argument
Get Distance functions (*)
Duration argument (*)
Incorrect. Refer to Section 2 Lesson 13.
18. Which of the following is not a valid primitive type in Java? Mark for Review
(1) Points
double
String (*)
boolean
int
long
Incorrect. Refer to Section 2 Lesson 13.
19. A loop can be infinite (continue forever) or conditional (stops upon a condition). True or
false? Mark for Review
(1) Points
True (*)
False
Correct
20. In Alice, where does an instance’s axes intersect? Mark for Review
(1) Points
At the instance’s head.
At the instance’s feet.
At the instance’s center point. (*)
At the world’s center point.
Incorrect. Refer to Section 2 Lesson 2.
Section 2
(Answer all questions in this section)
21. In Alice, which of the following programming statements moves the butterfly forward,
double the distance to the tree? Mark for Review
(1) Points
this.Butterfly move forward {this.Butterfly getDistanceTo this.Tree / 2}
this.Butterfly move forward {this.Butterfly getDistanceTo this.Tree * 2} (*)
this.Butterfly move backward {this.Butterfly getDistanceTo this.Tree * 2}
this.Butterfly move backward {this.Butterfly getDistanceTo this.Tree / 2}
Correct
22. In Alice, which of the following programming statements moves the cat forward the
distance to the bird? Mark for Review
(1) Points
this.Cat move forward {this.Bird getDistanceTo this.Cat / 2}
this.Bird move forward {this.Bird getDistanceTo this.Cat}
this.Cat move {this.Bird getDistanceTo this.Cat / 2}
this.Cat move forward {this.Cat getDistanceTo this.Bird} (*)
Incorrect. Refer to Section 2 Lesson 9.
23. In Alice, the computer specifies the low and high range values for the range of numbers
from which to pull a randomized number. True or false? Mark for Review
(1) Points
True
False (*)
Incorrect. Refer to Section 2 Lesson 4.
24. When you disable a programming instruction, it is still executed when you run the Alice
animation. True or false? Mark for Review
(1) Points
True
False (*)
Incorrect. Refer to Section 2 Lesson 3.
Section 3
(Answer all questions in this section)
25. Use you Greenfoot knowledge: What range of numbers does the following method
return?
Greenfoot.getRandomNumber(30) Mark for Review
(1) Points
A random number between 1 and 29.
A random number between 1 and 30.
A random number between 0 and 30.
A random number between 0 and 29. (*)
Incorrect. Refer to Section 3 Lesson 5.
Section 3
(Answer all questions in this section)
26. From your Greenfoot lessons, which axes define an object’s position in a world? Mark for
Review
(1) Points
(Choose all correct answers)
z
y (*)
w
x (*)
Incorrect. Refer to Section 3 Lesson 5.
27. The first step to executing an if-else statement is to:____________. Mark for Review
(1) Points
Evaluate the condition (*)
Execute the if statement
Evaluate the class
Execute the else statement
Correct
28. The Greenfoot method getRandomNumber is used to create predictable behaviour in
your scenario Mark for Review
(1) Points
True
False (*)
Incorrect. Refer to Section 3 Lesson 5.
29. From your Greenfoot lessons, to save space in the act method, you can write an entirely
new method below it, called a _____________. Mark for Review
(1) Points
Instance method
Class method
Code method
Defined method (*)
World method
Incorrect. Refer to Section 3 Lesson 6.
30. Which one of the following can be used to detect when 2 actors collide? Mark for Review
(1) Points
isContact()
isTouching() (*)
isCollision()
hasCollided()
Incorrect. Refer to Section 3 Lesson 6.
Section 3
(Answer all questions in this section)
31. In Greenfoot, a constructor has a void return type. True or false? Mark for Review
(1) Points
True
False (*)
Incorrect. Refer to Section 3 Lesson 8.
32. When you re-initialize a scenario, Greenfoot automatically displays an instance of the
World subclass in the scenario. True or false? Mark for Review
(1) Points
True (*)
False
Incorrect. Refer to Section 3 Lesson 8.
33. Which of the following answers have the correct syntax for declaring a class variable in
Greenfoot? Mark for Review
(1) Points
(Choose all correct answers)
private variable-name, variable-type;
private variable-type variable-name; (*)
public variable-name variable type;
public variable-type variable-name; (*)
Incorrect. Refer to Section 3 Lesson 8.
34. An instance variable can be saved and accessed later, even if the instance no longer
exists. True or false? Mark for Review
(1) Points
True
False (*)
Correct
35. In Greenfoot, the move method expects what type of information in its parameters? Mark
for Review
(1) Points
True or false response
String statement
Degrees to turn
Integer of steps to move forward (*)
Incorrect. Refer to Section 3 Lesson 2.
Section 3
(Answer all questions in this section)
36. Using the Greenfoot IDE, only five instances can be added to a scenario. True or false?
Mark for Review
(1) Points
True
False (*)
Correct
37. A variable is also known as a ____________. Mark for Review
(1) Points
Class
Method
Syntax
Field (*)
Instance
Incorrect. Refer to Section 3 Lesson 2.
38. Which of the following Java syntax is used to correctly create a Bee subclass? Mark for
Review
(1) Points
public class Bee extends Animal (*)
private class extends Bee
public class Bee extends World
private class extends Actor
private Bee extends World
Incorrect. Refer to Section 3 Lesson 1.
39. Which of the following demonstrates a Greenfoot subclass/superclass relationship? Mark
for Review
(1) Points
A computer is a subclass of a video game superclass.
A dog is a subclass of the cat superclass.
A single person is a superclass of the human subclass.
A rose is a subclass of the flower superclass. (*)
Incorrect. Refer to Section 3 Lesson 1.
40. In Greenfoot, you will never have to cast as we only ever use 2 classes – World and
Actor. Mark for Review
(1) Points
True
False (*)
Correct
Section 3
(Answer all questions in this section)
41. From your Greenfoot lessons, which of the following logic operators represents “and”?
Mark for Review
(1) Points
=
&
!
&& (*)
Correct
42. From your Greenfoot lessons, when do infinite loops occur? Mark for Review
(1) Points
Only in while loops.
When the loop is executed.
When the end to the code isn’t established. (*)
When the end to the act method isn’t established.
Incorrect. Refer to Section 3 Lesson 10.
43. An array is an object that holds multiple methods. True or false? Mark for Review
(1) Points
True
False (*)
Incorrect. Refer to Section 3 Lesson 10.
44. In Greenfoot, which statement is a correct example of string concatenation? Mark for
Review
(1) Points
bee.setImage(“bee” + i + “.png”); (*)
Bee bee = new Bee(image1);
bee.setImage(“bee” – “I” – “.png”);
bee.setImage(“bee.png”);
Correct
45. In Greenfoot, you can only interact with the scenario using a keyboard. Mark for Review
(1) Points
True
False (*)
Correct
Section 3
(Answer all questions in this section)
46. In Greenfoot to get the users name you could use: Mark for Review
(1) Points
Greenfoot.ask(“Input Name: “); (*)
Actor.prompt(“Input Name: “);
Greenfoot.getUserName();
Greenfoot.prompt(“Input Name: “);
Incorrect. Refer to Section 3 Lesson 7.
47. In Greenfoot, which of the following methods display an object’s orientation? Mark for
Review
(1) Points
(Choose all correct answers)
void turn()
int getRotation() (*)
void move()
int getX() (*)
Incorrect. Refer to Section 3 Lesson 3.
48. From your Greenfoot lessons, which of the following methods return the current rotation
of the object? Mark for Review
(1) Points
int getRotation() (*)
World getWorld()
World getClass()
getXY()
Correct
49. Which of the following features of Greenfoot will locate syntax errors in your program?
Mark for Review
(1) Points
Instance creation
Documentation
Compilation (*)
Code editor
Correct
50. Which of the following type of audience should you ask to play your Greenfoot game
during the testing phase? Mark for Review
(1) Points
Testing
Primary
Target (*)
Programmer
Incorrect. Refer to Section 3 Lesson 4.
1. Which option copies a programming instruction to the clipboard? Mark for Review
(1) Points
Clipboard
Copy to Clipboard (*)
Is Enabled
Paste
[Incorrect] Incorrect. Refer to Section 2 Lesson 1.
2. From your Alice lessons, a flowchart could be created in a software program, or
documented in a journal. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
3. In Alice, you could identify when new procedures need to be declared by reviewing the
textual storyboard for the animation. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
4. In Alice, objects inherit the characteristics of their: Mark for Review
(1) Points
Project
Program
Code
Class (*)
[Correct] Correct
5. Which Alice control statement executes a set of procedures simultaneously? Mark for
Review
(1) Points
Together
While
Do together (*)
Do in order
[Correct] Correct
6. In Alice, which of the following arguments could be replaced with a random number? Mark
for Review
(1) Points
(Choose all correct answers)
Direction
Duration (*)
Object name
Procedure name
Distance (*)
[Incorrect] Incorrect. Refer to Section 2 Lesson 4.
7. In Alice, which of the following is not a control statement? Mark for Review
(1) Points
Move (*)
While
Do In Order
Count
[Incorrect] Incorrect. Refer to Section 2 Lesson 6.
8. In Alice, a computer program requires functions to tell it how to perform the procedure.
True or false? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 2 Lesson 6.
9. Which of the following is not a reason for why comments are helpful in an Alice program?
Mark for Review
(1) Points
Comments can outline the programming instructions.
Comments describe the intention of the programming instructions.
Comments change the functionality of the program. (*)
Comments help during debugging and testing so the tester knows how the programming
statements are supposed to work.
[Incorrect] Incorrect. Refer to Section 2 Lesson 3.
10. It is important to save often while debugging your program. True or false? Mark for
Review
(1) Points
True (*)
False
11. In an Alice program, which code is executed when the Run button is clicked? Mark for
Review
(1) Points
The code entered in myMethod in the Code editor.
The code entered in the class’s procedure in the procedures tab.
The code entered in myFirstMethod in the Code editor. (*)
The one-shot procedures selected in the Scene editor.
[Incorrect] Incorrect. Refer to Section 2 Lesson 3.
12. From your Alice lessons, built-in functions provide precise property details for the
following areas: Mark for Review
(1) Points
Distance to and nesting.
Proximity and point of view.
Proximity, size, spatial relation, and point of view. (*)
Proximity and size.
[Incorrect] Incorrect. Refer to Section 2 Lesson 7.
13. In Alice, where can you view the list of functions available for an object? Mark for Review
(1) Points
Functions tab in the methods panel. (*)
Instance pull-down menu.
Properties tab in the methods panel.
Class description in the Scene editor.
[Incorrect] Incorrect. Refer to Section 2 Lesson 7.
14. Which of the following is not an example of a one-shot procedure? Mark for Review
(1) Points
Roll
Turn
Move
Spin (*)
[Incorrect] Incorrect. Refer to Section 2 Lesson 2.
15. In Alice, what does the resize handle style do? Mark for Review
(1) Points
Change size of the object and stretch it along the x, y, and z axes (*)
Simple rotation and movement
Move along the x, y, and z axes
Rotate about the x, y, and z axes
[Incorrect] Incorrect. Refer to Section 2 Lesson 2.
1. Identify an example of an Alice expression. Mark for Review
(1) Points
“Hello World.”
IF or WHILE
12 + 15 = 27 (*)
None of the above
Correct
2. In Alice, which of the following programming statements moves the butterfly forward,
double the distance to the tree? Mark for Review
(1) Points
this.Butterfly move backward {this.Butterfly getDistanceTo this.Tree * 2}
this.Butterfly move forward {this.Butterfly getDistanceTo this.Tree * 2} (*)
this.Butterfly move backward {this.Butterfly getDistanceTo this.Tree / 2}
this.Butterfly move forward {this.Butterfly getDistanceTo this.Tree / 2}
Correct
3. In Java, which symbol is used to assign one value to another? Mark for Review
(1) Points
= (*)
//
<
>
Correct
4. The list below displays valid primitive types in Java, except which one? Mark for Review
(1) Points
double
long
boolean
String (*)
int
Correct
5. Consider the following: You want to use the BufferedReader and InputStreamReader
classes to get user input from the command line. Which one of the following import
statements must you use? Mark for Review
(1) Points
import java.io.*; (*)
import java.buffer.*;
import java.awt.*;
import java.io.input.*;
Correct
6. Review the code below.
Select the result from the following statements about what happens when the loopVal >= 5 .
Mark for Review
(1) Points
The message “Printing Some Text” will be printed until loopVal is no longer less than 5.
The variable loopVal is initialized to 0.
The condition loopVal < 5 is tested before executing anything further in the program. (*)
The condition loopVal < 5 returns a boolean value.
None of the above.
Correct
7. Which of the following is not an example of a one-shot procedure? Mark for Review
(1) Points
Roll
Turn
Move
Spin (*)
Correct
8. In Alice, functions are dragged into the control statement, not the procedure. True or
false? Mark for Review
(1) Points
True
False (*)
Correct
9. Which option copies a programming instruction to the clipboard? Mark for Review
(1) Points
Is Enabled
Paste
Clipboard
Copy to Clipboard (*)
Correct
10. In Alice, control statements are dragged into the Code editor. True or false? Mark for
Review
(1) Points
True (*)
False
Correct
11. It is important to save often while debugging your program. True or false? Mark for
Review
(1) Points
True (*)
False
Correct
12. When you import a class from another file you have to import the entire class. True or
false? Mark for Review
(1) Points
True
False (*)
Correct
13. Alice provides pre-populated worlds through which new menu tab? Mark for Review
(1) Points
Starters (*)
Blank Slates
File System
Recent
Correct
14. From your Alice lessons, if you examined a science process that had many steps, which
of the following is a way that you could apply functional decomposition to this process? Mark
for Review
(1) Points
1. Present the problem as an animation.
2. Further refine and define the tasks needed for each high level step.
3. Identify the high level steps for the science concept.
Present the problem as an animation.
1. Identify the detailed steps for the science concept.
2. Present the problem as an animation.
1. Identify the high level steps for the science concept.
2. Further refine and define the tasks needed for each high level step.
3. Present the problem as an animation. (*)
Correct
15. When presenting your Alice animation, it is not important to give the audience a reason
to listen to the presentation. True or false? Mark for Review
(1) Points
True
False (*)
Correct
16. In Alice, the setVehicle procedure will associate one object to another. True or false?
Mark for Review
(1) Points
True (*)
False
Correct
17. In Alice, when two objects are synchronized and move together, this means that one
object is: Mark for Review
(1) Points
An instance of another
An object of another
A class of another
A vehicle of another (*)
Correct
18. In Alice, a computer program requires functions to tell it how to perform the procedure.
True or false? Mark for Review
(1) Points
True
False (*)
Correct
19. From your Alice lessons, a flowchart could be created in a software program, or
documented in a journal. True or false? Mark for Review
(1) Points
True (*)
False
Correct
20. In Alice, you examine code where a bird moves its wings forward and backward while
moving forward simultaneously across the scene. You notice that this set of procedures are
repeated in the Code editor ten times to achieve this motion. How could procedural
abstraction be used to make the code simpler and easier to read? Mark for Review
(1) Points
(Choose all correct answers)
Do not make any changes to the code.
Use the Scene editor to position the wings so that they are up as the body moves forward.
Declare a separate “fly” procedure for the body moving forward and wings moving up and
down. (*)
Use the Count control statement to execute the forward motion of the body and up and down
motion of the wings 10 times. (*)
Incorrect. Refer to Section 2 Lesson 5.
21. Which Alice tool is used to demonstrate the process flow of an animation? Mark for
Review
(1) Points
World
Flowchart (*)
Pie chart
Visual storyboard
Textual storyboard
Correct
22. A variable is a place in memory where data of a specific type can be stored for later
retrieval and use by your program Mark for Review
(1) Points
True (*)
False
Correct
23. When viewing the Java Code on the side in Alice, you can change the Java code directly
instead of the Alice code. True or false? Mark for Review
(1) Points
True
False (*)
Incorrect. Refer to Section 2 Lesson 10.
24. The Alice IF control structure requires the false statement to be populated. True or false?
Mark for Review
(1) Points
True
False (*)
Correct
Section 3
(Answer all questions in this section)
25. In Greenfoot, methods can be called in the act method. When the Act button is clicked in
the environment, the methods in the method body of the act method are executed. True or
false? Mark for Review
(1) Points
True (*)
False
Correct
26. A variable is also known as a ____________. Mark for Review
(1) Points
Field (*)
Syntax
Class
Method
Instance
Incorrect. Refer to Section 3 Lesson 2.
27. In Greenfoot, the move method expects what type of information in its parameters? Mark
for Review
(1) Points
String statement
Degrees to turn
True or false response
Integer of steps to move forward (*)
Correct
28. In Greenfoot, which of the following options are not possible when associating an image
file with an instance? Mark for Review
(1) Points
Select an image from the Greenfoot library
Add a video (*)
Import an image
Draw an image
Correct
29. In Greenfoot, what type of symbol is used to connect boolean expressions? Mark for
Review
(1) Points
Integers
String concatenation
Keyboard key names
Logic operators (*)
Incorrect. Refer to Section 3 Lesson 10.
30. From your Greenfoot lessons, when do infinite loops occur? Mark for Review
(1) Points
When the end to the code isn’t established. (*)
Only in while loops.
When the end to the act method isn’t established.
When the loop is executed.
Incorrect. Refer to Section 3 Lesson 10.
31. Which of the following is an example of string concatenation? Mark for Review
(1) Points
Instead of entering “.png” after each image file name, add = “.png” after the imageName
value in the programming statement.
Instead of entering “.png” after each image file name, add + “.png” after the imageName
value in the programming statement. (*)
Instead of entering “.png” after each image file name, add && “.png” after the imageName
value in the programming statement.
Instead of entering “.png” after each image file name, add “.png” after the imageName value
in the programming statement.
Correct
32. In the following Greenfoot array, what statement would you write to access the “a” key?
Keynames = {“a”, “b”, “c”, “d”}; Mark for Review
(1) Points
keynames[0] (*)
keynames[“a” key]
keynames[“a”]
keynames[2]
Correct
33. From your Greenfoot lessons, Which of the following statements is most correct? Mark
for Review
(1) Points
My program is complete when it compiles.
My program is complete when I add images to it.
My program is complete when I add music to it.
My program is complete when it runs and I’ve tested the code. (*)
Correct
34. In Greenfoot, you will not receive an error message if your code is incorrect. It will simply
not work, and you will have to determine why the code doesn’t work. True or false? Mark for
Review
(1) Points
True
False (*)
Correct
35. From your Greenfoot lessons, the isKeyDown method is located in which class? Mark for
Review
(1) Points
Actor
Greenfoot (*)
World
GreenfootImage
Correct
36. In Greenfoot you can interact with the scenario using a mouse. Mark for Review
(1) Points
True (*)
False
Correct
37. Use your Greenfoot knowldege: Abstraction occurs in many different ways in
programming. True or false? Mark for Review
(1) Points
True (*)
False
Correct
38. A subclass has what kind of relationship to a superclass? Mark for Review
(1) Points
“for-what”
“a-is”
“is-by”
“is-a” (*)
Correct
39. In Greenfoot, a subclass is created by right-clicking on a superclass. True or false? Mark
for Review
(1) Points
True (*)
False
Correct
40. From your Greenfoot lessons, which programming statement creates a new Bee object,
and places it at x = 120, y = 100 in the world? Mark for Review
(1) Points
Move(120,100);
addWorld (new Bee( ), 120, 100);
addObject (new Bee( ), 120, 100); (*)
addClass (new Bee( ), 120, 100);
Correct
41. In Greenfoot, which of the following is the correct notation for calling a method for an
instance of a class? Mark for Review
(1) Points
class-name.method-name(parameters);
Method-name.object-name(parameters);
Method-name.object-name;
object-name.method-name(parameters); (*)
Correct
42. Which of the following comparison operators represents “greater than or equal”? Mark
for Review
(1) Points
>= (*)
>
==
!=
Correct
43. From your Greenfoot lessons, what can methods belong to? Mark for Review
(1) Points
(Choose all correct answers)
Galleries
Classes (*)
Scenarios
Objects (*)
All of the above
Correct
44. From your Greenfoot lessons, if the condition in an if-statement is true, the first code
segment is executed. True or false? Mark for Review
(1) Points
True (*)
False
Correct
45. From your Greenfoot lessons, what are the ways that you can view a class’s methods?
Mark for Review
(1) Points
(Choose all correct answers)
In the scenario
By right-clicking on an instance (*)
In the class’s documentation (*)
In the Greenfoot gallery
Correct
46. A collision in Greenfoot is when two actors make contact? Mark for Review
(1) Points
True (*)
False
Correct
47. Which actor method is used to detect a simple collision? Mark for Review
(1) Points
isCollision()
hasCollided()
hasTouched()
isInContactWith()
isTouching() (*)
Correct
48. In Greenfoot, an if-statement is used to alternate between displaying two images in an
instance. True or false? Mark for Review
(1) Points
True (*)
False
Incorrect. Refer to Section 3 Lesson 8.
49. In Greenfoot, a constructor has a void return type. True or false? Mark for Review
(1) Points
True
False (*)
Correct
50. In Greenfoot the showText() method belongs to which class? Mark for Review
(1) Points
World (*)
Actor
There is no such method.
Greenfoot
Correct
Section 2
1. Which of the following is not a step in the Alice animation development process? Mark for
Review
(1) Points
Sell the animation (*)
Define the scenario
Run the animation
Design a storyboard
Program the animation
Correct
2. In Alice, which of the following programming statements moves the butterfly forward,
double the distance to the tree? Mark for Review
(1) Points
this.Butterfly move forward {this.Butterfly getDistanceTo this.Tree * 2} (*)
this.Butterfly move backward {this.Butterfly getDistanceTo this.Tree * 2}
this.Butterfly move backward {this.Butterfly getDistanceTo this.Tree / 2}
this.Butterfly move forward {this.Butterfly getDistanceTo this.Tree / 2}
Correct
3. From your Alice lessons, the If control structure can process one true and one false
response. True or false? Mark for Review
(1) Points
True (*)
False
Correct
4. In Alice, we use the While control statement to implement the conditional loop. True or
false? Mark for Review
(1) Points
True (*)
False
Correct
5. A loop can be infinite (continue forever) or conditional (stops upon a condition). True or
false? Mark for Review
(1) Points
True (*)
False
Section 2
6. In Alice, procedural abstraction is the concept of making code easier to understand and
reuse. True or false? Mark for Review
(1) Points
True (*)
False
Correct
7. In Alice, if a procedure is declared for MyClownFish, which classes can use the
procedure? Mark for Review
(1) Points
MyClownFish class and MySwimmer class
MyClownFish class (*)
MyPajamaFish class, MyClownFish class, and MySwimmer class
Any class with “Fish” in the class name
Incorrect. Refer to Section 2 Lesson 4.
8. In Alice, which of the following are benefits of separating out motions into their own
procedures? Mark for Review
(1) Points
(Choose all correct answers)
It makes the animation easier to run.
It makes the scene easier to view.
It simplifies code and makes it easier to read. (*)
It allows many objects of a class to use the same procedure. (*)
It can allow subclasses of a superclass to use a procedure. (*)
Incorrect. Refer to Section 2 Lesson 4.
9. In Alice, which of the following instructions move the Blue Tang fish forward 2 meters?
Mark for Review
(1) Points
this.blueTang move Forward 0.2
this.blueTang move Forward 2
this.blueTang move Backward 2
this.blueTang move Forward 2.0 (*)
Correct
10. From your Alice lessons, the Do In Order control statement is also referred to by what
other name? Mark for Review
(1) Points
Sequence control
Sequential control (*)
Control order
Order control
Incorrect. Refer to Section 2 Lesson 3.
Section 2
11. In Alice, which of the following procedures play a sound? Mark for Review
(1) Points
playSound
playAudio (*)
playSoundFile
playFile
Incorrect. Refer to Section 2 Lesson 3.
12. From your Alice lessons, the “Checklist for Animation Completion” does not ask
questions about the scenario and storyboards, because these are not valid parts of the
animation creation process. True or false? Mark for Review
(1) Points
True
False (*)
Correct
13. From your Alice lessons, when coding for keyboard control, the programmer’s job is to
consider at least 70% of every key stroke the user could take. True or false? Mark for
Review
(1) Points
True
False (*)
Incorrect. Refer to Section 2 Lesson 8.
14. From your Alice lessons, you can run the animation to test that it works properly. True or
false? Mark for Review
(1) Points
True (*)
False
Incorrect. Refer to Section 2 Lesson 8.
15. Expressions with relational operators produce true and false values. True or false?
Mark for Review
(1) Points
True (*)
False
Correct
16. Which of the following does not describe variables? Mark for Review
(1) Points
A place in memory where data of a specific type can be stored for later retrieval and use.
Has a unique name.
Has a type associated with it.
Arranged in rows and columns. (*)
Correct
17. From your Alice lessons, a Do Together statement embedded with two move statements
is an example of what? Mark for Review
(1) Points
Harmony
Compilation
Forward thinking
Nesting (*)
Incorrect. Refer to Section 2 Lesson 5.
18. In Alice, once procedures are added to a control statement, they cannot be changed.
True or false? Mark for Review
(1) Points
True
False (*)
Incorrect. Refer to Section 2 Lesson 5.
19. Do In Order and Do Together are the only control statements available in Alice. True or
false? Mark for Review
(1) Points
True
False (*)
Incorrect. Refer to Section 2 Lesson 5.
20. From your Alice lessons, built-in functions provide precise property details for the
following areas: Mark for Review
(1) Points
Proximity and size
Distance to and nesting
Proximity, size, spatial relation, and point of view (*)
Proximity and point of view
Correct
21. Which of the following is not an example of the logic of an IF control structure? Mark for
Review
(1) Points
Play the video three times. (*)
If the play button is pressed, then play the video one time.
If the doorbell rings, then the door opens.
If the bird rings the bell, a treat is dispensed.
Correct
22. Which of the following statements about methods is false? Mark for Review
(1) Points
Classes must be defined directly within a method definition. (*)
Methods whose return type is not void are required to include a return statement specifying
what to return.
The order in which methods are listed within the class is not important.
Java does not permit nesting one method definition within another method’s definition.
Incorrect. Refer to Section 2 Lesson 10.
23. From your Alice lessons, how do you add an instance to a scene in Alice? Mark for
Review
(1) Points
Select the instance from your computer’s network.
Write code that places the instance in the scene.
Select the class, then drag the object into the scene. (*)
Call the addObject method.
Correct
24. All objects in Alice have three dimensional coordinates on which axes? Mark for Review
(1) Points
(Choose all correct answers)
x (*)
y (*)
z (*)
w
All of the above
Incorrect. Refer to Section 2 Lesson 2.
25. From your Alice lessons, what is a one-shot procedural method? Mark for Review
(1) Points
A procedure that is invoked when the Run button is clicked.
A procedure that is used to make a scene adjustment. (*)
A procedure that is dragged into the code editor.
A procedure that is used to launch the program.
Correct
Section 3
26. Which of the following Java syntax is used to correctly create a Duke subclass? Mark for
Review
(1) Points
private Dog extends World
public class Dog extends World
public class Duke extends Animal (*)
private class extends Actor
private class extends Duke
Correct
27. In Greenfoot, a subclass is a specialization of a superclass. True or false? Mark for
Review
(1) Points
True (*)
False
Correct
28. From your Greenfoot lessons, source code is written in the code editor. True or false?
Mark for Review
(1) Points
True (*)
False
Correct
29. In Greenfoot, a variable can be saved and accessed later, even if the instance no longer
exists. True or false? Mark for Review
(1) Points
True
False (*)
Correct
30. What does the following Greenfoot programming statement do?
turn(18); Mark for Review
(1) Points
Turn the object 36 degrees.
Turn the object 18 degrees. (*)
Turn the object 18 steps forward.
Move the object 18 steps forward.
Correct
Section 3
31. In the Greenfoot IDE, which of the following are components of a parameter? Mark for
Review
(1) Points
(Choose all correct answers)
Parameter type (*)
Parameter return
Parameter name (*)
Parameter method
Parameter void
Incorrect. Refer to Section 3 Lesson 2.
32. From your Greenfoot lessons, abstraction techniques can only be used once in a class’s
source code. True or false? Mark for Review
(1) Points
True
False (*)
Correct
33. From your Greenfoot lessons, which of the following are examples of abstraction? Mark
for Review
(1) Points
(Choose all correct answers)
Playing a range of sounds when keyboard keys are pressed. (*)
A single instance displays a single image.
Assigning a different keyboard key to each instance. (*)
Programming a single movement for a single instance.
Assigning a different image file to each instance. (*)
Incorrect. Refer to Section 3 Lesson 9.
34. Greenfoot does not have tools to record sound. True or false? Mark for Review
(1) Points
True
False (*)
Correct
35. What type of parameter does the Greenfoot playSound method expect? Mark for Review
(1) Points
name of a sound file (as String) (*)
name of an integer (as int)
name of a keyboard key (as String)
name of the class (as String)
Incorrect. Refer to Section 3 Lesson 7.
Section 3
36. From your Greenfoot lessons, which line of code is missing something?
Mark for Review
(1) Points
1
3 (*)
4
5
6
Incorrect. Refer to Section 3 Lesson 12.
37. From your Greenfoot lessons, which of the following is an example of changing test data
during a Q/A test cycle? Mark for Review
(1) Points
Use a different operating system.
Use the mouse instead of the keyboard.
Use symbols instead of numbers. (*)
All of the above.
Incorrect. Refer to Section 3 Lesson 12.
38. From your Greenfoot lessons, dot notation allows you to use a method from a different
class, if the class you are programming does not possess the method. True or false? Mark
for Review
(1) Points
True (*)
False
Correct
39. Use you Greenfoot knowledge: What range of numbers does the following method
return?
Greenfoot.getRandomNumber(30) Mark for Review
(1) Points
A random number between 1 and 30.
A random number between 0 and 30.
A random number between 0 and 29. (*)
A random number between 1 and 29.
Incorrect. Refer to Section 3 Lesson 5.
40. From your Greenfoot lessons, classes can only use the methods they have inherited.
They cannot use methods from other classes. True or false? Mark for Review
(1) Points
True
False (*)
Correct
Section 3
41. From your Greenfoot lessons, a problem statement defines the purpose for your game.
True or false? Mark for Review
(1) Points
True (*)
False
Correct
42. Use your Greenfoot knowledge: An array object holds a single variable. True or false?
Mark for Review
(1) Points
True
False (*)
Correct
43. In Greenfoot, a local variable is declared at the beginning of a class. True or false? Mark
for Review
(1) Points
True
False (*)
Incorrect. Refer to Section 3 Lesson 10.
44. From your Greenfoot lessons, which of the following logic operators represents “and”?
Mark for Review
(1) Points
&
&& (*)
=
!
Correct
45. Use your Greenfoot knowledge to answer the question. One reason to write a defined
method in a class is to change the behavior of the class. True or false? Mark for Review
(1) Points
True (*)
False
Correct
Section 3
46. To execute a method in your Greenfoot game, where is it called from? Mark for Review
(1) Points
The world
The act method (*)
The actor class
The gallery
Correct
47. In Greenfoot, a way to have all subclasses of a superclass inherit a method is by adding
the method to the superclass. True or false? Mark for Review
(1) Points
True (*)
False
Correct
48. We can use the Actor constructor to automatically create Actor instances when the
Greenfoot world is initialized. True or false? Mark for Review
(1) Points
True
False (*)
Incorrect. Refer to Section 3 Lesson 8.
49. Use your Greenfoot knowledge to answer the question: Where are defined variables
typically entered in a class’s source code? Mark for Review
(1) Points
In the defined method in the source code.
Between the constructors and methods in the source code.
After the constructors and methods in the source code.
At the top of the source code, before the constructors and methods. (*)
Correct
50. In Greenfoot, we can use the act method in the class to automatically create the Actor
instances when the world is initialized. True or false? Mark for Review
(1) Points
True
False (*)
Correct
1. In Alice, which of the following is not a control statement?
Count
While
Move
Do In Order
2. In Alice, which procedure is used to assign one object as the vehicle of another?
setClassVehicle
setObjectVehicle
Vehicle
setVehicle
3. From your Alice lessons, random numbers are set in the distance and duration arguments
in a procedure. True or false?
True
False
4. In Alice, the computer specifies the low and high range values for the range of numbers
from which to pull a randomized number. True or false?
True
False
5. In Alice, there is a limit of 10 objects per scene. True or false?
True
False
6. Manually manipulating an Alice object with your cursor is a way to precisely position an
object. True or false?
True
False (*)
7. What do moving objects provide to your scene?
The sky and ground
The non-moving scenery
The procedures
The action (*)
8. What does a visual storyboard help the reader understand?
How the initial scene will be set up. (*)
The components of the scene. (*)
The actions that will take place. (*)
The code that is debugged.
9. In Alice, you examine code where a bird moves its wings forward and backward while
moving forward simultaneously across the scene. You notice that this set of procedures are
repeated in the Code editor ten times to achieve this motion. How could procedural
abstraction be used to make the code simpler and easier to read?
Do not make any changes to the code.
Use the Scene editor to position the wings so that they are up as the body moves forward.
Use the Count control statement to execute the forward motion of the body and up and down
motion of the wings 10 times. (*)
Declare a separate “fly” procedure for the body moving forward and wings moving up and
down. (*)
10. In Alice, you could identify when new procedures need to be declared by reviewing the
textual storyboard for the animation. True or false?
True (*)
False
11. From your Alice lessons, built-in functions provide precise property details for the
following areas:
Proximity, size, spatial relation, and point of view. (*)
Proximity and point of view.
Proximity and size.
Distance to and nesting.
12. In Alice, functions ask questions about an object. True or false?
True
False (*)
13. In Alice the Functions tab will display the pre-defined functions for the selected instance.
True or false?
True (*)
False
14. The Alice Scene editor contains tools to rotate the camera view. True or false?
True (*)
False
15. To access the Alice Code editor from the Scene editor, which button do you click?
Code Editor
Edit Code (*)
Code
Access Code Editor
1. Creating multiple versions of your Alice project saves time. True or false?
True (*)
False
2. An argument is a value that the procedure uses to complete its task. True or false?
True (*)
False
3. Which of the following is not a reason for why comments are helpful in an Alice program?
Comments help during debugging and testing so the tester knows how the programming
statements are supposed to work.
Comments change the functionality of the program. (*)
Comments describe the intention of the programming instructions.
Comments can outline the programming instructions.
4. What is the first step to entering comments in an Alice program?
Drag and drop the comments tile above a code segment. (*)
Type comments that describe the sequence of actions in the code segment.
Drag and drop the comments tile below a code segment.
Select the instance from the instance menu.
5. In Alice, you could identify when new procedures need to be declared by reviewing the
textual storyboard for the animation. True or false?
True (*)
False
6. From your Alice lessons, what does inheritance mean?
Each superclass inherits the methods and properties of its subclass.
Each subclass inherits the methods and properties of its superclass. (*)
Each class inherits the methods and properties of all classes available in Alice.
Each class has its own methods and properties that are non-transferable to any other class.
7. From your Alice lessons, a flowchart could be created in a software program, or
documented in a journal. True or false?
True (*)
False
8. Which of the following is not an example of a one-shot procedure?
Move
Spin (*)
Roll
Turn
9. Which handle style would be used to rotate an object’s sub-part about the x, y, and z
axes?
Translation
Resize
Default
Rotation (*)
10. In Alice, different programming is not required for different objects, because all objects
move the same way. True or false?
True
False (*)
11. In Alice, Do In Order and Do Together:
Are move statements
Are control statements (*)
Are complex statements
None of the above
12. In Alice, where you would you get access to the specific joints of an object that are not
available through the object drop down menu?
scene editor
code editor
procedures tab
functions tab (*)
13. From your Alice lessons, built-in functions provide precise property details for the
following areas:
Distance to and nesting.
Proximity and point of view.
Proximity and size.
Proximity, size, spatial relation, and point of view. (*)
14. In Alice, which of the following arguments could be replaced with a random number?
Procedure name
Distance (*)
Duration (*)
Direction
Object name
15.
In Alice, the while control statement executes a set of procedures a specific number of times.
True or false?
True
False (*)
1. After objects are positioned in the scene, it is wise to save multiple versions of the project,
giving each version the same name. True or false?
True
False (*)
2. When you edit an object’s properties in the Scene editor, the changes do not take effect
until the Run button is clicked. True or false?
True
False (*)
3. Which of the following is not an example of a one-shot procedure?
Turn
Roll
Move
Spin (*)
4. In Alice, different programming is not required for different objects, because all objects
move the same way. True or false?
True
False (*)
5. In Alice, Do In Order and Do Together:
Are move statements
Are control statements (*)
Are complex statements
None of the above
6. Which Alice execution task corresponds with the following storyboard statement?
Cat rolls to the left.
Cat roll Right 1
Cat roll Left 1
this.Cat roll Left 1.0 (*)
roll Left 1
7. Which Alice control statement executes a set of procedures simultaneously?
Together
While
Do together (*)
Do in order
8. In Alice, what are the forms of a scenario?
A system to start.
A person to help.
A section of code to write.
A task to perform. (*)
A problem to solve. (*)
9. From your Alice lessons, inheritance means that the superclass inherits its traits from the
subclass. True or false?
True
False (*)
10. From your Alice lessons, what does inheritance mean?
Each class inherits the methods and properties of all classes available in Alice.
Each superclass inherits the methods and properties of its subclass.
Each subclass inherits the methods and properties of its superclass. (*)
Each class has its own methods and properties that are non-transferable to any other class.
11. What is the first step to programming an object to turn left in Alice?
Drag the turn procedure into the Code editor.
Select the object to program from the instance menu. (*)
Select the duration for the object to turn.
Select the distance to turn.
12. Which of the following procedures turns an object to face another object?
moveToward
orientToUpright
turnToFace (*)
turn
13. The say procedure in Alice plays an audio file. True or false?
True
False (*)
14. From your Alice lessons, which programming instruction represents the following
movement: A turtle moves forward half the distance to the flower.
this.Turtle move Forward this.Turtle getDistanceTo this.Flower * 2
this.Turtle move Forward this.Turtle getDistanceTo this.Flower / 0.5
this.Turtle move Forward this.Turtle getDistanceTo this.Flower / 1.0
this.Turtle move Forward this.Turtle getDistanceTo this.Flower / 2.0 (*)
15. In Alice, functions are dragged into the control statement, not the procedure. True or
false?
True
False (*)
1. In Alice, a computer program requires functions to tell it how to perform the procedure.
True or false?
True
False (*)
2. In Alice, which procedure is used to assign one object as the vehicle of another?
setClassVehicle
setVehicle (*)
Vehicle
setObjectVehicle
3. In Alice, if only objects that walk on four legs need to use a procedure, in which
superclass would the procedure be declared?
Swimmer
Biped
Prop
Quadruped (*)
4. Breaking down a problem or process into smaller parts makes it easier to manage. True
or false?
True (*)
False
5. In Alice, which of the following are benefits of separating out motions into their own
procedures?
It simplifies code and makes it easier to read. (*)
It can allow subclasses of a superclass to use a procedure. (*)
It allows many objects of a class to use the same procedure. (*)
It makes the scene easier to view.
It makes the animation easier to run.
6. When you disable a programming instruction, it is still executed when you run the Alice
animation. True or false?
True
False (*)
7. Which of the following is not a reason for why comments are helpful in an Alice program?
Comments change the functionality of the program. (*)
Comments can outline the programming instructions.
Comments describe the intention of the programming instructions.
Comments help during debugging and testing so the tester knows how the programming
statements are supposed to work.
8. Which of the following instructions turns the clown fish left 5 revolutions?
this.clownFish turn Left 0.5
this.clownFish turn Left 5.0 (*)
this.clownFish turn Left 5
this.Fish turn Left 5
9. Saved Alice projects can be opened and edited. True or false?
True (*)
False
10. All objects in Alice have three dimensional coordinates on which axes?
x (*)
y (*)
z (*)
w
All of the above
11. From your Alice lessons, which programming instruction represents the following
movement: A turtle moves forward half the distance to the flower.
this.Turtle move Forward this.Turtle getDistanceTo this.Flower / 0.5
this.Turtle move Forward this.Turtle getDistanceTo this.Flower / 1.0
this.Turtle move Forward this.Turtle getDistanceTo this.Flower * 2
this.Turtle move Forward this.Turtle getDistanceTo this.Flower / 2.0 (*)
12. In Alice, which function is used to move an object directly to the center point of another
object?
getDuration
getDistance (*)
getObject
getDepth
13. In Alice, where are objects added and positioned in the scene?
The Scene editor (*)
The Code editor
The gallery
The template
14. Which Alice execution task corresponds with the following storyboard statement?
Cat turns to face mouse.
cat TurnTo mouse
this.mouse turnToFace this.cat
this.cat turnToFace this.mouse (*)
mouse turnTo cat
15. From your Alice lessons, what does the Count control statement do?
Executes statements simultaneously.
Executes statements a specific number of times. (*)
Executes statements a random number of times.
Executes statements while a condition is true.
1. In Alice, there is no way of seeing the code as Java code. True or false?
True
False (*)
2. When viewing the Java Code on the side in Alice, you can change the Java code directly
instead of the Alice code. True or false?
True
False (*)
3. What can be used as a guideline to ensure your Alice animation fulfills animation
principles?
A close friend
An animation checklist (*)
The Internet
Other programmers
4. From your Alice lessons, functional decomposition is the process of taking a complex
problem or process and growing it into larger parts that are easier to manage. True or false?
True
False (*)
5. In Alice, what are the forms of a scenario?
(Choose all correct answers)
A person to help.
A problem to solve. (*)
A system to start.
A section of code to write.
A task to perform. (*)
6. Main is an example of what in the following code?
public static void main (String[] args) {
System.out.println{“Hello World!”);
}
A variable
A class
A method (*)
An instance
7. If you want one message to display if a user is below the age of 18 and a different
message to display if the user is 18 or older, what type of construct would you use?
if (*)
while loop
for all loop
do loop
8. An Alice event is considered what?
An object’s orientation.
Error handling.
A party with at least 20 people.
A keystroke or mouse click. (*)
9. In Alice it is not possible to transfer a class from one animation to another. True or false?
True
False (*)
10. In Alice, which of the following programming statements moves the fish forward, the
distance to the rock, minus the depth of the rock?
this.Fish move forward {this.Rock getDistanceTo this.Fish – this.Fish – 2}
this.Fish move forward {this.Rock getDistanceTo this.Fish – this.Fish getDepth}
this.Rock move forward {this.Rock getDistanceTo this.Fish – this.Fish – 2}
this.Fish move forward {this.Fish getDistanceTo this.Rock – this.Rock getDepth} (*)
11. An example of an expression is:
If or Where
3*3=9 (*)
Move forward 1 meter
“I feel happy.”
12. What tool can be used to diagram an IF conditional execution statement?
Conditional flow diagram
Cause and effect diagram
Process flow diagram (*)
13. In Alice, we use the While control statement to implement the conditional loop. True or
false?
True (*)
False
14. A data type defines the type of procedures a variable can store. True or false?
True
False (*)
15. If a value has been assigned to (is stored in) a variable, that value will be overwritten
when another value is assigned to the variable using the assignment “=” operator. True or
false?
True (*)
False
1. You want a block of code to be executed only once if certain conditions are met. What
type of Java construct would you use?
array
while loop
boolean
if (*)
2. If you need to repeat a group of Java statements many times, which Java construct
should you use?
do while loop (*)
repeat…until
while loop (*)
if
3. The initializer of a variable with a TextString value type could be (select all that apply):
“Greetings” (*)
“Howdy” (*)
“4” (*)
None of the above.
4. From your Alice lessons, variables are fixed and cannot be changed. True or false?
True
False (*)
5. Which of the following WHILE control structures commands the fish to move forward
repeatedly 0.5 meters at a time, but stop if it collides with the shark?
(*)
6. The Alice IF control structure requires the false statement to be populated. True or false?
True
False (*)
7. What can be used as a guideline to ensure your Alice animation fulfills animation
principles?
An animation checklist (*)
The Internet
Other programmers
A close friend
8. What type of Alice listener object is required to target a mouse-click on any object in the
scene, allowing the user to drag that object around the scene when the animation is
running?
addListener procedure
addMouseListener procedure
addDefaultModelManipulation procedure (*)
addDefaultManipulation procedure
9. The Alice animation should be tested throughout development, not just at the end of the
animation’s development. True or false?
True (*)
False
10. What is the result of the following code?
x>y:x>y
x<y:x<y
x > y : false
x < y : true
x>y:1
x<y:0
x > y : true
x < y : false (*)
x>y:0
x<y:1
11. In Java, which symbol is used to assign one value to another?
<
//
= (*)
>
12. Which of the following is not a type of event listener in Alice?
Keyboard
Scene Activation/Time
Cursor (*)
Position/Orientation
Mouse
13. Alice provides pre-populated worlds through which new menu tab?
Starters (*)
Blank Slates
File System
Recent
14. In Alice, which of the following programming statements moves the cat forward the
distance to the bird?
this.Cat move forward {this.Bird getDistanceTo this.Cat / 2}
this.Cat move forward {this.Cat getDistanceTo this.Bird} (*)
this.Cat move {this.Bird getDistanceTo this.Cat / 2}
this.Bird move forward {this.Bird getDistanceTo this.Cat}
15. In Alice, which of the following programming statements moves the cat backward, half
the distance to the bird?
this.Cat move backward {this.Cat getDistanceTo this.Bird / 2} (*)
this.Bird move forward {this.Bird getDistanceTo this.Cat / 2}
this.Cat move backward {this.Bird getDistanceTo this.Cat / 2}
this.Cat move forward {this.Bird getDistanceTo this.Cat / 2}
1. Consider the following: You want to use the BufferedReader and InputStreamReader
classes to get user input from the command line. Which one of the following import
statements must you use?
import java.io.*; (*)
import java.awt.*;
import java.buffer.*;
import java.io.input.*;
2. You want a block of code to be executed only once if certain conditions are met. What
type of Java construct would you use?
array
boolean
while loop
if (*)
3. In Java, which symbol is used to assign one value to another?
<
>
//
= (*)
4. Expressions with relational operators produce true and false values. True or false?
True (*)
False
5. When viewing the Java Code on the side in Alice, you can change the Java code directly
instead of the Alice code. True or false?
True
False (*)
6. Which of the following is not an Alice variable value type?
Function (*)
Decimal Number
Color
Whole Number
7. A conditional loop is a loop that will continue forever. True or false?
True
False (*)
8. Which of the following IF control structures command the blue tang fish to roll and
simultaneously move down if it collides with a shark, or move forward if it does not collide
with a shark?
 
 
(*)
9. What can be used as a guideline to ensure your Alice animation fulfills animation
principles?
An animation checklist (*)
The Internet
A close friend
Other programmers
10. From your Alice lessons, animations should be tested by the programmer before they
are considered complete. True or false?
True (*)
False
11. What should you refer to for the animation’s design specifications as you program your
Alice animation?
Code
Storyboard (*)
Scenario
Scene editor
12. In Alice, what tab would you choose to start a new animation with a pre-populated world?
Recent
Blank Slate
Starters (*)
My Projects
13. Which one of the following event listener types is not available at the top-level of the
addEvent drop down list in Alice?
Collision (*)
Keyboard
Position/Orientation
Mouse
14. In Alice, which of the following programming statements moves the fish forward, the
distance to the rock, minus the depth of the rock?
this.Fish move forward {this.Rock getDistanceTo this.Fish – this.Fish – 2}
this.Rock move forward {this.Rock getDistanceTo this.Fish – this.Fish – 2}
this.Fish move forward {this.Rock getDistanceTo this.Fish – this.Fish getDepth}
this.Fish move forward {this.Fish getDistanceTo this.Rock – this.Rock getDepth} (*)
15. In Alice, which of the following programming statements moves the cat backward, half
the distance to the bird?
this.Cat move backward {this.Bird getDistanceTo this.Cat / 2}
this.Cat move forward {this.Bird getDistanceTo this.Cat / 2}
this.Bird move forward {this.Bird getDistanceTo this.Cat / 2}
this.Cat move backward {this.Cat getDistanceTo this.Bird / 2} (*)
1. In Alice, we can avoid object collision using what?
Slowing movements down.
Using object detection.
Using math operators. (*)
Downloading the Alice 3 collision detector app.
2. Alice uses built-in math operators. They are:
Add
Subtract
Multiply
Divide
All of the above (*)
3. A conditional loop is a loop that will continue forever. True or false?
True
False (*)
4. A conditional loop is a loop that will continue forever. True or false?
True
False (*)
5. If a value has been assigned to (is stored in) a variable, that value will be overwritten
when another value is assigned to the variable using the assignment “=” operator. True or
false?
True (*)
False
6. The list below displays valid primitive types in Java, except which one?
int
String (*)
double
long
boolean
10. Review the code below.
Select the result from the following statements about what happens when the loopVal >= 5 .
The message “Printing Some Text” will be printed until loopVal is no longer less than 5.
The variable loopVal is initialized to 0.
The condition loopVal < 5 is tested before executing anything further in the program. (*)
The condition loopVal < 5 returns a boolean value.
None of the above.
11. From your Alice lessons, animations should be tested by the programmer before they
are considered complete. True or false?
True (*)
False
12. From your Alice lessons, a textual storyboard provides a detailed, ordered list of the
actions each object performs in each scene of the animation. True or false?
True (*)
False
13. What should you refer to for the animation’s design specifications as you program your
Alice animation?
Code
Scenario
Scene editor
Storyboard (*)
15. In Alice it is not possible to transfer a class from one animation to another. True or false?
True
False (*)
2. When you import a class from another file you have to import the entire class. True or
false?
True
False (*)
4. Which of the following does not describe methods?
A set of code that is referred to by name.
Is associated with an instance variable. (*)
Can be called at any point in a program simply by utilizing its name.
A subprogram that acts on data and often returns a value.
5. What can be used as a guideline to ensure your Alice animation fulfills animation
principles?
The Internet
A close friend
Other programmers
An animation checklist (*)
6. From your Alice lessons, functional decomposition is the process of taking a complex
problem or process and growing it into larger parts that are easier to manage. True or false?
True
False (*)
7. When presenting your Alice animation, ensure that your presentation is thoroughly tested
and complete. True or false?
True (*)
False
8. A variable is a place in memory where data of a specific type can be stored for later
retrieval and use by your program
True (*)
False
9. Define the value of the variable LapCount based on the following math calculation:
LapCount + 10 = 15
4
2
5 (*)
10
15
10. The list below displays valid primitive types in Java, except which one?
boolean
double
int
String (*)
long
11. A typical application uses various values and these values continuously change while the
program is running. True or false?
True (*)
False
13. A conditional loop is a loop that will continue forever. True or false?
True
False (*)
14. Alice uses built-in math operators. They are:
Add
Subtract
Multiply
Divide
All of the above (*)
15. An example of an expression is:
3*3=9 (*)
If or Where
Move forward 1 meter
“I feel happy.”
1. Which of the following is not a valid primitive type in Java?
boolean
double
int
long
String (*)
2. Results of arithmetic operations cannot be stored in a variable. True or false?
True
False (*)
3. If you want one message to display if a user is below the age of 18 and a different
message to display if the user is 18 or older, what type of construct would you use?
for all loop
do loop
while loop
if (*)
4. If you need to repeat a group of Java statements many times, which Java construct
should you use?
(Choose all correct answers)
if
repeat…until
while loop (*)
do while loop (*)
5. In Alice, which of the following programming statements moves the fish forward, the
distance to the rock, minus the depth of the rock?
this.Rock move forward {this.Rock getDistanceTo this.Fish – this.Fish – 2}
this.Fish move forward {this.Rock getDistanceTo this.Fish – this.Fish getDepth}
this.Fish move forward {this.Rock getDistanceTo this.Fish – this.Fish – 2}
this.Fish move forward {this.Fish getDistanceTo this.Rock – this.Rock getDepth} (*)
6. Identify an example of an Alice expression.
“Hello World.”
IF or WHILE
12 + 15 = 27 (*)
None of the above
7. A conditional loop is a loop that will continue forever. True or false?
True
False (*)
8. In Alice, the use of conditional control structures allows what two types of loops?
(Choose all correct answers)
switch
infinite
conditional (*)
together
9. Which is an example of the Boolean variable type?
An object
3
True or False (*)
Hello World
10. A variable is a named location inside the computer’s memory; once there, the
information can be retrieved and changed. True or false?
True (*)
False
11. From your Alice lessons, at what point in the animation process do you confirm the items
on the “Checklist for Animation Completion”?
At the beginning of the animation process.
After adding each procedure to the Code editor.
During the animation process.
At the end of the animation process. (*)
12. In which Alice class is the addDefaultModelManipulation procedure located?
Quadruped class
myFirstMethod class
Object class
Scene class (*)
13. As the Alice programmer, you render the animation on your own. True or false?
True
False (*)
14. You want an event to happen when an object collides with another object, which
category of event handler would you choose?
Mouse
Position/Orientation (*)
Keyboard
Scene Activation/time
15. An Alice event is considered what?
A party with at least 20 people.
Error handling.
An object’s orientation.
A keystroke or mouse click. (*)
1. In Alice, there is no way of seeing the code as Java code. True or false? Mark for Review
(1) Points
True
False (*)
Correct
2. In Java code the { } brackets are used to represent what statements? Mark for Review
(1) Points
(Choose all correct answers)
end (*)
begin (*)
for
while
Incorrect. Refer to Section 2 Lesson 10.
3. From your Alice lessons, which of the following is a tool to show the logic of an animation?
Mark for Review
(1) Points
Flowchart (*)
Class chart
Scene editor
Pie chart
Visual storyboard
Incorrect. Refer to Section 2 Lesson 5.
4. In Alice, if only objects that walk on four legs need to use a procedure, in which
superclass would the procedure be declared? Mark for Review
(1) Points
Biped
Swimmer
Prop
Quadruped (*)
Correct
5. In Alice, new procedures are declared in the Scene editor. True or false? Mark for Review
(1) Points
True
False (*)
Correct
Page 1 of 10
6. From your Alice lessons, where on an object do an object’s axes intersect? Mark for
Review
(1) Points
At the object’s head
At the object’s center point (*)
At the object’s chest
At the object’s bottom
Correct
7. Which of the following instructions turns the clown fish left 5 revolutions? Mark for Review
(1) Points
this.clownFish turn Left 0.5
this.Fish turn Left 5
this.clownFish turn Left 5.0 (*)
this.clownFish turn Left 5
Correct
8. What is the output produced by the following code?
Mark for Review
(1) Points
j is 10
j is 5
k is 5
j is 15
k is 15
j is 10
k is 10
j is 5
k is 5 (*)
Correct
9. A typical application uses various values and these values continuously change while the
program is running. True or false? Mark for Review
(1) Points
True (*)
False
Correct
10. Main is an example of what in the following code?
public static void main (String[] args) {
System.out.println{“Hello World!”);
} Mark for Review
(1) Points
A class
An instance
A method (*)
A variable
Correct
Page 2 of 10
11. Which of the following statements about what happens when the following code is
executed is false?
Mark for Review
(1) Points
The message “Printing Some Text” will be printed until loopVal is no longer less than 5.
The variable loopVal is initialized to 0.
The condition loopVal < 5 is tested before the block is executed. (*)
The condition loopVal < 5 returns a boolean value.
None of the above.
Correct
12. What should you refer to for the animation’s design specifications as you program your
Alice animation? Mark for Review
(1) Points
Storyboard (*)
Scene editor
Code
Scenario
Correct
13. The animation checklist helps you confirm that all elements of the Alice animation are
operating as expected. True or false? Mark for Review
(1) Points
True (*)
False
Correct
14. With keyboard controls, you can create Alice animations where the user controls an
object that interacts with other objects. True or false? Mark for Review
(1) Points
True (*)
False
Correct
15. When creating an event based on a keypress which event handler would you use? Mark
for Review
(1) Points
Keyboard (*)
Scene Activation/Time
Position/Orientation
Mouse
Correct
Page 3 of 10
16. In Alice, which of the following programming statements moves the cat backward, half
the distance to the bird? Mark for Review
(1) Points
this.Cat move backward {this.Bird getDistanceTo this.Cat / 2}
this.Cat move forward {this.Bird getDistanceTo this.Cat / 2}
this.Cat move backward {this.Cat getDistanceTo this.Bird / 2} (*)
this.Bird move forward {this.Bird getDistanceTo this.Cat / 2}
Correct
17. In Alice, which of the following programming statements moves the butterfly forward,
double the distance to the tree? Mark for Review
(1) Points
this.Butterfly move backward {this.Butterfly getDistanceTo this.Tree / 2}
this.Butterfly move forward {this.Butterfly getDistanceTo this.Tree / 2}
this.Butterfly move backward {this.Butterfly getDistanceTo this.Tree * 2}
this.Butterfly move forward {this.Butterfly getDistanceTo this.Tree * 2} (*)
Correct
18. From your Alice lessons, what does the Count control statement do? Mark for Review
(1) Points
Executes statements simultaneously.
Executes statements while a condition is true.
Executes statements a specific number of times. (*)
Executes statements a random number of times.
Correct
19. In Alice, there is no way of reordering the function list in the function tab. True or false?
Mark for Review
(1) Points
True
False (*)
Correct
20. The Alice IF control structure requires the false statement to be populated. True or false?
Mark for Review
(1) Points
True
False (*)
Correct
Page 4 of 10
21. Copying programming instructions saves time when programming your Alice project.
True or false? Mark for Review
(1) Points
True (*)
False
Incorrect. Refer to Section 2 Lesson 1.
22. In Alice, different programming is not required for different objects, because all objects
move the same way. True or false? Mark for Review
(1) Points
True
False (*)
Correct
23. In Alice, which of the following is not a control statement? Mark for Review
(1) Points
Do In Order
Move (*)
While
Count
Correct
24. In Alice, a computer program requires functions to tell it how to perform the procedure.
True or false? Mark for Review
(1) Points
True
False (*)
Correct
Section 3
(Answer all questions in this section)
25. In Greenfoot, string concatenation reduces the number of redundant characters or
phrases you need to type into each array. True or false? Mark for Review
(1) Points
True (*)
False
Correct
Page 5 of 10
26. In the Greenfoot IDE, what symbols indicate that the variable is an array? Mark for
Review
(1) Points
Semicolon ;
Square brackets [ ] (*)
Curly brackets { }
Colon :
Incorrect. Refer to Section 3 Lesson 10.
27. In Greenfoot, what type of symbol is used to connect boolean expressions? Mark for
Review
(1) Points
Integers
String concatenation
Logic operators (*)
Keyboard key names
Incorrect. Refer to Section 3 Lesson 10.
28. In the Greenfoot IDE, what does the AND operator (&&) do? Mark for Review
(1) Points
Compares two boolean variables or expressions and returns a result that is true if either of
its operands are true.
Compares two boolean values, and returns a boolean value which is true if and only if one of
its operands are true.
Compares two boolean values, and returns a boolean value which is true if and only if both
of its operands are true. (*)
Compares two boolean values and returns a boolean value which is true if either one of the
operands is true.
Correct
29. A subclass has what kind of relationship to a superclass? Mark for Review
(1) Points
“for-what”
“a-is”
“is-a” (*)
“is-by”
Correct
30. In Greenfoot, after a subclass is created, what has to occur before instances can be
added to the scenario? Mark for Review
(1) Points
Creation of source code
Editing of source code
Creation of an instance
Compilation (*)
Incorrect. Refer to Section 3 Lesson 1.
Page 6 of 10
31. Which of the following comparison symbols represents equals? Mark for Review
(1) Points
>
= = (*)
<
!=
Incorrect. Refer to Section 3 Lesson 5.
32. From your Greenfoot lessons, which programming statement creates a new Bee object,
and places it at x = 120, y = 100 in the world? Mark for Review
(1) Points
Move(120,100);
addWorld (new Bee( ), 120, 100);
addObject (new Bee( ), 120, 100); (*)
addClass (new Bee( ), 120, 100);
Correct
33. In Greenfoot, you can use comparison operators to compare a variable to a random
number. True or false? Mark for Review
(1) Points
True (*)
False
Correct
34. From your Greenfoot lessons, which axes define an object’s position in a world? Mark for
Review
(1) Points
(Choose all correct answers)
y (*)
w
x (*)
z
Correct
35. In Greenfoot, you will never have to cast as we only ever use 2 classes – World and
Actor. Mark for Review
(1) Points
True
False (*)
Incorrect. Refer to Section 3 Lesson 9.
Page 7 of 10
36. Specific to the Greenfoot IDE, which of the following stop methods is written correctly?
Mark for Review
(1) Points
stop.Greenfoot( );
Greenfoot(stop);
Greenfoot.stop(key);
Greenfoot.stop( ); (*)
Correct
37. In Greenfoot, a constructor has a void return type. True or false? Mark for Review
(1) Points
True
False (*)
Incorrect. Refer to Section 3 Lesson 8.
38. We can use the Actor constructor to automatically create Actor instances when the
Greenfoot world is initialized. True or false? Mark for Review
(1) Points
True
False (*)
Incorrect. Refer to Section 3 Lesson 8.
39. From your Greenfoot lessons, Which of the following statements is most correct? Mark
for Review
(1) Points
My program is complete when it runs and I’ve tested the code. (*)
My program is complete when I add music to it.
My program is complete when it compiles.
My program is complete when I add images to it.
Incorrect. Refer to Section 3 Lesson 4.
40. From your Greenfoot lessons, how do you know the program does not contain syntax
errors? Mark for Review
(1) Points
Compile the code. (*)
Review the documentation.
Inspect the instances.
Write the code.
Incorrect. Refer to Section 3 Lesson 4.
Page 8 of 10
41. In Greenfoot, a way to have all subclasses of a superclass inherit a method is by adding
the method to the superclass. True or false? Mark for Review
(1) Points
True (*)
False
Correct
42. In the Greenfoot IDE, any new methods you create are written in the class’s source
code. True or false? Mark for Review
(1) Points
True (*)
False
Correct
43. From your Greenfoot lessons, where do you review a class’s inherited methods? Mark
for Review
(1) Points
Inspector
Documentation (*)
If-statement
Act method
Incorrect. Refer to Section 3 Lesson 3.
44. In Greenfoot, what happens if the condition is false in an if-statement? Mark for Review
(1) Points
The act method is deleted.
The programming statements are not executed. (*)
The programming statements are executed.
The if-statement is executed.
Correct
45. Using the Greenfoot IDE, only five instances can be added to a scenario. True or false?
Mark for Review
(1) Points
True
False (*)
Correct
46. An instance variable can be saved and accessed later, even if the instance no longer
exists. True or false? Mark for Review
(1) Points
True
False (*)
Incorrect. Refer to Section 3 Lesson 2.
47. In Greenfoot, the body of the method is located in between which of the following
characters? Mark for Review
(1) Points
Asterisks **
Parnetheses ( )
Square brackets [ ]
Curly brackets { } (*)
Incorrect. Refer to Section 3 Lesson 2.
48. In Greenfoot, methods can be called in the act method. When the Act button is clicked in
the environment, the methods in the method body of the act method are executed. True or
false? Mark for Review
(1) Points
True (*)
False
Correct
49. In Greenfoot to get the users name you could use: Mark for Review
(1) Points
Greenfoot.ask(“Input Name: “); (*)
Actor.prompt(“Input Name: “);
Greenfoot.prompt(“Input Name: “);
Greenfoot.getUserName();
Incorrect. Refer to Section 3 Lesson 7.
50. In Greenfoot, the sound file must be saved in the scenario and written in the source code
for it to play. True or false? Mark for Review
(1) Points
True (*)
False
Correct
Page 10 of 10
1. In Alice, which of the following is not a control statement? Mark for Review
(1) Points
Move (*)
Do In Order
Count
While
[Correct] Correct
2. In Alice, Do In Order and Do Together: Mark for Review
(1) Points
Are move statements
Are control statements (*)
Are complex statements
None of the above
[Correct] Correct
3. In Alice, which procedure is used to assign one object as the vehicle of another? Mark for
Review
(1) Points
setObjectVehicle
setVehicle (*)
setClassVehicle
Vehicle
[Correct] Correct
4. The Alice Scene editor contains tools to rotate the camera view. True or false? Mark for
Review
(1) Points
True (*)
False
[Correct] Correct
5. From your Alice lessons, built-in functions provide precise property details for the following
areas: Mark for Review
(1) Points
Distance to and nesting.
Proximity and point of view.
Proximity, size, spatial relation, and point of view. (*)
Proximity and size.
[Correct] Correct
6. Which of the following does not describe methods? Mark for Review
(1) Points
A set of code that is referred to by name.
Can be called at any point in a program simply by utilizing its name.
Is associated with an instance variable. (*)
A subprogram that acts on data and often returns a value.
[Incorrect] Incorrect. Refer to Section 2 Lesson 14.
7. What do lines 7, 10 and 13 do in the following code?
Mark for Review
(1) Points
Export files called A, B, and num3.
Create a single file containing A, B, and the value of num3.
Print “A”, “B” and the value of num3 on the screen. (*)
None of the above.
[Correct] Correct
8. From your Alice lessons, which of the following is a tool to show the logic of an animation?
Mark for Review
(1) Points
Scene editor
Flowchart (*)
Class chart
Pie chart
Visual storyboard
[Correct] Correct
9. Before you can begin to develop the animation storyboard, what must be defined? Mark
for Review
(1) Points
The control statements
The code
The debugging process
The scenario (*)
[Correct] Correct
10. A scenario gives the Alice animation a purpose. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
11. When is an instance created in Alice? Mark for Review
(1) Points
After the folder is selected in the gallery.
After the class icon is dragged into the scene. (*)
After the code is created.
After the scenario is saved.
[Correct] Correct
12. Examine the following code. What are the variables?
Mark for Review
(1) Points
(Choose all correct answers)
i (*)
t (*)
args (*)
n (*)
[Incorrect] Incorrect. Refer to Section 2 Lesson 13.
13. What is the result of the following code?
Mark for Review
(1) Points
x>y:x>y
x<y:x<y
x > y : false
x < y : true
x>y:0
x<y:1
x > y : true
x < y : false (*)
x>y:1
x<y:0
[Incorrect] Incorrect. Refer to Section 2 Lesson 13.
14. Which Alice control statement executes a set of procedures simultaneously? Mark for
Review
(1) Points
While
Do in order
Together
Do together (*)
[Correct] Correct
15. When presenting your Alice animation, ensure that your presentation is thoroughly tested
and complete. True or false? Mark for Review
(1) Points
True (*)
False
16. The animation checklist helps you confirm that all elements of the Alice animation are
operating as expected. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
17. From your Alice lessons, the IF control structure can process one true and one false
response. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
18. Which of the following is not an Alice variable value type? Mark for Review
(1) Points
Function (*)
Whole Number
Color
Decimal Number
[Incorrect] Incorrect. Refer to Section 2 Lesson 10.
19. Which of the following programming instructions commands the fish to continuously
move forward a random speed between 0.5 and 1.0 meters, minus 0.25 meters, until it
collides with the shark? Mark for Review
(1) Points
(*)
[Incorrect] Incorrect. Refer to Section 2 Lesson 10.
20. Alice uses built-in math operators. They are: Mark for Review
(1) Points
Add
Subtract
Multiply
Divide
All of the above (*)
[Correct] Correct
21. In Alice, which of the following programming statements moves the butterfly forward,
double the distance to the tree? Mark for Review
(1) Points
this.Butterfly move backward {this.Butterfly getDistanceTo this.Tree / 2}
this.Butterfly move forward {this.Butterfly getDistanceTo this.Tree / 2}
this.Butterfly move backward {this.Butterfly getDistanceTo this.Tree * 2}
this.Butterfly move forward {this.Butterfly getDistanceTo this.Tree * 2} (*)
[Correct] Correct
22. When you import a class from another file you have to import the entire class. True or
false? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 2 Lesson 11.
23. Which one of the following event listener types is not available at the top-level of the
addEvent drop down list in Alice? Mark for Review
(1) Points
Keyboard
Mouse
Position/Orientation
Collision (*)
[Correct] Correct
24. Rings will appear around a sub-part indicating how you can reposition it. True or false?
Mark for Review
(1) Points
True (*)
False
[Correct] Correct
Section 3
(Answer all questions in this section)
25. From your Greenfoot lessons, the reset button resets the scenario back to its initial
position. True or false? Mark for Review
(1) Points
True (*)
False
26. Which of the following Java syntax is used to correctly create a Bee subclass? Mark for
Review
(1) Points
private class extends Actor
private class extends Bee
private Bee extends World
public class Bee extends World
public class Bee extends Animal (*)
[Correct] Correct
27. From your Greenfoot lessons, dot notation allows you to use a method from a different
class, if the class you are programming does not possess the method. True or false? Mark
for Review
(1) Points
True (*)
False
[Correct] Correct
28. In Greenfoot, you can use comparison operators to compare a variable to a random
number. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
29. From your Greenfoot lessons, which programming statement creates a new Bee object,
and places it at x = 120, y = 100 in the world? Mark for Review
(1) Points
Move(120,100);
addWorld (new Bee( ), 120, 100);
addClass (new Bee( ), 120, 100);
addObject (new Bee( ), 120, 100); (*)
[Correct] Correct
30. When a Greenfoot code segment is executed in an if-statement, each line of code is
executed in sequential order. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
31. An array is an object that holds multiple methods. True or false? Mark for Review
(1) Points
True
False (*)
[Correct] Correct
32. From your Greenfoot lessons, when do infinite loops occur? Mark for Review
(1) Points
When the end to the code isn’t established. (*)
Only in while loops.
When the loop is executed.
When the end to the act method isn’t established.
[Correct] Correct
33. In Greenfoot, a local variable is declared at the beginning of a class. True or false? Mark
for Review
(1) Points
True
False (*)
[Correct] Correct
34. If an end to a while loop is not established, what happens? Mark for Review
(1) Points
The code executes and does not stop. (*)
The code stops after 10 executions.
The condition becomes false after one minute of executions.
The code stops after 20 executions.
[Incorrect] Incorrect. Refer to Section 3 Lesson 10.
35. Use your Greenfoot knowldege: If an Actor class Fly has a variable defined to store the
current speed, which of the following statements would successfully add a Fly and define the
current speed as 2? Mark for Review
(1) Points
addObject (new Fly(), 2, 150, 150);
addObject (new Fly(), 150, 150);
addObject (new Fly(2, 90), 150, 150);
addObject (new Fly(2), 150, 150); (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 9.
36. When a program is tested once and it works then testing is complete. Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 4.
37. In Greenfoot, you will not receive an error message if your code is incorrect. It will simply
not work, and you will have to determine why the code doesn’t work. True or false? Mark for
Review
(1) Points
True
False (*)
[Correct] Correct
38. From your Greenfoot lessons, how do you call a defined method? Mark for Review
(1) Points
Write the method in the instance.
Write the method in the Actor class.
Write the method in the documentation.
Call the method from the act method. (*)
Write the method in the World superclass.
[Correct] Correct
39. In reference to Greenfoot, if the following method was defined in a superclass,
public void turnAtEdge(){

}
all subclasses of the superclass will inherit the method.
True or false? Mark for Review
(1) Points
True (*)
False
[Incorrect] Incorrect. Refer to Section 3 Lesson 6.
40. From your Greenfoot lessons, which of the following methods return the current rotation
of the object? Mark for Review
(1) Points
getXY()
World getWorld()
World getClass()
int getRotation() (*)
[Correct] Correct
41. An if-statement requires which type of information returned from the condition? Mark for
Review
(1) Points
Action
Method
Integer
True or false (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 3.
42. Which keyword is used to add an actor to a Greenfoot world? Mark for Review
(1) Points
new
addObject (*)
add
super
[Correct] Correct
43. Use your Greenfoot knowledge to answer the question: Where are defined variables
typically entered in a class’s source code? Mark for Review
(1) Points
At the top of the source code, before the constructors and methods. (*)
After the constructors and methods in the source code.
In the defined method in the source code.
Between the constructors and methods in the source code.
[Correct] Correct
44. Which operator is used to test if values are equal? Mark for Review
(1) Points
>
== (*)
<
!>
[Incorrect] Incorrect. Refer to Section 3 Lesson 8.
45. In Greenfoot you can interact with the scenario using a mouse. Mark for Review
(1) Points
True (*)
False
[Correct] Correct
46. In Greenfoot to get the users name you could use: Mark for Review
(1) Points
Greenfoot.prompt(“Input Name: “);
Greenfoot.ask(“Input Name: “); (*)
Actor.prompt(“Input Name: “);
Greenfoot.getUserName();
[Incorrect] Incorrect. Refer to Section 3 Lesson 7.
47. In Greenfoot, methods can be called in the act method. When the Act button is clicked in
the environment, the methods in the method body of the act method are executed. True or
false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
48. In Greenfoot, the body of the method is located in between which of the following
characters? Mark for Review
(1) Points
Square brackets [ ]
Curly brackets { } (*)
Asterisks **
Parnetheses ( )
[Correct] Correct
49. A variable is also known as a ____________. Mark for Review
(1) Points
Field (*)
Class
Method
Instance
Syntax
[Correct] Correct
50. In Greenfoot, the instance has a source code editor. True or false? Mark for Review
(1) Points
True
False (*)
1. From your Alice lessons, variables are fixed and cannot be changed. True or false? Mark
for Review
(1) Points
True
False (*)
Correct Correct
2. Which of the following is not an Alice variable value type? Mark for Review
(1) Points
Whole Number
Color
Decimal Number
Function (*)
Incorrect Incorrect. Refer to Section 2 Lesson 10.
3. In Alice, when using the getDistanceTo function what menu option would you use to
subtract a set value from the distance? Mark for Review
(1) Points
Whole to decimal number
Custom DecimalNumber
Random
Math (*)
Correct Correct
4. Rings will appear around a sub-part indicating how you can reposition it. True or false?
Mark for Review
(1) Points
True (*)
False
Correct Correct
5. You have a Class representing Cat. A cat can meow, purr, catch mice, and so on. When
you create a new cat, what is it called? Mark for Review
(1) Points
A variable class
A subclass
A subprogram
An instance (*)
A submethod
Correct Correct
6. Which of the following statements about methods is false? Mark for Review
(1) Points
Methods whose return type is not void are required to include a return statement specifying
what to return.
The order in which methods are listed within the class is not important.
Java does not permit nesting one method definition within another method’s definition.
Classes must be defined directly within a method definition. (*)
Correct Correct
7. An event is any action initiated by the user that is designed to influence the program?s
execution during play. Mark for Review
(1) Points
True (*)
False
Correct Correct
8. From your Alice lessons, complete the following sentence: When coded, an event triggers
a ___________. Mark for Review
(1) Points
Procedure (*)
Infinite loop
Gallery
Scene
Correct Correct
9. In Alice, the computer specifies the low and high range values for the range of numbers
from which to pull a randomized number. True or false? Mark for Review
(1) Points
True
False (*)
Correct Correct
10. Which button is selected in the Alice file menu to save a different version of an
animation? Mark for Review
(1) Points
Save As… (*)
Open
File
New
Correct Correct11. When you disable a programming instruction, it is still executed when you
run the Alice animation. True or false? Mark for Review
(1) Points
True
False (*)
Correct Correct
12. Defining the scenario, and the Alice animation to represent the scenario, is the first step
to programming your animation. True or false? Mark for Review
(1) Points
True (*)
False
Correct Correct
13. What does a visual storyboard help the reader understand? Mark for Review
(1) Points
(Choose all correct answers)
How the initial scene will be set up. (*)
The code that is debugged.
The components of the scene. (*)
The actions that will take place. (*)
Correct Correct
14. From your Alice lessons, inheritance means that the superclass inherits its traits from the
subclass. True or false? Mark for Review
(1) Points
True
False (*)
Correct Correct
15. A conditional loop is a loop that will continue forever. True or false? Mark for Review
(1) Points
True
False (*)
Correct Correct
16. From your Alice lessons, the “Checklist for Animation Completion” does not ask
questions about the scenario and storyboards, because these are not valid parts of the
animation creation process. True or false? Mark for Review
(1) Points
True
False (*)
Correct Correct
17. In Alice, what are the forms of a scenario? Mark for Review
(1) Points
(Choose all correct answers)
A problem to solve. (*)
A section of code to write.
A person to help.
A task to perform. (*)
A system to start.
Correct Correct
18. Alice uses built-in math operators; they are: Mark for Review
(1) Points
Add and subtract
Multiply and divide
All of the above (*)
None of the above
Correct Correct
19. Alice uses built-in math operators. They are: Mark for Review
(1) Points
Add
Subtract
Multiply
Divide
All of the above (*)
Correct Correct
20. If the value already exists in the variable it is overwritten by the assignment operator (=).
True or false? Mark for Review
(1) Points
True (*)
False
Correct Correct21. A data type defines the type of procedures a variable can store. True or
false? Mark for Review
(1) Points
True
False (*)
Correct Correct
22. In Alice, which procedure is used to assign one object as the vehicle of another? Mark
for Review
(1) Points
Vehicle
setObjectVehicle
setClassVehicle
setVehicle (*)
Correct Correct
23. In Alice, Do In Order and Do Together: Mark for Review
(1) Points
Are move statements
Are control statements (*)
Are complex statements
None of the above
Correct Correct
24. Which of the following actions would require a control statement to control animation
timing? Mark for Review
(1) Points
(Choose all correct answers)
A biped object walking. (*)
A rock object turning.
A bird flying. (*)
A fish swimming. (*)
Incorrect Incorrect. Refer to Section 2 Lesson 6.
Section 3
(Answer all questions in this section)
25. Using the Greenfoot IDE, when is a constructor automatically executed? Mark for
Review
(1) Points
When source code is written.
When the act method is executed.
When a new image is added to the class.
When a new instance of the class is created. (*)
Correct Correct
26. In Greenfoot, the == operator is used to test if two values are equal. True or false? Mark
for Review
(1) Points
True (*)
False
Correct Correct
27. In Greenfoot, which method is used to add a new instance to a scenario when the world
is initialized? Mark for Review
(1) Points
addWorld
addInstance
addObject (*)
addClass
Incorrect Incorrect. Refer to Section 3 Lesson 8.
28. In Greenfoot, defined methods must be used immediately. True or false? Mark for
Review
(1) Points
True
False (*)
Correct Correct
29. From your Greenfoot lessons, how do you call a defined method? Mark for Review
(1) Points
Write the method in the documentation.
Write the method in the instance.
Write the method in the Actor class.
Call the method from the act method. (*)
Write the method in the World superclass.
Correct Correct
30. From your Greenfoot lessons, what types of values cannot be stored in a local variable?
Mark for Review
(1) Points
(Choose all correct answers)
method (*)
World name
Class name
Integers
Objects
Incorrect Incorrect. Refer to Section 3 Lesson 10.
31. In Greenfoot, what is a common letter used for the loop variable? Mark for Review
(1) Points
X
A
Y
I (*)
Incorrect Incorrect. Refer to Section 3 Lesson 10.
32. In Greenfoot, a local variable is declared at the beginning of a class. True or false? Mark
for Review
(1) Points
True
False (*)
Correct Correct
33. Which of the following Greenfoot logic operators represents “not”? Mark for Review
(1) Points
! (*)
=
&
&&
Correct Correct
34. From your Greenfoot lessons, in an if-statement, the programming statements written in
curly brackets are executed simultaneously. True or false? Mark for Review
(1) Points
True
False (*)
Incorrect Incorrect. Refer to Section 3 Lesson 3.
35. In Greenfoot, which of the following methods return the world that the instance lives in?
Mark for Review
(1) Points
getXY()
World getWorld() (*)
getRotation()
World getClass()
Correct Correct
36. From your Greenfoot lessons, which type of constructor can be used to automate
creation of Actor instances? Mark for Review
(1) Points
World (*)
Animal
Actor
Vector
Correct Correct
37. In Greenfoot, you can use comparison operators to compare a variable to a random
number. True or false? Mark for Review
(1) Points
True (*)
False
Correct Correct
38. From your Greenfoot lessons, classes can only use the methods they have inherited.
They cannot use methods from other classes. True or false? Mark for Review
(1) Points
True
False (*)
Correct Correct
39. When a Greenfoot code segment is executed in an if-statement, each line of code is
executed in sequential order. True or false? Mark for Review
(1) Points
True (*)
False
Correct Correct
40. You cannot record unique sounds in Greenfoot. You can only use the sounds that are
stored in the Greenfoot library. True or false? Mark for Review
(1) Points
True
False (*)
Incorrect Incorrect. Refer to Section 3 Less
41. What type of parameter does the keyDown method expect? Mark for Review
(1) Points
The password that will protect the class.
The name of the sound file to play when the key is pressed.
The name of the class that will use the key.
The name of the key to press on the keyboard. (*)
Correct Correct
42. In Greenfoot modifying an actors constructor to accept an initial speed is a form of
abstraction? Mark for Review
(1) Points
True (*)
False
Correct Correct
43. In Greenfoot, the move method expects what type of information in its parameters? Mark
for Review
(1) Points
String statement
Integer of steps to move forward (*)
Degrees to turn
True or false response
Correct Correct
44. In Greenfoot, which of the following options are not possible when associating an image
file with an instance? Mark for Review
(1) Points
Import an image
Draw an image
Select an image from the Greenfoot library
Add a video (*)
Correct Correct
45. In Greenfoot, the turn method expects what type of information in its parameters? Mark
for Review
(1) Points
Degrees to turn (*)
Integer of steps to move forward
Parameter void
True or false response
String statement
Incorrect Incorrect. Refer to Section 3 Lesson 2.
46. In Greenfoot, methods can be called in the act method. When the Act button is clicked in
the environment, the methods in the method body of the act method are executed. True or
false? Mark for Review
(1) Points
True (*)
False
Correct Correct
47. In Greenfoot to create a new instance of a class, you right-click on the class, then select
which of the following commands in the class menu? Mark for Review
(1) Points
Inspect Duke()
Set image…
New subclass…
new Duke() (*)
Remove Duke()
Incorrect Incorrect. Refer to Section 3 Lesson 1.
48. In Greenfoot, a subclass is created by right-clicking on a superclass. True or false? Mark
for Review
(1) Points
True (*)
False
Correct Correct
49. When designing a game in Greenfoot, it helps to define the actions that will take place in
a textual storyboard. True or false? Mark for Review
(1) Points
True (*)
False
Correct Correct
50. In object oriented programming, programmers analyze a problem and create objects to
solve the problem. True or false? Mark for Review
(1) Points
True (*)
False
Correct Correct
1. Which of the following elements of the Alice animation should be tested before the
animation is considered complete? Mark for Review
(1) Points
Math calculations operate as expected.
Objects move with smooth timing.
Comments are added to each sequence of instructions.
Control statements are operating as expected.
All of the above. (*)
[Correct] Correct
2. What should you refer to for the animation’s design specifications as you program your
Alice animation? Mark for Review
(1) Points
Storyboard (*)
Scenario
Code
Scene editor
[Correct] Correct
3. In Alice, you examine code where a bird moves its wings forward and backward while
moving forward simultaneously across the scene. You notice that this set of procedures are
repeated in the Code editor ten times to achieve this motion. How could procedural
abstraction be used to make the code simpler and easier to read? Mark for Review
(1) Points
(Choose all correct answers)
Use the Scene editor to position the wings so that they are up as the body moves forward.
Do not make any changes to the code.
Declare a separate “fly” procedure for the body moving forward and wings moving up and
down. (*)
Use the Count control statement to execute the forward motion of the body and up and down
motion of the wings 10 times. (*)
[Correct] Correct
4. Breaking down a problem or process into smaller parts makes it easier to manage. True
or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
5. In Alice, declaring a new procedure to shorten code and make it easier to read is a
procedural abstraction technique. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
6. From your Alice lessons, what does the Count control statement do? Mark for Review
(1) Points
Executes statements while a condition is true.
Executes statements a specific number of times. (*)
Executes statements a random number of times.
Executes statements simultaneously.
[Correct] Correct
7. Alice 3 will periodically remind you to save your project. True or false? Mark for Review
(1) Points
True
False (*)
[Correct] Correct
8. In Alice it is not possible to transfer a class from one animation to another. True or false?
Mark for Review
(1) Points
True
False (*)
[Correct] Correct
9. In Alice, what tab would you choose to start a new animation with a pre-populated world?
Mark for Review
(1) Points
Blank Slate
Recent
Starters (*)
My Projects
[Correct] Correct
10. A data type defines the type of procedures a variable can store. True or false? Mark for
Review
(1) Points
True
False (*)
[Correct] Correct
11. Which of the following does not describe variables? Mark for Review
(1) Points
Arranged in rows and columns. (*)
A place in memory where data of a specific type can be stored for later retrieval and use.
Has a unique name.
Has a type associated with it.
[Correct] Correct
12. One type of object property is an object’s position in the scene. True or false? Mark for
Review
(1) Points
True (*)
False
[Incorrect] Incorrect. Refer to Section 2 Lesson 2.
13. You want a block of code to be executed only once if certain conditions are met. What
type of Java construct would you use? Mark for Review
(1) Points
boolean
if (*)
array
while loop
[Incorrect] Incorrect. Refer to Section 2 Lesson 14.
14. Which of the following is not an example of the logic of an IF control structure? Mark for
Review
(1) Points
Play the video three times. (*)
If the doorbell rings, then the door opens.
If the play button is pressed, then play the video one time.
If the bird rings the bell, a treat is dispensed.
[Correct] Correct
15. In Alice, what function would you use to get a wholenumber from the user? Mark for
Review
(1) Points
getStringFromUser
getIntegerFromUser (*)
getDoubleFromUser
getBooleanFromUser
[Incorrect] Incorrect. Refer to Section 2 Lesson 7.
16. In Alice, which procedure is used to assign one object as the vehicle of another? Mark
for Review
(1) Points
setVehicle (*)
setObjectVehicle
setClassVehicle
Vehicle
[Correct] Correct
17. In Alice, the procedures’ arguments allow the programmer to adjust the object, motion,
distance amount, and time duration. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
18. In Alice, the setVehicle procedure will associate one object to another. True or false?
Mark for Review
(1) Points
True (*)
False
[Correct] Correct
19. Variable values can be changed as often as you like. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
20. In Alice, you can access the Java on the side option through which menu option? Mark
for Review
(1) Points
Edit
Project
Window (*)
Run
[Correct] Correct
21. Alice uses built-in math operators. They are: Mark for Review
(1) Points
Add
Subtract
Multiply
Divide
All of the above (*)
[Correct] Correct
22. In Alice, which of the following programming statements moves the alien backward the
distance to the asteroid, minus 2 meters? Mark for Review
(1) Points
this.Asteroid move backward {this.Alien getDistanceTo this.Asteorid / 2}
this.Alien move forward {this.Asteroid getDistanceTo this.Alien / 2}
this.Alien move backward {this.Alien getDistanceTo this.Asteroid -2} (*)
this.Alien move backward {this.Alien getDistanceTo this.Asteroid * 2}
[Correct] Correct
23. A conditional loop is a loop that will continue forever. True or false? Mark for Review
(1) Points
True
False (*)
[Correct] Correct
24. Programming comments do not affect the functionality of your Alice animation. True or
false? Mark for Review
(1) Points
True (*)
False
[Incorrect] Incorrect. Refer to Section 2 Lesson 3.
Section 3
(Answer all questions in this section)
25. In Greenfoot, a way to have all subclasses of a superclass inherit a method is by adding
the method to the superclass. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
26. In Greenfoot, defined methods must be used immediately. True or false? Mark for
Review
(1) Points
True
False (*)
[Correct] Correct
27. In Greenfoot, which method is used to add a new instance to a scenario when the world
is initialized? Mark for Review
(1) Points
addClass
addWorld
addInstance
addObject (*)
[Correct] Correct
28. Which of the following Greenfoot programming statements creates a new instance of
Bee and places it at x = 140, y = 130 in the world? Mark for Review
(1) Points
new(Bee( ) 140, 130);
addObject(new( ), 140, 130);
new(addObject(Bee ), 140, 130);
addObject(new Bee( ), 140, 130); (*)
[Correct] Correct
29. Using the Greenfoot IDE, when is a constructor automatically executed? Mark for
Review
(1) Points
When a new instance of the class is created. (*)
When source code is written.
When the act method is executed.
When a new image is added to the class.
[Correct] Correct
30. In object oriented programming, programmers analyze a problem and create objects to
solve the problem. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
31. Which of the following is an incorrectly written programming statement? Mark for Review
(1) Points
move(): (*)
move(2);
turn(25);
turn(2);
[Correct] Correct
32. Which of the following is not a component of a while loop? Mark for Review
(1) Points
while keyword
if statement (*)
Loop variable
Local variable
Control operator
[Incorrect] Incorrect. Refer to Section 3 Lesson 10.
33. From your Greenfoot lessons, which of the following logic operators represents “and”?
Mark for Review
(1) Points
&
&& (*)
=
!
[Correct] Correct
34. Use your Greenfoot knowledge: An array object holds a single variable. True or false?
Mark for Review
(1) Points
True
False (*)
[Correct] Correct
35. From your Greenfoot lessons, what is a loop? Mark for Review
(1) Points
A statement that executes one segment of code.
A statement that can execute a section of code multiple times. (*)
A statement that can execute a method multiple times.
A statement that can execute a section of code one time.
[Correct] Correct
36. In Greenfoot to get the users name you could use: Mark for Review
(1) Points
Greenfoot.getUserName();
Actor.prompt(“Input Name: “);
Greenfoot.ask(“Input Name: “); (*)
Greenfoot.prompt(“Input Name: “);
[Correct] Correct
37. In Greenfoot you can interact with the scenario using a mouse. Mark for Review
(1) Points
True (*)
False
[Correct] Correct
38. In a Greenfoot if-statement, the programming statements that the if-statement executes
are written in curly brackets. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
39. In Greenfoot, a method with what kind of return type is used to learn more about an
object’s orientation? Mark for Review
(1) Points
non-void return type (*)
void return type
method return type
object return type
[Correct] Correct
40. In Greenfoot, you can use comparison operators to compare a variable to a random
number. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
41. From your Greenfoot lessons, when does an if-else statement execute it’s second code
segment? Mark for Review
(1) Points
After the first code segment is executed.
If a condition is true.
If a condition is false. (*)
When an instance is created.
When a random number is less than 10.
[Incorrect] Incorrect. Refer to Section 3 Lesson 5.
42. The first step to executing an if-else statement is to:____________. Mark for Review
(1) Points
Evaluate the condition (*)
Evaluate the class
Execute the if statement
Execute the else statement
[Correct] Correct
43. An if-else statement executes its first code block if a condition is true, and its second
code block if a condition is false, but not both. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
44. A subclass has what kind of relationship to a superclass? Mark for Review
(1) Points
“is-by”
“is-a” (*)
“a-is”
“for-what”
[Correct] Correct
45. In Greenfoot, after a subclass is created, what has to occur before instances can be
added to the scenario? Mark for Review
(1) Points
Creation of source code
Creation of an instance
Compilation (*)
Editing of source code
[Correct] Correct
46. In Greenfoot, which of the following options are not possible when associating an image
file with an instance? Mark for Review
(1) Points
Select an image from the Greenfoot library
Import an image
Add a video (*)
Draw an image
[Correct] Correct
47. In the Greenfoot IDE, an instance’s position is on the x and y coordinates. True or false?
Mark for Review
(1) Points
True (*)
False
[Correct] Correct
48. In Greenfoot, the move method expects what type of information in its parameters? Mark
for Review
(1) Points
String statement
Degrees to turn
Integer of steps to move forward (*)
True or false response
[Correct] Correct
49. Using the Greenfoot IDE, only five instances can be added to a scenario. True or false?
Mark for Review
(1) Points
True
False (*)
[Correct] Correct
50. Abstraction occurs in many different ways in programming. True or false? Mark for
Review
(1) Points
True (*)
False
[Correct] Correct
1. To save a class to the myClasses directory you do so at the ________ level. Mark for
Review
(1) Points
eventListener
object
Scene
Class (*)
Incorrect Incorrect. Refer to Section 2 Lesson 11.
2. Which one of the following event listener types is not available at the top-level of the
addEvent drop down list in Alice? Mark for Review
(1) Points
Position/Orientation
Mouse
Collision (*)
Keyboard
Correct Correct
3. In Alice, the computer specifies the low and high range values for the range of numbers
from which to pull a randomized number. True or false? Mark for Review
(1) Points
True
False (*)
Correct Correct
4. In Alice, where you would you get access to the specific joints of an object that are not
available through the object drop down menu? Mark for Review
(1) Points
code editor
functions tab (*)
procedures tab
scene editor
Correct Correct
5. In Alice, Do In Order and Do Together: Mark for Review
(1) Points
Are move statements
Are control statements (*)
Are complex statements
None of the above
Correct Correct
6. In Alice, a computer program requires functions to tell it how to perform the procedure.
True or false? Mark for Review
(1) Points
True
False (*)
Correct Correct
7. In Alice, which of the following is not a control statement? Mark for Review
(1) Points
Move (*)
Count
While
Do In Order
Correct Correct
8. A data type defines the type of procedures a variable can store. True or false? Mark for
Review
(1) Points
True
False (*)
Correct Correct
9. In Java, which symbol is used to assign one value to another? Mark for Review
(1) Points
//
>
<
= (*)
Correct Correct
10. To add a procedure to myFirstMethod, right-click on the procedure you wish to add and
select the Add button. True or false? Mark for Review
(1) Points
True
False (*)
Incorrect Incorrect. Refer to Section 2 Lesson 3.
11. How do you create a programming instruction in Alice? Mark for Review
(1) Points
Click and drag the desired programming instruction into the Functions tab.
Click and drag the desired programming instruction into the Procedures tab.
Click and drag the desired programming instruction into the Scene editor.
Click and drag the desired programming instruction into the myFirstMethod tab. (*)
Incorrect Incorrect. Refer to Section 2 Lesson 1.
12. Alice uses built-in math operators. They are: Mark for Review
(1) Points
Add
Subtract
Multiply
Divide
All of the above (*)
Correct Correct
13. In Alice, which of the following programming statements moves the alien backward the
distance to the asteroid, minus 2 meters? Mark for Review
(1) Points
this.Asteroid move backward {this.Alien getDistanceTo this.Asteorid / 2}
this.Alien move backward {this.Alien getDistanceTo this.Asteroid -2} (*)
this.Alien move forward {this.Asteroid getDistanceTo this.Alien / 2}
this.Alien move backward {this.Alien getDistanceTo this.Asteroid * 2}
Correct Correct
14. Which of the following is not an Alice variable value type? Mark for Review
(1) Points
Whole Number
Color
Decimal Number
Function (*)
Correct Correct
15. Which of the following programming instructions commands the fish to continuously
move forward a random speed between 0.5 and 1.0 meters, minus 0.25 meters, until it
collides with the shark? Mark for Review
(1) Points
(*)
Correct Correct
16. When presenting your Alice animation, ensure that your presentation is thoroughly tested
and complete. True or false? Mark for Review
(1) Points
True (*)
False
Correct Correct
17. Which of the following are examples of elements you would test in your Alice animation?
Mark for Review
(1) Points
(Choose all correct answers)
Objects move with smooth timing. (*)
Event listeners trigger the correct responses. (*)
Math expressions calculate as expected. (*)
All of the procedures display in alphabetical order in the Procedures tab.
Incorrect Incorrect. Refer to Section 2 Lesson 12.
18. Only acting objects have one-shot procedures. True or false? Mark for Review
(1) Points
True
False (*)
Correct Correct
19. In Alice, the use of conditional control structures allows what two types of loops? Mark
for Review
(1) Points
(Choose all correct answers)
together
switch
infinite
conditional (*)
Correct Correct
20. In Alice, which of the following is the most likely situation where procedural abstraction
could be used? Mark for Review
(1) Points
One person moves up 10 meters.
Five dogs all need to bark and run at the same time. (*)
Two fish say something to each other.
One fish needs to swim forward 1 meter.
Incorrect Incorrect. Refer to Section 2 Lesson 5.
21. In Alice, new procedures are declared in the Scene editor. True or false? Mark for
Review
(1) Points
True
False (*)
Correct Correct
22. Before you can begin to develop the animation storyboard, what must be defined? Mark
for Review
(1) Points
The debugging process
The code
The scenario (*)
The control statements
Correct Correct
23. Main is an example of what in the following code?
public static void main (String[] args) {
System.out.println{“Hello World!”);
} Mark for Review
(1) Points
A method (*)
An instance
A class
A variable
Correct Correct
24. The condition in a WHILE loop is a boolean expression. True or false? Mark for Review
(1) Points
True (*)
False
Correct Correct
Section 3
(Answer all questions in this section)
25. In Greenfoot, a method with what kind of return type is used to learn more about an
object’s orientation? Mark for Review
(1) Points
object return type
non-void return type (*)
void return type
method return type
Incorrect Incorrect. Refer to Section 3 Lesson 3.
26. From your Greenfoot lessons, in an if-statement, the programming statements written in
curly brackets are executed simultaneously. True or false? Mark for Review
(1) Points
True
False (*)
Correct Correct
27. From your Greenfoot lessons, the reset button resets the scenario back to its initial
position. True or false? Mark for Review
(1) Points
True (*)
False
Correct Correct
28. In Greenfoot, you must first create an instance before you create a class. True or false?
Mark for Review
(1) Points
True
False (*)
Correct Correct
29. In Greenfoot, the sound file must be saved in the scenario and written in the source code
for it to play. True or false? Mark for Review
(1) Points
True (*)
False
Correct Correct
30. In Greenfoot to get the users name you could use: Mark for Review
(1) Points
Greenfoot.getUserName();
Actor.prompt(“Input Name: “);
Greenfoot.ask(“Input Name: “); (*)
Greenfoot.prompt(“Input Name: “);
Correct Correct
31. Which of the following features of Greenfoot will locate syntax errors in your program?
Mark for Review
(1) Points
Instance creation
Documentation
Compilation (*)
Code editor
Correct Correct
32. In Greenfoot, you will not receive an error message if your code is incorrect. It will simply
not work, and you will have to determine why the code doesn’t work. True or false? Mark for
Review
(1) Points
True
False (*)
Correct Correct
33. In Greenfoot, which method is used to end a game? Mark for Review
(1) Points
Game.stop(1);
Duke.stop( );
Class.stop( );
Greenfoot.stop( ); (*)
Incorrect Incorrect. Refer to Section 3 Lesson 8.
34. Which class holds the method that ends a Greenfoot game? Mark for Review
(1) Points
Class
GreenfootImage
Greenfoot (*)
Actor
Correct Correct
35. Use your Greenfoot knowledge to answer the question: Where are defined variables
typically entered in a class’s source code? Mark for Review
(1) Points
Between the constructors and methods in the source code.
At the top of the source code, before the constructors and methods. (*)
In the defined method in the source code.
After the constructors and methods in the source code.
Correct Correct
36. A collision in Greenfoot is when two actors make contact? Mark for Review
(1) Points
True (*)
False
Correct Correct
37. Which one of the following can be used to detect when 2 actors collide? Mark for Review
(1) Points
isCollision()
isContact()
isTouching() (*)
hasCollided()
Correct Correct
38. In Greenfoot you can only access the methods of the current class? Mark for Review
(1) Points
True
False (*)
Correct Correct
39. In Greenfoot, the origin of the world coordinate system (0,0) starts in the center of the
world. True or false? Mark for Review
(1) Points
True
False (*)
Incorrect Incorrect. Refer to Section 3 Lesson 5.
40. From your Greenfoot lessons, dot notation allows you to use a method from a different
class, if the class you are programming does not possess the method. True or false? Mark
for Review
(1) Points
True (*)
False
Correct Correct
41. In Greenfoot, which keyword calls the World superclass? Mark for Review
(1) Points
constructor
addObject
super (*)
new
world
Incorrect Incorrect. Refer to Section 3 Lesson 5.
42. Read the following method signature. Using your Greenfoot experience, what does this
method do?
public static int getRandomNumber (int limit) Mark for Review
(1) Points
Returns a random coordinate position in the world.
Returns a random number less than 10.
Returns a random number for instances in the animal class only.
Returns a random number between zero and the parameter limit. (*)
Correct Correct
43. In Greenfoot, the body of the method is located in between which of the following
characters? Mark for Review
(1) Points
Curly brackets { } (*)
Parnetheses ( )
Asterisks **
Square brackets [ ]
Correct Correct
44. In Greenfoot, the instance has a source code editor. True or false? Mark for Review
(1) Points
True
False (*)
Correct Correct
45. A variable is also known as a ____________. Mark for Review
(1) Points
Method
Field (*)
Syntax
Instance
Class
Correct Correct
46. In Greenfoot, which of the following options are not possible when associating an image
file with an instance? Mark for Review
(1) Points
Import an image
Add a video (*)
Draw an image
Select an image from the Greenfoot library
Correct Correct
47. From your Greenfoot lessons, what types of values cannot be stored in a local variable?
Mark for Review
(1) Points
(Choose all correct answers)
Class name
Objects
World name
Integers
method (*)
Correct Correct
48. Which of the following Greenfoot logic operators represents “not”? Mark for Review
(1) Points
! (*)
=
&&
&
Correct Correct
49. In Greenfoot, what is a common letter used for the loop variable? Mark for Review
(1) Points
I (*)
Y
X
A
Correct Correct
50. From your Greenfoot lessons, which symbol represents string concatenation? Mark for
Review
(1) Points
Symbol + (*)
Symbol &
Symbol <
Symbol =
Incorrect Incorrect. Refer to Section 3 Lesson 10.
1. In Alice, what are the forms of a scenario? Mark for Review
(1) Points
(Choose all correct answers)
A task to perform. (*)
A system to start.
A person to help.
A section of code to write.
A problem to solve. (*)
[Correct] Correct
2. In Alice, declaring a new procedure to shorten code and make it easier to read is a
procedural abstraction technique. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
3. From your Alice lessons, which of the following is a tool to show the logic of an animation?
Mark for Review
(1) Points
Scene editor
Pie chart
Visual storyboard
Flowchart (*)
Class chart
[Incorrect] Incorrect. Refer to Section 2 Lesson 5.
4. The list below displays valid primitive types in Java, except which one? Mark for Review
(1) Points
String (*)
int
double
long
boolean
[Correct] Correct
5. A typical application uses various values and these values continuously change while the
program is running. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
Page 1 of 10
6. All objects in Alice have three dimensional coordinates on which axes? Mark for Review
(1) Points
(Choose all correct answers)
x (*)
y (*)
z (*)
w
All of the above
[Correct] Correct
7. From your Alice lessons, built-in functions provide precise property details for the following
areas: Mark for Review
(1) Points
Proximity and point of view.
Proximity, size, spatial relation, and point of view. (*)
Proximity and size.
Distance to and nesting.
[Correct] Correct
8. In Alice, it is not possible to upload the animation directly to YouTube. Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 2 Lesson 12.
9. When presenting your Alice animation, it is not important to give the audience a reason to
listen to the presentation. True or false? Mark for Review
(1) Points
True
False (*)
[Correct] Correct
10. The initializer of a variable with a TextString value type could be (select all that apply):
Mark for Review
(1) Points
(Choose all correct answers)
“Greetings” (*)
“Howdy” (*)
“4” (*)
None of the above.
[Correct] Correct
Page 2 of 10
11. Which of the following is not an Alice variable value type? Mark for Review
(1) Points
Function (*)
Whole Number
Color
Decimal Number
[Incorrect] Incorrect. Refer to Section 2 Lesson 10.
12. Which one of the following event listener types is not available at the top-level of the
addEvent drop down list in Alice? Mark for Review
(1) Points
Mouse
Collision (*)
Keyboard
Position/Orientation
[Correct] Correct
13. An event is any action initiated by the user that is designed to influence the program?s
execution during play. Mark for Review
(1) Points
True (*)
False
[Correct] Correct
14. After objects are positioned in the scene, it is wise to save multiple versions of the
project, giving each version the same name. True or false? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 2 Lesson 1.
15. Which of the following would not be an argument in an Alice programming instruction
that commands a person object to move forward 2 meters? Mark for Review
(1) Points
Person’s height (*)
Direction to move
Distance to move forward
Number of seconds to execute the programming instruction
[Incorrect] Incorrect. Refer to Section 2 Lesson 3.
Page 3 of 10
16. The condition in a WHILE loop is a boolean expression. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
17. If you want one message to display if a user is below the age of 18 and a different
message to display if the user is 18 or older, what type of construct would you use? Mark for
Review
(1) Points
if (*)
for all loop
do loop
while loop
[Correct] Correct
18. In Alice, which of the following is not a control statement? Mark for Review
(1) Points
While
Count
Move (*)
Do In Order
[Correct] Correct
19. In Alice, the setVehicle procedure will associate one object to another. True or false?
Mark for Review
(1) Points
True (*)
False
[Correct] Correct
20. In Alice, a walking motion for a bipedal object can be achieved without the Do Together
control statement. True or false? Mark for Review
(1) Points
True
False (*)
[Correct] Correct
21. In Alice, which of the following programming statements moves the butterfly forward,
double the distance to the tree? Mark for Review
(1) Points
this.Butterfly move forward {this.Butterfly getDistanceTo this.Tree * 2} (*)
this.Butterfly move backward {this.Butterfly getDistanceTo this.Tree * 2}
this.Butterfly move forward {this.Butterfly getDistanceTo this.Tree / 2}
this.Butterfly move backward {this.Butterfly getDistanceTo this.Tree / 2}
[Correct] Correct
22. Identify an example of an Alice expression. Mark for Review
(1) Points
“Hello World.”
IF or WHILE
12 + 15 = 27 (*)
None of the above
[Correct] Correct
23. In Alice, control statements are dragged into the Code editor. True or false? Mark for
Review
(1) Points
True (*)
False
[Correct] Correct
24. Which of the following IF control structures command the blue tang fish to roll and
simultaneously move down if it collides with a shark, or move forward if it does not collide
with a shark? Mark for Review
(1) Points
 
 
(*)
[Incorrect] Incorrect. Refer to Section 2 Lesson 8.
Section 3
(Answer all questions in this section)
25. When designing a game in Greenfoot, it helps to define the actions that will take place in
a textual storyboard. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
26. In object oriented programming, programmers analyze a problem and create objects to
solve the problem. True or false? Mark for Review
(1) Points
True (*)
False
[Incorrect] Incorrect. Refer to Section 3 Lesson 4.
27. In Greenfoot, defined methods must be used immediately. True or false? Mark for
Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 6.
28. In Greenfoot, which of the following statement is true about Defined Methods? Mark for
Review
(1) Points
A defined method is only relevant to the Greenfoot Development team.
A defined method only relates to the World class.
A defined method is automatically executed once created.
A defined method must be called by your source code, normally in the Act method. (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 6.
29. In the Greenfoot IDE, an instance’s position is on the x and y coordinates. True or false?
Mark for Review
(1) Points
True (*)
False
[Correct] Correct
30. In Greenfoot, the turn method expects what type of information in its parameters? Mark
for Review
(1) Points
Integer of steps to move forward
Parameter void
True or false response
Degrees to turn (*)
String statement
[Correct] Correct
31. In Greenfoot, which of the following options are not possible when associating an image
file with an instance? Mark for Review
(1) Points
Import an image
Draw an image
Add a video (*)
Select an image from the Greenfoot library
[Correct] Correct
32. In Greenfoot, the body of the method is located in between which of the following
characters? Mark for Review
(1) Points
Parnetheses ( )
Asterisks **
Curly brackets { } (*)
Square brackets [ ]
[Correct] Correct
33. In Greenfoot, a method with what kind of return type is used to learn more about an
object’s orientation? Mark for Review
(1) Points
void return type
method return type
non-void return type (*)
object return type
[Incorrect] Incorrect. Refer to Section 3 Lesson 3.
34. From your Greenfoot lessons, where do you review a class’s inherited methods? Mark
for Review
(1) Points
Act method
Documentation (*)
If-statement
Inspector
[Correct] Correct
35. In Greenfoot, a local variable is declared at the beginning of a class. True or false? Mark
for Review
(1) Points
True
False (*)
[Correct] Correct
36. In Greenfoot, what type of symbol is used to connect boolean expressions? Mark for
Review
(1) Points
Logic operators (*)
String concatenation
Integers
Keyboard key names
[Correct] Correct
37. From your Greenfoot lessons, when do infinite loops occur? Mark for Review
(1) Points
When the loop is executed.
When the end to the act method isn’t established.
Only in while loops.
When the end to the code isn’t established. (*)
[Correct] Correct
38. How would the following sentence be written in Greenfoot source code? If Bee is turning,
and the keyboard key “d” is down… Mark for Review
(1) Points
if (isTurning && Greenfoot.isKeyDown(“d”) ) (*)
if (!isTurning && Greenfoot.isKeyDown(“d”) )
if (&&isTurning ! Greenfoot.isKeyDown(“d”) )
if (!Greenfoot.isKeyDown && isTurning(“d”) )
[Correct] Correct
39. Writing more generic statements to handle the creation and positioning of many objects
is one Abstraction technique? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
40. In Greenfoot the showText() method belongs to which class? Mark for Review
(1) Points
Greenfoot
There is no such method.
World (*)
Actor
[Correct] Correct
Page 8 of 10
41. In Greenfoot, what is the purpose of the variable type? Mark for Review
(1) Points
Defines which class the variable is associated with.
Defines the instance that the variable is associated with.
Defines what kind of data to store in the variable. (*)
Defines the access specifier used with the variable.
[Correct] Correct
42. Where can we review the available classes and methods in Greenfoot, including the stop
method? Mark for Review
(1) Points
Class menu
Class Application Programmers’ Interface (API)
Greenfoot Application Programmers’ Interface (API) (*)
Object menu
[Incorrect] Incorrect. Refer to Section 3 Lesson 8.
43. A subclass has what kind of relationship to a superclass? Mark for Review
(1) Points
“is-by”
“for-what”
“a-is”
“is-a” (*)
[Correct] Correct
44. In Greenfoot, a subclass is created by right-clicking on a superclass. True or false? Mark
for Review
(1) Points
True (*)
False
[Correct] Correct
45. In Greenfoot, what type of parameter does the isKeyDown method expect? Mark for
Review
(1) Points
Integer
String (*)
Boolean
Method
[Correct] Correct
Page 9 of 10
46. In Greenfoot, which method would you use to obtain input from the user? Mark for
Review
(1) Points
getInput()
ask() (*)
getText()
input()
[Incorrect] Incorrect. Refer to Section 3 Lesson 7.
47. From your Greenfoot lessons, dot notation allows you to use a method from a different
class, if the class you are programming does not possess the method. True or false? Mark
for Review
(1) Points
True (*)
False
[Correct] Correct
48. Use you Greenfoot knowledge: What range of numbers does the following method
return?
Greenfoot.getRandomNumber(30) Mark for Review
(1) Points
A random number between 1 and 29.
A random number between 1 and 30.
A random number between 0 and 30.
A random number between 0 and 29. (*)
[Correct] Correct
49. In Greenfoot, which of the following is the correct notation for calling a method for an
instance of a class? Mark for Review
(1) Points
Method-name.object-name;
class-name.method-name(parameters);
object-name.method-name(parameters); (*)
Method-name.object-name(parameters);
[Correct] Correct
50. From your Greenfoot lessons, which type of constructor can be used to automate
creation of Actor instances? Mark for Review
(1) Points
World (*)
Vector
Actor
Animal
[Correct] Correct
Test: Java Fundamentals Midterm Exam
Review your answers, feedback, and question scores below. An asterisk (*) indicates a
correct answer.
Section 2
(Answer all questions in this section)
1. In Alice, control statements are dragged into the Code editor. True or false? Mark for
Review
(1) Points
True (*)
False
[Correct] Correct
2. Which of the following are ways to open an existing Alice project file after launching Alice?
Mark for Review
(1) Points
(Choose all correct answers)
Click and drag the file from your computer into Alice 3.
Browse for the project using the File System tab. (*)
Select the project from the My Projects tab. (*)
Double-click on the project file name in the folder it is stored in on your computer.
[Correct] Correct
3. Copying programming instructions saves time when programming your Alice project. True
or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
4. From your Alice lessons, a textual storyboard provides a detailed, ordered list of the
actions each object performs in each scene of the animation. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
5. From your Alice lessons, when testing your animation, you should test that comments
were added below each sequence of instructions in the code. True or false? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 2 Lesson 12.
Page 1 of 10
Test: Java Fundamentals Midterm Exam
Review your answers, feedback, and question scores below. An asterisk (*) indicates a
correct answer.
Section 2
(Answer all questions in this section)
6. In Alice, which of the following programming statements moves the fish forward, the
distance to the rock, minus the depth of the rock? Mark for Review
(1) Points
this.Fish move forward {this.Rock getDistanceTo this.Fish – this.Fish – 2}
this.Rock move forward {this.Rock getDistanceTo this.Fish – this.Fish – 2}
this.Fish move forward {this.Fish getDistanceTo this.Rock – this.Rock getDepth} (*)
this.Fish move forward {this.Rock getDistanceTo this.Fish – this.Fish getDepth}
[Incorrect] Incorrect. Refer to Section 2 Lesson 9.
7. Identify an example of an Alice expression. Mark for Review
(1) Points
“Hello World.”
IF or WHILE
12 + 15 = 27 (*)
None of the above
[Correct] Correct
8. In Alice, when using the getDistanceTo function what menu option would you use to
subtract a set value from the distance? Mark for Review
(1) Points
Random
Whole to decimal number
Custom DecimalNumber
Math (*)
[Correct] Correct
9. Which of the following actions would require a control statement to control animation
timing? Mark for Review
(1) Points
(Choose all correct answers)
A rock object turning.
A fish swimming. (*)
A biped object walking. (*)
A bird flying. (*)
[Incorrect] Incorrect. Refer to Section 2 Lesson 6.
10. In Alice, which control statement is used to invoke simultaneous movement? Mark for
Review
(1) Points
Do In Order
Variable
Do Together (*)
Count
While
[Incorrect] Incorrect. Refer to Section 2 Lesson 6.
Page 2 of 10
Test: Java Fundamentals Midterm Exam
Review your answers, feedback, and question scores below. An asterisk (*) indicates a
correct answer.
Section 2
(Answer all questions in this section)
11. In Alice, the setVehicle procedure will associate one object to another. True or false?
Mark for Review
(1) Points
True (*)
False
[Correct] Correct
12. You want a block of code to be executed only once if certain conditions are met. What
type of Java construct would you use? Mark for Review
(1) Points
array
while loop
boolean
if (*)
[Correct] Correct
13. Main is an example of what in the following code?
public static void main (String[] args) {
System.out.println{“Hello World!”);
} Mark for Review
(1) Points
A variable
A class
An instance
A method (*)
[Correct] Correct
14. Which of the following is not a valid arithmetic operator in Java? Mark for Review
(1) Points
+
/

*
%
$ (*)
None of the above
[Incorrect] Incorrect. Refer to Section 2 Lesson 13.
15. Which of the following is not a relational operator? Mark for Review
(1) Points
>
<
// (*)
=
[Correct] Correct
Page 3 of 10
Test: Java Fundamentals Midterm Exam
Review your answers, feedback, and question scores below. An asterisk (*) indicates a
correct answer.
Section 2
(Answer all questions in this section)
16. In Alice, which one of the following is not a pre-defined control structure? Mark for
Review
(1) Points
do in order
while
do while (*)
do together
[Incorrect] Incorrect. Refer to Section 2 Lesson 8.
17. In Java code the { } brackets are used to represent what statements? Mark for Review
(1) Points
(Choose all correct answers)
begin (*)
end (*)
while
for
[Correct] Correct
18. Which of the following is not an Alice variable value type? Mark for Review
(1) Points
Decimal Number
Whole Number
Color
Function (*)
[Correct] Correct
19. In Alice, what are the forms of a scenario? Mark for Review
(1) Points
(Choose all correct answers)
A problem to solve. (*)
A task to perform. (*)
A person to help.
A section of code to write.
A system to start.
[Correct] Correct
20. In Alice, new procedures are declared in the Scene editor. True or false? Mark for
Review
(1) Points
True
False (*)
[Correct] Correct
Page 4 of 10
Test: Java Fundamentals Midterm Exam
Review your answers, feedback, and question scores below. An asterisk (*) indicates a
correct answer.
Section 2
(Answer all questions in this section)
21. In Alice, which of the following are benefits of separating out motions into their own
procedures? Mark for Review
(1) Points
(Choose all correct answers)
It makes the animation easier to run.
It makes the scene easier to view.
It can allow subclasses of a superclass to use a procedure. (*)
It simplifies code and makes it easier to read. (*)
It allows many objects of a class to use the same procedure. (*)
[Correct] Correct
22. From your Alice lessons, complete the following sentence: When coded, an event
triggers a ___________. Mark for Review
(1) Points
Gallery
Scene
Procedure (*)
Infinite loop
[Correct] Correct
23. In Alice it is not possible to transfer a class from one animation to another. True or false?
Mark for Review
(1) Points
True
False (*)
[Correct] Correct
24. The comments you enter in Alice should describe the sequence of actions that take
place in the code segment. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
Section 3
(Answer all questions in this section)
25. A subclass has what kind of relationship to a superclass? Mark for Review
(1) Points
“a-is”
“is-by”
“for-what”
“is-a” (*)
[Correct] Correct
Page 5 of 10
Test: Java Fundamentals Midterm Exam
Review your answers, feedback, and question scores below. An asterisk (*) indicates a
correct answer.
Section 3
(Answer all questions in this section)
26. In Greenfoot, what happens to an instance when the Act button is clicked in the
environment? Mark for Review
(1) Points
The class executes all of the programming statements in their instance’s act method two
times until the scenario is stopped.
The instance executes all of the programming statements in their class’s act method once.
(*)
The instance executes all of the programming statements in their class’s act method two
times until the scenario is stopped.
Only one instance moves until the pause button is clicked.
The instance executes all of the programming statements in their class’s act method
repeatedly until the scenario is stopped.
[Incorrect] Incorrect. Refer to Section 3 Lesson 1.
27. In Greenfoot, what is the purpose of the variable type? Mark for Review
(1) Points
Defines the instance that the variable is associated with.
Defines which class the variable is associated with.
Defines what kind of data to store in the variable. (*)
Defines the access specifier used with the variable.
[Incorrect] Incorrect. Refer to Section 3 Lesson 8.
28. In Greenfoot, a defined variable is a variable that is defined in an instance. True or false?
Mark for Review
(1) Points
True
False (*)
[Correct] Correct
29. The GreenfootImage class enables Greenfoot actors to maintain their visible image by
holding an object of type GreenfootImage. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
30. From your Greenfoot lessons, which one of the following is an example of when an
abstraction technique is used? Mark for Review
(1) Points
Initialising a variable
Adding a property to a Class
Adding a property to an instance
Passing a paramater in a constructor to set an initial speed. (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 9.
Page 6 of 10
Test: Java Fundamentals Midterm Exam
Review your answers, feedback, and question scores below. An asterisk (*) indicates a
correct answer.
Section 3
(Answer all questions in this section)
31. In Greenfoot, what happens if the condition is false in an if-statement? Mark for Review
(1) Points
The programming statements are executed.
The programming statements are not executed. (*)
The if-statement is executed.
The act method is deleted.
[Correct] Correct
32. From your Greenfoot lessons, in an if-statement, the programming statements written in
curly brackets are executed simultaneously. True or false? Mark for Review
(1) Points
True
False (*)
[Correct] Correct
33. In Greenfoot, what happens if the end to a while loop isn’t established? Mark for Review
(1) Points
The code will prompt you to enter a loop counter.
The code will keep executing and will never stop. (*)
The code will execute once and then stop, due to controls in Greenfoot.
The code will not execute.
[Correct] Correct
34. How would the following sentence be written in Greenfoot source code? If Bee is turning,
and the keyboard key “d” is down… Mark for Review
(1) Points
if (!isTurning && Greenfoot.isKeyDown(“d”) )
if (&&isTurning ! Greenfoot.isKeyDown(“d”) )
if (!Greenfoot.isKeyDown && isTurning(“d”) )
if (isTurning && Greenfoot.isKeyDown(“d”) ) (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 10.
35. In Greenfoot, what is a common letter used for the loop variable? Mark for Review
(1) Points
A
X
Y
I (*)
[Correct] Correct
Page 7 of 10
Test: Java Fundamentals Midterm Exam
Review your answers, feedback, and question scores below. An asterisk (*) indicates a
correct answer.
Section 3
(Answer all questions in this section)
36. In Greenfoot, string concatenation reduces the number of redundant characters or
phrases you need to type into each array. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
37. In Greenfoot, the instance has a source code editor. True or false? Mark for Review
(1) Points
True
False (*)
[Correct] Correct
38. In Greenfoot, the body of the method is located in between which of the following
characters? Mark for Review
(1) Points
Asterisks **
Parnetheses ( )
Square brackets [ ]
Curly brackets { } (*)
[Correct] Correct
39. In the Greenfoot IDE, an instance’s position is on the x and y coordinates. True or false?
Mark for Review
(1) Points
True (*)
False
[Correct] Correct
40. In Greenfoot, the move method expects what type of information in its parameters? Mark
for Review
(1) Points
String statement
Integer of steps to move forward (*)
Degrees to turn
True or false response
[Correct] Correct
Page 8 of 10
Test: Java Fundamentals Midterm Exam
Review your answers, feedback, and question scores below. An asterisk (*) indicates a
correct answer.
Section 3
(Answer all questions in this section)
41. In the Greenfoot IDE, any new methods you create are written in the class’s source
code. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
42. Use your Greenfoot knowledge to answer the question. One reason to write a defined
method in a class is to make it easier to read. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
43. In Greenfoot when you use the method to retrieve input from the user, the scenario will
continue to run in the background? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 7.
44. What type of parameter does the Greenfoot playSound method expect? Mark for Review
(1) Points
name of a sound file (as String) (*)
name of an integer (as int)
name of a keyboard key (as String)
name of the class (as String)
[Correct] Correct
45. What does the following Greenfoot programming statement tell the class to do?
if (Greenfoot.getRandomNumber(100) < 6) { turn(18); } Mark for Review
(1) Points
If a random number is returned that is greater than 6, turn 18 degrees.
If a random number is returned that is less than 6, move 18 steps.
Turn 6 degrees, then turn 18 degrees.
If a random number is returned that is less than 6, turn 18 degrees. (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 5.
Page 9 of 10
Test: Java Fundamentals Midterm Exam
Review your answers, feedback, and question scores below. An asterisk (*) indicates a
correct answer.
Section 3
(Answer all questions in this section)
46. In a Greenfoot if-else statement, if the condition is true, the if-statement is executed, and
then the else-statement is executed. True or false? Mark for Review
(1) Points
True
False (*)
[Correct] Correct
47. Which keyword indicates that Greenfoot needs to create a new object? Mark for Review
(1) Points
newObject
new (*)
addObject
newClass
[Incorrect] Incorrect. Refer to Section 3 Lesson 5.
48. The list below displays characteristics of a Greenfoot world constructor, except for one.
Which one should be removed? Mark for Review
(1) Points
Has the same name as the name of the class.
Defines the instance’s size and resolution.
Executed automatically when a new instance of the class is created.
Has no return type.
Has a void return type. (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 5.
49. When a program is tested once and it works then testing is complete. Mark for Review
(1) Points
True
False (*)
[Correct] Correct
50. From your Greenfoot lessons, Which of the following statements is most correct? Mark
for Review
(1) Points
My program is complete when it compiles.
My program is complete when I add images to it.
My program is complete when I add music to it.
My program is complete when it runs and I’ve tested the code. (*)
[Correct] Correct
Page 10 of 10
When creating an event based on a keypress which event handler would you use? Mark for
Review
(1) Points
Keyboard (*)
Mouse
Position/Orientation
Scene Activation/Time
Correct Correct
2. In Alice, when is the sceneActivationListener executed? Mark for Review
(1) Points
When an object appears on screen
At the beginning of the animation (*)
At the end of the animation
When the user clicks on on object
Correct Correct
3. The Alice move procedure contains which arguments? Mark for Review
(1) Points
(Choose all correct answers)
Text
Direction (*)
Object
Amount (*)
Correct Correct
4. In Alice, the computer specifies the low and high range values for the range of numbers
from which to pull a randomized number. True or false? Mark for Review
(1) Points
True
False (*)
Correct Correct
5. Which of the following is not a valid arithmetic operator in Java? Mark for Review
(1) Points
+
/

*
%
$ (*)
None of the above
6. What is the output produced by the following code?
Mark for Review
(1) Points
j is 10
j is 5
k is 5
j is 5
k is 5 (*)
j is 10
k is 10
j is 15
k is 15
Correct Correct
7. Debugging is the process of finding bugs in a software program. True or false? Mark for
Review
(1) Points
True (*)
False
Incorrect Incorrect. Refer to Section 2 Lesson 1.
8. Which of the following statements about methods is false? Mark for Review
(1) Points
Methods whose return type is not void are required to include a return statement specifying
what to return.
The order in which methods are listed within the class is not important.
Java does not permit nesting one method definition within another method’s definition.
Classes must be defined directly within a method definition. (*)
Incorrect Incorrect. Refer to Section 2 Lesson 14.
9. When you want specific code to be executed only if certain conditions are met, what type
of Java construct would you use? Mark for Review
(1) Points
boolean
while loop
array
if (*)
Incorrect Incorrect. Refer to Section 2 Lesson 14.
10. In Alice, when two objects are synchronized and move together, this means that one
object is: Mark for Review
(1) Points
A class of another
An instance of another
A vehicle of another (*)
An object of another
Correct Correct
In Alice, a walking motion for a bipedal object can be achieved without the Do Together
control statement. True or false? Mark for Review
(1) Points
True
False (*)
Correct Correct
12. In Alice, a computer program requires functions to tell it how to perform the procedure.
True or false? Mark for Review
(1) Points
True
False (*)
Correct Correct
13. From your Alice lessons, which programming instruction represents the following
movement: A person moves forward the distance to the table, minus the depth of the person.
Mark for Review
(1) Points
this.Table move Forward this.Person getDistanceTo this.Table – this.Table getDepth
this.Person move Forward this.Person getDistanceTo this.Table – this.Person getDepth (*)
this.Person move Forward this.Person getDistanceTo this.Table – this.Table getDepth
this.Person move Forward this.Person getDistanceTo this.Table + this.Person getDepth
Correct Correct
14. In Alice, as part of the recording process you can demonstrate the events that are
programmed within your animation. True or false? Mark for Review
(1) Points
True (*)
False
Correct Correct
15. Which of the following elements of the Alice animation should be tested before the
animation is considered complete? Mark for Review
(1) Points
Math calculations operate as expected.
Objects move with smooth timing.
Comments are added to each sequence of instructions.
Control statements are operating as expected.
All of the above. (*)
Correct Correct
16. Define the value of the variable LapCount based on the following math calculation:
LapCount + 10 = 15 Mark for Review
(1) Points
2
5 (*)
4
10
15
Correct Correct
17. Which of the following is not an Alice variable value type? Mark for Review
(1) Points
Whole Number
Decimal Number
Color
Function (*)
Correct Correct
18. In Alice, the use of conditional control structures allows what two types of loops? Mark
for Review
(1) Points
(Choose all correct answers)
together
infinite
switch
conditional (*)
Correct Correct
19. One type of object property is an object’s position in the scene. True or false? Mark for
Review
(1) Points
True (*)
False
Correct Correct
20. In Alice, which of the following programming statements moves the butterfly forward,
double the distance to the tree? Mark for Review
(1) Points
this.Butterfly move backward {this.Butterfly getDistanceTo this.Tree * 2}
this.Butterfly move backward {this.Butterfly getDistanceTo this.Tree / 2}
this.Butterfly move forward {this.Butterfly getDistanceTo this.Tree * 2} (*)
this.Butterfly move forward {this.Butterfly getDistanceTo this.Tree / 2}
Correct Correct
In Alice, which of the following programming statements moves the fish forward, the distance
to the rock, minus the depth of the rock? Mark for Review
(1) Points
this.Rock move forward {this.Rock getDistanceTo this.Fish – this.Fish – 2}
this.Fish move forward {this.Rock getDistanceTo this.Fish – this.Fish – 2}
this.Fish move forward {this.Fish getDistanceTo this.Rock – this.Rock getDepth} (*)
this.Fish move forward {this.Rock getDistanceTo this.Fish – this.Fish getDepth}
Correct Correct
22. A textual storyboard helps the reader understand the actions that will take place during
the animation. True or false? Mark for Review
(1) Points
True (*)
False
Correct Correct
23. Defining the scenario, and the Alice animation to represent the scenario, is the first step
to programming your animation. True or false? Mark for Review
(1) Points
True (*)
False
Correct Correct
24. Procedural abstraction may need to be implemented if an object in Alice needs to
perform an action, but there isn’t an inherited procedure that accomplishes that action. True
or false? Mark for Review
(1) Points
True (*)
False
Incorrect Incorrect. Refer to Section 2 Lesson 5.
Section 3
(Answer all questions in this section)
25. In Greenfoot, only 10 methods can be written for each class in the Code editor. True or
false? Mark for Review
(1) Points
True
False (*)
Incorrect Incorrect. Refer to Section 3 Lesson 3.
26. The list below provides actions you can perform in the Greenfoot code editor except one.
Which one should be removed? Mark for Review
(1) Points
Write source code to tell the class how to act in the scenario.
Review the online Java Library documentation. (*)
Write and edit source code.
Write and edit comments.
Incorrect Incorrect. Refer to Section 3 Lesson 3.
27. In Greenfoot, you can cast an Actor class to a World class? Mark for Review
(1) Points
True
False (*)
Incorrect Incorrect. Refer to Section 3 Lesson 9.
28. In Greenfoot, methods can be called in the act method. When the Act button is clicked in
the environment, the methods in the method body of the act method are executed. True or
false? Mark for Review
(1) Points
True (*)
False
Correct Correct
29. In Greenfoot, the move method expects what type of information in its parameters? Mark
for Review
(1) Points
String statement
Degrees to turn
Integer of steps to move forward (*)
True or false response
Correct Correct
30. In Greenfoot, the instance has a source code editor. True or false? Mark for Review
(1) Points
True
False (*)
Correct Correct
31. Using the Greenfoot IDE, only five instances can be added to a scenario. True or false?
Mark for Review
(1) Points
True
False (*)
Correct Correct
32. From your Greenfoot lessons, dot notation allows you to use a method from a different
class, if the class you are programming does not possess the method. True or false? Mark
for Review
(1) Points
True (*)
False
Correct Correct
33. The Greenfoot method getRandomNumber is used to create predictable behaviour in
your scenario Mark for Review
(1) Points
True
False (*)
Correct Correct
34. Which of the following Greenfoot methods returns a random number between 0, up to
and including 10,000? Mark for Review
(1) Points
Greenfoot.getRandomNumber(10,000)
Greenfoot.getRandomNumber(9,999)
Greenfoot.getRandomNumber(0-10,000)
Greenfoot.getRandomNumber(10,001) (*)
Incorrect Incorrect. Refer to Section 3 Lesson 5.
35. From your Greenfoot lessons, classes can only use the methods they have inherited.
They cannot use methods from other classes. True or false? Mark for Review
(1) Points
True
False (*)
Correct Correct
In Greenfoot, the class holds the general attributes of an instance, such as the methods it
inherits. True or false? Mark for Review
(1) Points
True (*)
False
Correct Correct
37. From your Greenfoot lessons, the reset button resets the scenario back to its initial
position. True or false? Mark for Review
(1) Points
True (*)
False
Correct Correct
38. We can use the Actor constructor to automatically create Actor instances when the
Greenfoot world is initialized. True or false? Mark for Review
(1) Points
True
False (*)
Correct Correct
39. Greenfoot Actor instances get their images from which of the following? Mark for Review
(1) Points
Their image editor
Their source code
Their methods
Their class (*)
Incorrect Incorrect. Refer to Section 3 Lesson 8.
40. From your Greenfoot lessons, what is the parameter of the following constructor that
creates a new image, and designates it to the Actor class?
setImage (new GreenfootImage(“Bee01.png”)); Mark for Review
(1) Points
new
setImage
GreenfootImage
Bee01.png (*)
Correct Correct
41. Which of the following type of audience should you ask to play your Greenfoot game
during the testing phase? Mark for Review
(1) Points
Target (*)
Testing
Programmer
Primary
Correct Correct
42. Which of the following features of Greenfoot will locate syntax errors in your program?
Mark for Review
(1) Points
Instance creation
Documentation
Compilation (*)
Code editor
Correct Correct
43. Defined methods are methods that are only created by the Greenfoot development
team? Mark for Review
(1) Points
True
False (*)
Incorrect Incorrect. Refer to Section 3 Lesson 6.
44. Which actor method is used to detect a simple collision? Mark for Review
(1) Points
isTouching() (*)
hasTouched()
isInContactWith()
hasCollided()
isCollision()
Correct Correct
45. In Greenfoot, which method would you use to obtain input from the user? Mark for
Review
(1) Points
getText()
ask() (*)
input()
getInput()
Incorrect Incorrect. Refer to Section 3 Lesson 7.
46. In Greenfoot, what type of parameter does the isKeyDown method expect? Mark for
Review
(1) Points
String (*)
Boolean
Method
Integer
Incorrect Incorrect. Refer to Section 3 Lesson 7.
47. How would the following sentence be written in Greenfoot source code? If Bee is turning,
and the keyboard key “d” is down… Mark for Review
(1) Points
if (&&isTurning ! Greenfoot.isKeyDown(“d”) )
if (isTurning && Greenfoot.isKeyDown(“d”) ) (*)
if (!isTurning && Greenfoot.isKeyDown(“d”) )
if (!Greenfoot.isKeyDown && isTurning(“d”) )
Correct Correct
48. If an end to a while loop is not established, what happens? Mark for Review
(1) Points
The code stops after 10 executions.
The code executes and does not stop. (*)
The code stops after 20 executions.
The condition becomes false after one minute of executions.
Correct Correct
49. Use your Greenfoot knowledge: An array object holds a single variable. True or false?
Mark for Review
(1) Points
True
False (*)
Correct Correct
50. In the following Greenfoot array, what statement would you write to access the “a” key?
Keynames = {“a”, “b”, “c”, “d”}; Mark for Review
(1) Points
keynames[“a” key]
keynames[0] (*)
keynames[2]
keynames[“a”]
Incorrect Incorrect. Refer to Section 3 Lesson 10.
When creating an event based on a keypress which event handler would you use? Mark for
Review
(1) Points
Keyboard (*)
Mouse
Position/Orientation
Scene Activation/Time
Correct Correct
2. In Alice, when is the sceneActivationListener executed? Mark for Review
(1) Points
When an object appears on screen
At the beginning of the animation (*)
At the end of the animation
When the user clicks on on object
Correct Correct
3. The Alice move procedure contains which arguments? Mark for Review
(1) Points
(Choose all correct answers)
Text
Direction (*)
Object
Amount (*)
Correct Correct
4. In Alice, the computer specifies the low and high range values for the range of numbers
from which to pull a randomized number. True or false? Mark for Review
(1) Points
True
False (*)
Correct Correct
5. Which of the following is not a valid arithmetic operator in Java? Mark for Review
(1) Points
+
/

*
%
$ (*)
None of the above
6. What is the output produced by the following code?
Mark for Review
(1) Points
j is 10
j is 5
k is 5
j is 5
k is 5 (*)
j is 10
k is 10
j is 15
k is 15
Correct Correct
7. Debugging is the process of finding bugs in a software program. True or false? Mark for
Review
(1) Points
True (*)
False
Incorrect Incorrect. Refer to Section 2 Lesson 1.
8. Which of the following statements about methods is false? Mark for Review
(1) Points
Methods whose return type is not void are required to include a return statement specifying
what to return.
The order in which methods are listed within the class is not important.
Java does not permit nesting one method definition within another method’s definition.
Classes must be defined directly within a method definition. (*)
Incorrect Incorrect. Refer to Section 2 Lesson 14.
9. When you want specific code to be executed only if certain conditions are met, what type
of Java construct would you use? Mark for Review
(1) Points
boolean
while loop
array
if (*)
Incorrect Incorrect. Refer to Section 2 Lesson 14.
10. In Alice, when two objects are synchronized and move together, this means that one
object is: Mark for Review
(1) Points
A class of another
An instance of another
A vehicle of another (*)
An object of another
Correct Correct
In Alice, a walking motion for a bipedal object can be achieved without the Do Together
control statement. True or false? Mark for Review
(1) Points
True
False (*)
Correct Correct
12. In Alice, a computer program requires functions to tell it how to perform the procedure.
True or false? Mark for Review
(1) Points
True
False (*)
Correct Correct
13. From your Alice lessons, which programming instruction represents the following
movement: A person moves forward the distance to the table, minus the depth of the person.
Mark for Review
(1) Points
this.Table move Forward this.Person getDistanceTo this.Table – this.Table getDepth
this.Person move Forward this.Person getDistanceTo this.Table – this.Person getDepth (*)
this.Person move Forward this.Person getDistanceTo this.Table – this.Table getDepth
this.Person move Forward this.Person getDistanceTo this.Table + this.Person getDepth
Correct Correct
14. In Alice, as part of the recording process you can demonstrate the events that are
programmed within your animation. True or false? Mark for Review
(1) Points
True (*)
False
Correct Correct
15. Which of the following elements of the Alice animation should be tested before the
animation is considered complete? Mark for Review
(1) Points
Math calculations operate as expected.
Objects move with smooth timing.
Comments are added to each sequence of instructions.
Control statements are operating as expected.
All of the above. (*)
Correct Correct
16. Define the value of the variable LapCount based on the following math calculation:
LapCount + 10 = 15 Mark for Review
(1) Points
2
5 (*)
4
10
15
Correct Correct
17. Which of the following is not an Alice variable value type? Mark for Review
(1) Points
Whole Number
Decimal Number
Color
Function (*)
Correct Correct
18. In Alice, the use of conditional control structures allows what two types of loops? Mark
for Review
(1) Points
(Choose all correct answers)
together
infinite
switch
conditional (*)
Correct Correct
19. One type of object property is an object’s position in the scene. True or false? Mark for
Review
(1) Points
True (*)
False
Correct Correct
20. In Alice, which of the following programming statements moves the butterfly forward,
double the distance to the tree? Mark for Review
(1) Points
this.Butterfly move backward {this.Butterfly getDistanceTo this.Tree * 2}
this.Butterfly move backward {this.Butterfly getDistanceTo this.Tree / 2}
this.Butterfly move forward {this.Butterfly getDistanceTo this.Tree * 2} (*)
this.Butterfly move forward {this.Butterfly getDistanceTo this.Tree / 2}
Correct Correct
In Alice, which of the following programming statements moves the fish forward, the distance
to the rock, minus the depth of the rock? Mark for Review
(1) Points
this.Rock move forward {this.Rock getDistanceTo this.Fish – this.Fish – 2}
this.Fish move forward {this.Rock getDistanceTo this.Fish – this.Fish – 2}
this.Fish move forward {this.Fish getDistanceTo this.Rock – this.Rock getDepth} (*)
this.Fish move forward {this.Rock getDistanceTo this.Fish – this.Fish getDepth}
Correct Correct
22. A textual storyboard helps the reader understand the actions that will take place during
the animation. True or false? Mark for Review
(1) Points
True (*)
False
Correct Correct
23. Defining the scenario, and the Alice animation to represent the scenario, is the first step
to programming your animation. True or false? Mark for Review
(1) Points
True (*)
False
Correct Correct
24. Procedural abstraction may need to be implemented if an object in Alice needs to
perform an action, but there isn’t an inherited procedure that accomplishes that action. True
or false? Mark for Review
(1) Points
True (*)
False
Incorrect Incorrect. Refer to Section 2 Lesson 5.
Section 3
(Answer all questions in this section)
25. In Greenfoot, only 10 methods can be written for each class in the Code editor. True or
false? Mark for Review
(1) Points
True
False (*)
Incorrect Incorrect. Refer to Section 3 Lesson 3.
26. The list below provides actions you can perform in the Greenfoot code editor except one.
Which one should be removed? Mark for Review
(1) Points
Write source code to tell the class how to act in the scenario.
Review the online Java Library documentation. (*)
Write and edit source code.
Write and edit comments.
Incorrect Incorrect. Refer to Section 3 Lesson 3.
27. In Greenfoot, you can cast an Actor class to a World class? Mark for Review
(1) Points
True
False (*)
Incorrect Incorrect. Refer to Section 3 Lesson 9.
28. In Greenfoot, methods can be called in the act method. When the Act button is clicked in
the environment, the methods in the method body of the act method are executed. True or
false? Mark for Review
(1) Points
True (*)
False
Correct Correct
29. In Greenfoot, the move method expects what type of information in its parameters? Mark
for Review
(1) Points
String statement
Degrees to turn
Integer of steps to move forward (*)
True or false response
Correct Correct
30. In Greenfoot, the instance has a source code editor. True or false? Mark for Review
(1) Points
True
False (*)
Correct Correct
31. Using the Greenfoot IDE, only five instances can be added to a scenario. True or false?
Mark for Review
(1) Points
True
False (*)
Correct Correct
32. From your Greenfoot lessons, dot notation allows you to use a method from a different
class, if the class you are programming does not possess the method. True or false? Mark
for Review
(1) Points
True (*)
False
Correct Correct
33. The Greenfoot method getRandomNumber is used to create predictable behaviour in
your scenario Mark for Review
(1) Points
True
False (*)
Correct Correct
34. Which of the following Greenfoot methods returns a random number between 0, up to
and including 10,000? Mark for Review
(1) Points
Greenfoot.getRandomNumber(10,000)
Greenfoot.getRandomNumber(9,999)
Greenfoot.getRandomNumber(0-10,000)
Greenfoot.getRandomNumber(10,001) (*)
Incorrect Incorrect. Refer to Section 3 Lesson 5.
35. From your Greenfoot lessons, classes can only use the methods they have inherited.
They cannot use methods from other classes. True or false? Mark for Review
(1) Points
True
False (*)
Correct Correct
In Greenfoot, the class holds the general attributes of an instance, such as the methods it
inherits. True or false? Mark for Review
(1) Points
True (*)
False
Correct Correct
37. From your Greenfoot lessons, the reset button resets the scenario back to its initial
position. True or false? Mark for Review
(1) Points
True (*)
False
Correct Correct
38. We can use the Actor constructor to automatically create Actor instances when the
Greenfoot world is initialized. True or false? Mark for Review
(1) Points
True
False (*)
Correct Correct
39. Greenfoot Actor instances get their images from which of the following? Mark for Review
(1) Points
Their image editor
Their source code
Their methods
Their class (*)
Incorrect Incorrect. Refer to Section 3 Lesson 8.
40. From your Greenfoot lessons, what is the parameter of the following constructor that
creates a new image, and designates it to the Actor class?
setImage (new GreenfootImage(“Bee01.png”)); Mark for Review
(1) Points
new
setImage
GreenfootImage
Bee01.png (*)
Correct Correct
41. Which of the following type of audience should you ask to play your Greenfoot game
during the testing phase? Mark for Review
(1) Points
Target (*)
Testing
Programmer
Primary
Correct Correct
42. Which of the following features of Greenfoot will locate syntax errors in your program?
Mark for Review
(1) Points
Instance creation
Documentation
Compilation (*)
Code editor
Correct Correct
43. Defined methods are methods that are only created by the Greenfoot development
team? Mark for Review
(1) Points
True
False (*)
Incorrect Incorrect. Refer to Section 3 Lesson 6.
44. Which actor method is used to detect a simple collision? Mark for Review
(1) Points
isTouching() (*)
hasTouched()
isInContactWith()
hasCollided()
isCollision()
Correct Correct
45. In Greenfoot, which method would you use to obtain input from the user? Mark for
Review
(1) Points
getText()
ask() (*)
input()
getInput()
Incorrect Incorrect. Refer to Section 3 Lesson 7.
46. In Greenfoot, what type of parameter does the isKeyDown method expect? Mark for
Review
(1) Points
String (*)
Boolean
Method
Integer
Incorrect Incorrect. Refer to Section 3 Lesson 7.
47. How would the following sentence be written in Greenfoot source code? If Bee is turning,
and the keyboard key “d” is down… Mark for Review
(1) Points
if (&&isTurning ! Greenfoot.isKeyDown(“d”) )
if (isTurning && Greenfoot.isKeyDown(“d”) ) (*)
if (!isTurning && Greenfoot.isKeyDown(“d”) )
if (!Greenfoot.isKeyDown && isTurning(“d”) )
Correct Correct
48. If an end to a while loop is not established, what happens? Mark for Review
(1) Points
The code stops after 10 executions.
The code executes and does not stop. (*)
The code stops after 20 executions.
The condition becomes false after one minute of executions.
Correct Correct
49. Use your Greenfoot knowledge: An array object holds a single variable. True or false?
Mark for Review
(1) Points
True
False (*)
Correct Correct
50. In the following Greenfoot array, what statement would you write to access the “a” key?
Keynames = {“a”, “b”, “c”, “d”}; Mark for Review
(1) Points
keynames[“a” key]
keynames[0] (*)
keynames[2]
keynames[“a”]
Incorrect Incorrect. Refer to Section 3 Lesson 10.
1. In Alice, a walking motion for a bipedal object can be achieved without the Do Together
control statement. True or false? Mark for Review
(1) Points
True
False (*)
[Correct] Correct
2. In Alice, the setVehicle procedure will associate one object to another. True or false?
Mark for Review
(1) Points
True (*)
False
[Correct] Correct
3. In Alice, the procedures’ arguments allow the programmer to adjust the object, motion,
distance amount, and time duration. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
4. The list below displays valid primitive types in Java, except which one? Mark for Review
(1) Points
double
String (*)
int
boolean
long
[Correct] Correct
5. Which of the following is not a valid primitive type in Java? Mark for Review
(1) Points
long
boolean
int
double
String (*)
[Correct] Correct
6. What can be used as a guideline to ensure your Alice animation fulfills animation
principles? Mark for Review
(1) Points
A close friend
An animation checklist (*)
Other programmers
The Internet
[Correct] Correct
7. In which Alice class is the addDefaultModelManipulation procedure located? Mark for
Review
(1) Points
myFirstMethod class
Object class
Quadruped class
Scene class (*)
[Correct] Correct
8. In Alice the Functions tab will display the pre-defined functions for the selected instance.
True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
9. From your Alice lessons, the Do In Order control statement is also referred to by what
other name? Mark for Review
(1) Points
Sequence control
Sequential control (*)
Control order
Order control
[Correct] Correct
10. Main is an example of what in the following code?
public static void main (String[] args) {
System.out.println{“Hello World!”);
} Mark for Review
(1) Points
A variable
A method (*)
An instance
A class
[Correct] Correct
11. The condition in a WHILE loop is a boolean expression. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
12. In Alice, which of the following programming statements moves the cat forward the
distance to the bird? Mark for Review
(1) Points
this.Cat move forward {this.Bird getDistanceTo this.Cat / 2}
this.Cat move forward {this.Cat getDistanceTo this.Bird} (*)
this.Cat move {this.Bird getDistanceTo this.Cat / 2}
this.Bird move forward {this.Bird getDistanceTo this.Cat}
[Correct] Correct
13. Alice uses built-in math operators. They are: Mark for Review
(1) Points
Add
Subtract
Multiply
Divide
All of the above (*)
[Correct] Correct
14. How do you view the results of procedures entered in the Alice code editor? Mark for
Review
(1) Points
Select the Run button. (*)
View the procedures in the gallery.
Save the scene.
Select the Play button.
[Correct] Correct
15. In Alice, we use the While control statement to implement the conditional loop. True or
false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
16. An Alice event is considered what? Mark for Review
(1) Points
An object’s orientation.
A party with at least 20 people.
Error handling.
A keystroke or mouse click. (*)
[Correct] Correct
17. Alice provides pre-populated worlds through which new menu tab? Mark for Review
(1) Points
Starters (*)
Recent
Blank Slates
File System
[Correct] Correct
18. Before you can begin to develop the animation storyboard, what must be defined? Mark
for Review
(1) Points
The control statements
The code
The debugging process
The scenario (*)
[Correct] Correct
19. A textual storyboard helps the reader understand the actions that will take place during
the animation. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
20. In Alice, what are the forms of a scenario? Mark for Review
(1) Points
(Choose all correct answers)
A problem to solve. (*)
A section of code to write.
A system to start.
A task to perform. (*)
A person to help.
[Correct] Correct
21. In Alice, which function is used to move an object directly to the center point of another
object? Mark for Review
(1) Points
getDepth
getDuration
getObject
getDistance (*)
[Correct] Correct
22. Which handle style would be used to rotate an object’s sub-part about the x, y, and z
axes? Mark for Review
(1) Points
Translation
Default
Rotation (*)
Resize
[Correct] Correct
23. Which of the following is not an Alice variable value type? Mark for Review
(1) Points
Function (*)
Color
Decimal Number
Whole Number
[Correct] Correct
24. A variable is a named location inside the computer’s memory; once there, the
information can be retrieved and changed. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
26. In Greenfoot, the == operator is used to test if two values are equal. True or false? Mark
for Review
(1) Points
True (*)
False
[Correct] Correct
27. In Greenfoot, actor constructors can be used to create images or values and assign
them to the variables. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
28. From your Greenfoot lessons, a problem statement defines the purpose for your game.
True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
29. Which of the following features of Greenfoot will locate syntax errors in your program?
Mark for Review
(1) Points
Instance creation
Documentation
Compilation (*)
Code editor
[Correct] Correct
30. In Greenfoot, which of the following options are not possible when associating an image
file with an instance? Mark for Review
(1) Points
Import an image
Draw an image
Add a video (*)
Select an image from the Greenfoot library
[Correct] Correct
31. An instance variable can be saved and accessed later, even if the instance no longer
exists. True or false? Mark for Review
(1) Points
True
False (*)
[Correct] Correct
32. In the Greenfoot IDE, an instance’s position is on the x and y coordinates. True or false?
Mark for Review
(1) Points
True (*)
False
[Correct] Correct
The Greenfoot method getRandomNumber is used to create predictable behaviour in your
scenario Mark for Review
(1) Points
True
False (*)
[Correct] Correct
35. From your Greenfoot lessons, which of the following comparison operators represents
“greater than”? Mark for Review
(1) Points
<
==
> (*)
!=
[Correct] Correct
In Greenfoot, which of the following is the correct notation for calling a method for an
instance of a class? Mark for Review
(1) Points
Method-name.object-name;
Method-name.object-name(parameters);
object-name.method-name(parameters); (*)
class-name.method-name(parameters);
[Correct] Correct
38. In Greenfoot, you can cast an Actor class to a World class? Mark for Review
(1) Points
True
False (*)
[Correct] Correct
39. Which of the following is not a component of a while loop? Mark for Review
(1) Points
Loop variable
if statement (*)
Local variable
while keyword
Control operator
[Correct] Correct
40. In the Greenfoot IDE, what symbols indicate that the variable is an array? Mark for
Review
(1) Points
Colon :
Semicolon ;
Curly brackets { }
Square brackets [ ] (*)
[Correct] Correct
From your Greenfoot lessons, which of the following logic operators represents “and”? Mark
for Review
(1) Points
!
=
&
&& (*)
[Correct] Correct
42. An array is an object that holds multiple methods. True or false? Mark for Review
(1) Points
True
False (*)
[Correct] Correct
43. From your Greenfoot lessons, what are the ways that you can view a class’s methods?
Mark for Review
(1) Points
(Choose all correct answers)
In the scenario
In the Greenfoot gallery
In the class’s documentation (*)
By right-clicking on an instance (*)
[Correct] Correct
44. From your Greenfoot lessons, which of the following methods return the current rotation
of the object? Mark for Review
(1) Points
getXY()
int getRotation() (*)
World getWorld()
World getClass()
[Correct] Correct
45. In Greenfoot, you can only interact with the scenario using a keyboard. Mark for Review
(1) Points
True
False (*)
[Correct] Correct
46. In Greenfoot, the sound file must be saved in the scenario and written in the source code
for it to play. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
47. In the Greenfoot IDE, any new methods you create are written in the class’s source
code. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
48. In Greenfoot, which of the following statement is true about Defined Methods? Mark for
Review
(1) Points
A defined method only relates to the World class.
A defined method is only relevant to the Greenfoot Development team.
A defined method is automatically executed once created.
A defined method must be called by your source code, normally in the Act method. (*)
[Correct] Correct
49. A subclass has what kind of relationship to a superclass? Mark for Review
(1) Points
“a-is”
“for-what”
“is-a” (*)
“is-by”
[Correct] Correct
50. In Greenfoot, after a subclass is created, what has to occur before instances can be
added to the scenario? Mark for Review
(1) Points
Editing of source code
Creation of an instance
Compilation (*)
Creation of source code
[Correct] Correct
1. In Alice, control statements are dragged into the Code editor. True or false? Mark for
Review
(1) Points
True (*)
False
[Correct] Correct
2. In Alice, a computer program requires functions to tell it how to perform the procedure.
True or false? Mark for Review
(1) Points
True
False (*)
[Correct] Correct
3. In Alice, which control statement is used to invoke simultaneous movement? Mark for
Review
(1) Points
Do Together (*)
Do In Order
Variable
Count
While
[Incorrect] Incorrect. Refer to Section 2 Lesson 6.
4. In Alice, the procedures’ arguments allow the programmer to adjust the object, motion,
distance amount, and time duration. True or false? Mark for Review
(1) Points
True (*)
False
[Incorrect] Incorrect. Refer to Section 2 Lesson 6.
5. An example of an expression is: Mark for Review
(1) Points
Move forward 1 meter
3*3=9 (*)
“I feel happy.”
If or Where
In Alice, which of the following programming statements moves the cat backward, half the
distance to the bird? Mark for Review
(1) Points
this.Cat move forward {this.Bird getDistanceTo this.Cat / 2}
this.Cat move backward {this.Bird getDistanceTo this.Cat / 2}
this.Bird move forward {this.Bird getDistanceTo this.Cat / 2}
this.Cat move backward {this.Cat getDistanceTo this.Bird / 2} (*)
[Correct] Correct
7. What is the result of the following code?
Mark for Review
(1) Points
x>y:x>y
x<y:x<y
x > y : true
x < y : false (*)
x>y:1
x<y:0
x > y : false
x < y : true
x>y:0
x<y:1
[Incorrect] Incorrect. Refer to Section 2 Lesson 13.
8. The list below displays valid primitive types in Java, except which one? Mark for Review
(1) Points
int
long
double
boolean
String (*)
[Correct] Correct
9. An animation gives the scenario a purpose. True or false? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 2 Lesson 5.
10. In Alice, which of the following is the most likely situation where procedural abstraction
could be used? Mark for Review
(1) Points
Two fish say something to each other.
One fish needs to swim forward 1 meter.
One person moves up 10 meters.
Five dogs all need to bark and run at the same time. (*)
11. In Alice, new procedures are declared in the Scene editor. True or false? Mark for
Review
(1) Points
True
False (*)
[Correct] Correct
12. All objects in Alice have three dimensional coordinates on which axes? Mark for Review
(1) Points
(Choose all correct answers)
x (*)
y (*)
z (*)
w
All of the above
[Correct] Correct
13. What is the first step to entering comments in an Alice program? Mark for Review
(1) Points
Drag and drop the comments tile below a code segment.
Type comments that describe the sequence of actions in the code segment.
Select the instance from the instance menu.
Drag and drop the comments tile above a code segment. (*)
[Incorrect] Incorrect. Refer to Section 2 Lesson 3.
14. As the Alice programmer, you render the animation on your own. True or false? Mark for
Review
(1) Points
True
False (*)
[Correct] Correct
15. From your Alice lessons, animations should be tested by the programmer before they
are considered complete. True or false? Mark for Review
(1) Points
True (*)
False
16. Which option copies a programming instruction to the clipboard? Mark for Review
(1) Points
Is Enabled
Paste
Clipboard
Copy to Clipboard (*)
[Correct] Correct
17. In Alice it is not possible to transfer a class from one animation to another. True or false?
Mark for Review
(1) Points
True
False (*)
[Correct] Correct
18. In Alice, what tab would you choose to start a new animation with a pre-populated world?
Mark for Review
(1) Points
My Projects
Blank Slate
Starters (*)
Recent
[Correct] Correct
19. A variable is a place in memory where data of a specific type can be stored for later
retrieval and use by your program Mark for Review
(1) Points
True (*)
False
[Correct] Correct
20. Which of the following is not an Alice variable value type? Mark for Review
(1) Points
Function (*)
Whole Number
Decimal Number
Color
21. If you want one message to display if a user is below the age of 18 and a different
message to display if the user is 18 or older, what type of construct would you use? Mark for
Review
(1) Points
do loop
if (*)
while loop
for all loop
[Correct] Correct
22. The list below contains method descriptions. All are correct except which one? Mark for
Review
(1) Points
(Choose all correct answers)
A set of code that is referred to by name. (*)
Is associated with an instance variable.
Can be called at any point in a program simply by utilizing its name.
A subprogram that acts on data and often returns a value. (*)
[Incorrect] Incorrect. Refer to Section 2 Lesson 14.
23. From your Alice lessons, which programming instruction represents the following
movement: A turtle moves forward half the distance to the flower. Mark for Review
(1) Points
this.Turtle move Forward this.Turtle getDistanceTo this.Flower / 0.5
this.Turtle move Forward this.Turtle getDistanceTo this.Flower / 2.0 (*)
this.Turtle move Forward this.Turtle getDistanceTo this.Flower / 1.0
this.Turtle move Forward this.Turtle getDistanceTo this.Flower * 2
[Correct] Correct
24. From your Alice lessons, the IF control structure can process one true and one false
response. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
Section 3
(Answer all questions in this section)
25. From your Greenfoot lessons, abstraction techniques can only be used once in a class’s
source code. True or false? Mark for Review
(1) Points
True
False (*)
26. Infinite loops are a common cause of errors in programming. True or false? Mark for
Review
(1) Points
True (*)
False
[Incorrect] Incorrect. Refer to Section 3 Lesson 10.
27. From your Greenfoot lessons, which of the following logic operators represents “and”?
Mark for Review
(1) Points
&& (*)
&
!
=
[Correct] Correct
28. In Greenfoot, when is a local variable most often used? Mark for Review
(1) Points
Within the act method
Within loop constructs (*)
Within the world constructor
Within the scenario
[Correct] Correct
29. From your Greenfoot lessons, when do infinite loops occur? Mark for Review
(1) Points
Only in while loops.
When the loop is executed.
When the end to the act method isn’t established.
When the end to the code isn’t established. (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 10.
30. In Greenfoot, which of the following statement is true about Defined Methods? Mark for
Review
(1) Points
A defined method only relates to the World class.
A defined method is only relevant to the Greenfoot Development team.
A defined method must be called by your source code, normally in the Act method. (*)
A defined method is automatically executed once created.
31. To execute a method in your Greenfoot game, where is it called from? Mark for Review
(1) Points
The actor class
The world
The act method (*)
The gallery
[Correct] Correct
32. When designing a game in Greenfoot, it helps to define the actions that will take place in
a textual storyboard. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
33. From your Greenfoot lessons, Which of the following statements is most correct? Mark
for Review
(1) Points
My program is complete when it runs and I’ve tested the code. (*)
My program is complete when I add images to it.
My program is complete when I add music to it.
My program is complete when it compiles.
[Correct] Correct
34. In Greenfoot, which method would you use to obtain input from the user? Mark for
Review
(1) Points
input()
ask() (*)
getText()
getInput()
[Correct] Correct
35. In Greenfoot, which method checks if a key on the keyboard has been pressed? Mark for
Review
(1) Points
keyPress method
keyClick method
isKeyDown method (*)
isKeyUp method
36. In Greenfoot, an if-statement is used to alternate between displaying two images in an
instance. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
37. In Greenfoot, what is the purpose of the variable type? Mark for Review
(1) Points
Defines which class the variable is associated with.
Defines the access specifier used with the variable.
Defines the instance that the variable is associated with.
Defines what kind of data to store in the variable. (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 8.
38. Specific to the Greenfoot IDE, which of the following stop methods is written correctly?
Mark for Review
(1) Points
Greenfoot.stop( ); (*)
Greenfoot.stop(key);
Greenfoot(stop);
stop.Greenfoot( );
[Correct] Correct
39. An object is an instance of a class. True or false? Mark for Review
(1) Points
True (*)
False
[Incorrect] Incorrect. Refer to Section 3 Lesson 1.
40. In Greenfoot to create a new instance of a class, you right-click on the class, then select
which of the following commands in the class menu? Mark for Review
(1) Points
Inspect Duke()
New subclass…
Set image…
new Duke() (*)
Remove Duke()
41. From your Greenfoot lessons, classes can only use the methods they have inherited.
They cannot use methods from other classes. True or false? Mark for Review
(1) Points
True
False (*)
[Correct] Correct
42. In Greenfoot, you can use comparison operators to compare a variable to a random
number. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
43. An if-else statement executes its first code block if a condition is true, and its second
code block if a condition is false, but not both. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
44. The Greenfoot method getRandomNumber is used to create predictable behaviour in
your scenario Mark for Review
(1) Points
True
False (*)
[Correct] Correct
45. In Greenfoot, a method with what kind of return type is used to learn more about an
object’s orientation? Mark for Review
(1) Points
void return type
non-void return type (*)
object return type
method return type
46. An if-statement requires which type of information returned from the condition? Mark for
Review
(1) Points
Method
Action
True or false (*)
Integer
[Correct] Correct
47. In Greenfoot, which of the following options are not possible when associating an image
file with an instance? Mark for Review
(1) Points
Draw an image
Select an image from the Greenfoot library
Import an image
Add a video (*)
[Correct] Correct
48. A variable is also known as a ____________. Mark for Review
(1) Points
Method
Class
Instance
Syntax
Field (*)
[Correct] Correct
49. In Greenfoot, the move method expects what type of information in its parameters? Mark
for Review
(1) Points
Integer of steps to move forward (*)
True or false response
String statement
Degrees to turn
[Correct] Correct
50. In Greenfoot, the body of the method is located in between which of the following
characters? Mark for Review
(1) Points
Parnetheses ( )
Curly brackets { } (*)
Square brackets [ ]
Asterisks **
1. In Alice, we use the WHILE control statement to implement the conditional loop. True or
false? Mark for Review
(1) Points
True (*)
False
[Incorrect] Incorrect. Refer to Section 2 Lesson 8.
2. In Alice, different programming is not required for different objects, because all objects
move the same way. True or false? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 2 Lesson 6.
3. In Alice, which of the following is not a control statement? Mark for Review
(1) Points
While
Move (*)
Do In Order
Count
[Incorrect] Incorrect. Refer to Section 2 Lesson 6.
4. In Alice, a walking motion for a bipedal object can be achieved without the Do Together
control statement. True or false? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 2 Lesson 6.
5. Alice 3 will periodically remind you to save your project. True or false? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 2 Lesson 1.
6. From your Alice lessons, variables are fixed and cannot be changed. True or false? Mark
for Review
(1) Points
True
False (*)
[Correct] Correct
7. When viewing the Java Code on the side in Alice, you can change the Java code directly
instead of the Alice code. True or false? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 2 Lesson 10.
8. In Alice, there is a limit of 10 objects per scene. True or false? Mark for Review
(1) Points
True
False (*)
[Correct] Correct
9. The delay procedure in Alice halts an object’s motion before the next motion begins. True
or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
10. What should you refer to for the animation’s design specifications as you program your
Alice animation? Mark for Review
(1) Points
Code
Storyboard (*)
Scenario
Scene editor
[Correct] Correct
11. From your Alice lessons, if you examined a science process that had many steps, which
of the following is a way that you could apply functional decomposition to this process? Mark
for Review
(1) Points
1. Present the problem as an animation.
2. Further refine and define the tasks needed for each high level step.
3. Identify the high level steps for the science concept.
1. Identify the high level steps for the science concept.
2. Further refine and define the tasks needed for each high level step.
3. Present the problem as an animation. (*)
1. Identify the detailed steps for the science concept.
2. Present the problem as an animation.
Present the problem as an animation.
[Incorrect] Incorrect. Refer to Section 2 Lesson 12.
12. In Alice, which of the following is the most likely situation where procedural abstraction
could be used? Mark for Review
(1) Points
Five dogs all need to bark and run at the same time. (*)
Two fish say something to each other.
One fish needs to swim forward 1 meter.
One person moves up 10 meters.
[Correct] Correct
13. In Alice, what are the forms of a scenario? Mark for Review
(1) Points
(Choose all correct answers)
A task to perform. (*)
A problem to solve. (*)
A section of code to write.
A system to start.
A person to help.
[Incorrect] Incorrect. Refer to Section 2 Lesson 5.
14. In Alice, new procedures are declared in the Scene editor. True or false? Mark for
Review
(1) Points
True
False (*)
[Correct] Correct
15. In Alice, which of the following programming statements moves the cat backward, half
the distance to the bird? Mark for Review
(1) Points
this.Cat move backward {this.Cat getDistanceTo this.Bird / 2} (*)
this.Cat move forward {this.Bird getDistanceTo this.Cat / 2}
this.Bird move forward {this.Bird getDistanceTo this.Cat / 2}
this.Cat move backward {this.Bird getDistanceTo this.Cat / 2}
[Correct] Correct
16. In Alice, which of the following programming statements moves the fish forward, the
distance to the rock, minus the depth of the rock? Mark for Review
(1) Points
this.Fish move forward {this.Rock getDistanceTo this.Fish – this.Fish – 2}
this.Fish move forward {this.Fish getDistanceTo this.Rock – this.Rock getDepth} (*)
this.Rock move forward {this.Rock getDistanceTo this.Fish – this.Fish – 2}
this.Fish move forward {this.Rock getDistanceTo this.Fish – this.Fish getDepth}
[Correct] Correct
17. Alice provides pre-populated worlds through which new menu tab? Mark for Review
(1) Points
File System
Blank Slates
Starters (*)
Recent
[Correct] Correct
18. An event is any action initiated by the user that is designed to influence the program?s
execution during play. Mark for Review
(1) Points
True (*)
False
[Correct] Correct
19. The list below contains method descriptions. All are correct except which one? Mark for
Review
(1) Points
(Choose all correct answers)
Is associated with an instance variable.
A subprogram that acts on data and often returns a value. (*)
A set of code that is referred to by name. (*)
Can be called at any point in a program simply by utilizing its name.
[Incorrect] Incorrect. Refer to Section 2 Lesson 14.
20. In Java, a function is a method that must return a value. True or false? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 2 Lesson 14.
21. From your Alice lessons, random numbers are numbers generated by the user with a
pattern in their sequence. True or false? Mark for Review
(1) Points
True
False (*)
[Correct] Correct
22. What is the output produced by the following code?
Mark for Review
(1) Points
j is 10
k is 10
j is 10
j is 5
k is 5
j is 15
k is 15
j is 5
k is 5 (*)
[Incorrect] Incorrect. Refer to Section 2 Lesson 13.
23. The following are examples of what in Java?
boolean
bite
char
short
int
long
float
double
Mark for Review
(1) Points
Types (*)
Variables
Expressions
Specifications
[Incorrect] Incorrect. Refer to Section 2 Lesson 13.
24. In Alice, where can you view the list of functions available for an object? Mark for Review
(1) Points
Instance pull-down menu.
Functions tab in the methods panel. (*)
Properties tab in the methods panel.
Class description in the Scene editor.
[Incorrect] Incorrect. Refer to Section 2 Lesson 7.
Section 3
(Answer all questions in this section)
25. From your Greenfoot lessons, which one of the following is an example of when an
abstraction technique is used? Mark for Review
(1) Points
Adding a property to an instance
Adding a property to a Class
Passing a paramater in a constructor to set an initial speed. (*)
Initialising a variable
[Incorrect] Incorrect. Refer to Section 3 Lesson 9.
26. An object is an instance of a class. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
27. In Greenfoot to create a new instance of a class, you right-click on the class, then select
which of the following commands in the class menu? Mark for Review
(1) Points
Set image…
Remove Duke()
New subclass…
Inspect Duke()
new Duke() (*)
[Correct] Correct
28. From your Greenfoot lessons, source code is written in the Code editor. True or false?
Mark for Review
(1) Points
True (*)
False
[Correct] Correct
29. The list below provides actions you can perform in the Greenfoot code editor except one.
Which one should be removed? Mark for Review
(1) Points
Write and edit source code.
Write and edit comments.
Review the online Java Library documentation. (*)
Write source code to tell the class how to act in the scenario.
[Correct] Correct
30. The GreenfootImage class enables Greenfoot actors to maintain their visible image by
holding an object of type GreenfootImage. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
31. In Greenfoot, what is the purpose of the variable type? Mark for Review
(1) Points
Defines which class the variable is associated with.
Defines what kind of data to store in the variable. (*)
Defines the instance that the variable is associated with.
Defines the access specifier used with the variable.
[Incorrect] Incorrect. Refer to Section 3 Lesson 8.
32. Greenfoot Actor instances get their images from which of the following? Mark for Review
(1) Points
Their class (*)
Their image editor
Their methods
Their source code
[Incorrect] Incorrect. Refer to Section 3 Lesson 8.
33. Which one of the following can be used to detect when 2 actors collide? Mark for Review
(1) Points
isCollision()
hasCollided()
isContact()
isTouching() (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 6.
34. In the Greenfoot IDE, any new methods you create are written in the class’s source
code. True or false? Mark for Review
(1) Points
True (*)
False
[Incorrect] Incorrect. Refer to Section 3 Lesson 6.
35. In the Greenfoot IDE, an instance’s position is on the x and y coordinates. True or false?
Mark for Review
(1) Points
True (*)
False
[Correct] Correct
36. An instance variable can be saved and accessed later, even if the instance no longer
exists. True or false? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 2.
37. In Greenfoot, the move method expects what type of information in its parameters? Mark
for Review
(1) Points
True or false response
Integer of steps to move forward (*)
Degrees to turn
String statement
[Correct] Correct
38. A variable is also known as a ____________. Mark for Review
(1) Points
Field (*)
Syntax
Class
Method
Instance
[Incorrect] Incorrect. Refer to Section 3 Lesson 2.
39. When designing a game in Greenfoot, it helps to define the actions that will take place in
a textual storyboard. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
40. In object oriented programming, programmers analyze a problem and create objects to
solve the problem. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
41. What does the following Greenfoot programming statement tell the class to do?
if (Greenfoot.getRandomNumber(100) < 6) { turn(18); } Mark for Review
(1) Points
If a random number is returned that is less than 6, turn 18 degrees. (*)
If a random number is returned that is less than 6, move 18 steps.
Turn 6 degrees, then turn 18 degrees.
If a random number is returned that is greater than 6, turn 18 degrees.
[Correct] Correct
42. From your Greenfoot lessons, which programming statement creates a new Bee object,
and places it at x = 120, y = 100 in the world? Mark for Review
(1) Points
addClass (new Bee( ), 120, 100);
addObject (new Bee( ), 120, 100); (*)
Move(120,100);
addWorld (new Bee( ), 120, 100);
[Correct] Correct
43. In Greenfoot, which of the following is the correct notation for calling a method for an
instance of a class? Mark for Review
(1) Points
class-name.method-name(parameters);
object-name.method-name(parameters); (*)
Method-name.object-name(parameters);
Method-name.object-name;
[Incorrect] Incorrect. Refer to Section 3 Lesson 5.
44. The list below displays characteristics of a Greenfoot world constructor, except for one.
Which one should be removed? Mark for Review
(1) Points
Has no return type.
Defines the instance’s size and resolution.
Has a void return type. (*)
Executed automatically when a new instance of the class is created.
Has the same name as the name of the class.
[Incorrect] Incorrect. Refer to Section 3 Lesson 5.
45. You cannot record unique sounds in Greenfoot. You can only use the sounds that are
stored in the Greenfoot library. True or false? Mark for Review
(1) Points
True
False (*)
[Correct] Correct
46. Greenfoot has tools to record sound. True or false? Mark for Review
(1) Points
True (*)
False
[Incorrect] Incorrect. Refer to Section 3 Lesson 7.
47. From your Greenfoot lessons, what is a loop? Mark for Review
(1) Points
A statement that can execute a method multiple times.
A statement that can execute a section of code one time.
A statement that executes one segment of code.
A statement that can execute a section of code multiple times. (*)
[Correct] Correct
48. In Greenfoot, when is a local variable most often used? Mark for Review
(1) Points
Within loop constructs (*)
Within the scenario
Within the world constructor
Within the act method
[Correct] Correct
49. Which of the following is not a component of a while loop? Mark for Review
(1) Points
Loop variable
Local variable
Control operator
if statement (*)
while keyword
[Correct] Correct
50. From your Greenfoot lessons, which of the following are examples of actions that can be
achieved using the while loop? Mark for Review
(1) Points
Create 50 instances of the Fly class.
Call the move method 1 million times.
Call the move and turn methods 10 times.
Create 100 instances of an Actor subclass.
All of the above. (*)
[Correct] Correct
1. In Alice, which of the following programming statements moves the cat forward the
distance to the bird? Mark for Review
(1) Points
this.Cat move forward {this.Bird getDistanceTo this.Cat / 2}
this.Cat move {this.Bird getDistanceTo this.Cat / 2}
this.Cat move forward {this.Cat getDistanceTo this.Bird} (*)
this.Bird move forward {this.Bird getDistanceTo this.Cat}
[Correct] Correct
2. In Alice, which of the following programming statements moves the butterfly forward,
double the distance to the tree? Mark for Review
(1) Points
this.Butterfly move forward {this.Butterfly getDistanceTo this.Tree / 2}
this.Butterfly move backward {this.Butterfly getDistanceTo this.Tree / 2}
this.Butterfly move forward {this.Butterfly getDistanceTo this.Tree * 2} (*)
this.Butterfly move backward {this.Butterfly getDistanceTo this.Tree * 2}
[Correct] Correct
3. Which of the following actions would require a control statement to control animation
timing? Mark for Review
(1) Points
(Choose all correct answers)
A bird flying. (*)
A biped object walking. (*)
A fish swimming. (*)
A rock object turning.
[Correct] Correct
4. In Alice, which procedure is used to assign one object as the vehicle of another? Mark for
Review
(1) Points
setObjectVehicle
setClassVehicle
setVehicle (*)
Vehicle
[Correct] Correct
5. In Alice, a computer program requires functions to tell it how to perform the procedure.
True or false? Mark for Review
(1) Points
True
False (*)
[Correct] Correct
6. From your Alice lessons, the Do In Order control statement is also referred to by what
other name? Mark for Review
(1) Points
Sequence control
Order control
Control order
Sequential control (*)
[Correct] Correct
7. In Alice, the If control structure can process one true and one false response. True or
false? Mark for Review
(1) Points
True (*)
False
[Incorrect] Incorrect. Refer to Section 2 Lesson 8.
8. You have a Class representing Cat. Each Cat can meow, purr, catch mice, and so on.
When you create a new cat, what is it called? Mark for Review
(1) Points
An instance (*)
A subprogram
A subclass
A submethod
A variable class
[Incorrect] Incorrect. Refer to Section 2 Lesson 14.
9. When you want specific code to be executed only if certain conditions are met, what type
of Java construct would you use? Mark for Review
(1) Points
boolean
array
while loop
if (*)
[Correct] Correct
10. From your Alice lessons, inheritance means that the superclass inherits its traits from the
subclass. True or false? Mark for Review
(1) Points
True
False (*)
[Correct] Correct
11. From your Alice lessons, which of the following is a tool to show the logic of an
animation? Mark for Review
(1) Points
Flowchart (*)
Visual storyboard
Pie chart
Class chart
Scene editor
[Correct] Correct
12. A scenario gives the Alice animation a purpose. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
13. In an Alice program, which code is executed when the Run button is clicked? Mark for
Review
(1) Points
The one-shot procedures selected in the Scene editor.
The code entered in the class’s procedure in the procedures tab.
The code entered in myMethod in the Code editor.
The code entered in myFirstMethod in the Code editor. (*)
[Correct] Correct
14. In Alice, you can access the Java on the side option through which menu option? Mark
for Review
(1) Points
Run
Window (*)
Edit
Project
[Correct] Correct
15. Define the value of the variable LapCount based on the following math calculation:
LapCount + 10 = 15 Mark for Review
(1) Points
4
10
5 (*)
2
15
[Correct] Correct
16. In Alice, functions are dragged into the control statement, not the procedure. True or
false? Mark for Review
(1) Points
True
False (*)
[Correct] Correct
17. From your Alice lessons, functional decomposition is the process of taking a complex
problem or process and growing it into larger parts that are easier to manage. True or false?
Mark for Review
(1) Points
True
False (*)
[Correct] Correct
18. From your Alice lessons, the “Checklist for Animation Completion” does not ask
questions about the scenario and storyboards, because these are not valid parts of the
animation creation process. True or false? Mark for Review
(1) Points
True
False (*)
[Correct] Correct
19. An Alice event is considered what? Mark for Review
(1) Points
A party with at least 20 people.
Error handling.
A keystroke or mouse click. (*)
An object’s orientation.
[Correct] Correct
20. When you import a class from another file you have to import the entire class. True or
false? Mark for Review
(1) Points
True
False (*)
[Correct] Correct
21. What is the result of the following code?
Mark for Review
(1) Points
x > y : false
x < y : true
x>y:x>y
x<y:x<y
x > y : true
x < y : false (*)
x>y:1
x<y:0
x>y:0
x<y:1
[Correct] Correct
22. If the value already exists in the variable it is overwritten by the assignment operator (=).
True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
23. Copying programming instructions saves time when programming your Alice project.
True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
24. Manually manipulating an Alice object with your cursor is a way to precisely position an
object. True or false? Mark for Review
(1) Points
True
False (*)
[Correct] Correct
Section 3
(Answer all questions in this section)
25. An instance variable can be saved and accessed later, even if the instance no longer
exists. True or false? Mark for Review
(1) Points
True
False (*)
[Correct] Correct
26. Using the Greenfoot IDE, only five instances can be added to a scenario. True or false?
Mark for Review
(1) Points
True
False (*)
[Correct] Correct
27. In Greenfoot, the body of the method is located in between which of the following
characters? Mark for Review
(1) Points
Curly brackets { } (*)
Parnetheses ( )
Square brackets [ ]
Asterisks **
[Correct] Correct
28. In Greenfoot, the instance has a source code editor. True or false? Mark for Review
(1) Points
True
False (*)
[Correct] Correct
29. In Greenfoot, you will not receive an error message if your code is incorrect. It will simply
not work, and you will have to determine why the code doesn’t work. True or false? Mark for
Review
(1) Points
True
False (*)
[Correct] Correct
30. When designing a game in Greenfoot, it helps to define the actions that will take place in
a textual storyboard. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
31. From your Greenfoot lessons, source code is written in the Code editor. True or false?
Mark for Review
(1) Points
True (*)
False
[Correct] Correct
32. In Greenfoot, only 10 methods can be written for each class in the Code editor. True or
false? Mark for Review
(1) Points
True
False (*)
[Correct] Correct
33. In Greenfoot, a constructor has a void return type. True or false? Mark for Review
(1) Points
True
False (*)
[Correct] Correct
34. What does the following programming statement mean?
image1 = new GreenfootImage(“duke12.png”); Mark for Review
(1) Points
The variable, image1, cannot use the image file, duke12.png.
The image file, duke12.png, has just been drawn and imported into the scenario.
Image files from 1-119 are associated with image1.
The image file, duke12.png, is assigned to the variable image1. (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 8.
35. The GreenfootImage class enables Greenfoot actors to maintain their visible image by
holding an object of type GreenfootImage. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
36. From your Greenfoot lessons, when does an if-else statement execute it’s second code
segment? Mark for Review
(1) Points
If a condition is true.
When an instance is created.
After the first code segment is executed.
If a condition is false. (*)
When a random number is less than 10.
[Correct] Correct
37. From your Greenfoot lessons, which axes define an object’s position in a world? Mark for
Review
(1) Points
(Choose all correct answers)
x (*)
w
y (*)
z
[Correct] Correct
38. Read the following method signature. Using your Greenfoot experience, what does this
method do?
public static int getRandomNumber (int limit) Mark for Review
(1) Points
Returns a random number for instances in the animal class only.
Returns a random coordinate position in the world.
Returns a random number less than 10.
Returns a random number between zero and the parameter limit. (*)
[Correct] Correct
39. The list below displays characteristics of a Greenfoot world constructor, except for one.
Which one should be removed? Mark for Review
(1) Points
Defines the instance’s size and resolution.
Has no return type.
Has a void return type. (*)
Has the same name as the name of the class.
Executed automatically when a new instance of the class is created.
[Correct] Correct
40. Defined methods are methods that are only created by the Greenfoot development
team? Mark for Review
(1) Points
True
False (*)
[Correct] Correct
41. In Greenfoot, which of the following statement is true about Defined Methods? Mark for
Review
(1) Points
A defined method must be called by your source code, normally in the Act method. (*)
A defined method is automatically executed once created.
A defined method is only relevant to the Greenfoot Development team.
A defined method only relates to the World class.
[Incorrect] Incorrect. Refer to Section 3 Lesson 6.
42. Which of the following Java syntax is used to correctly create a Bee subclass? Mark for
Review
(1) Points
private Bee extends World
public class Bee extends Animal (*)
public class Bee extends World
private class extends Actor
private class extends Bee
[Correct] Correct
43. In Greenfoot, after a subclass is created, what has to occur before instances can be
added to the scenario? Mark for Review
(1) Points
Compilation (*)
Editing of source code
Creation of an instance
Creation of source code
[Correct] Correct
44. If an end to a while loop is not established, what happens? Mark for Review
(1) Points
The condition becomes false after one minute of executions.
The code executes and does not stop. (*)
The code stops after 20 executions.
The code stops after 10 executions.
[Correct] Correct
45. An array is an object that holds multiple methods. True or false? Mark for Review
(1) Points
True
False (*)
[Correct] Correct
46. Which of the following is not a component of a while loop? Mark for Review
(1) Points
while keyword
Local variable
Control operator
Loop variable
if statement (*)
[Correct] Correct
47. In Greenfoot, arrays are a way to hold and access multiple variables, and assign
different values to new instances each time the while loop executes and produces a new
instance. True or false? Mark for Review
(1) Points
True (*)
False
[Incorrect] Incorrect. Refer to Section 3 Lesson 10.
48. In Greenfoot, which class has methods that allow you to get the status of the mouse?
Mark for Review
(1) Points
Greenfoot (*)
World
Scenario
Actor
[Incorrect] Incorrect. Refer to Section 3 Lesson 7.
49. In Greenfoot, you can only interact with the scenario using a keyboard. Mark for Review
(1) Points
True
False (*)
[Correct] Correct
50. In Greenfoot modifying an actors constructor to accept an initial speed is a form of
abstraction? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
1. Which of the following statements about methods is false? Mark for Review
(1) Points
Methods whose return type is not void are required to include a return statement specifying
what to return.
The order in which methods are listed within the class is not important.
Java does not permit nesting one method definition within another method’s definition.
Classes must be defined directly within a method definition. (*)
Correct Correct
2. Which of the following statements about methods is false? Mark for Review
(1) Points
Methods whose return type is not void are required to include a return statement specifying
what to return.
Classes must be defined directly within a method definition. (*)
The order in which methods are listed within the class is not important.
Java does not permit nesting one method definition within another method’s definition.
Correct Correct
3. From your Alice lessons, if you examined a science process that had many steps, which
of the following is a way that you could apply functional decomposition to this process? Mark
for Review
(1) Points
1. Identify the detailed steps for the science concept.
2. Present the problem as an animation.
1. Present the problem as an animation.
2. Further refine and define the tasks needed for each high level step.
3. Identify the high level steps for the science concept.
1. Identify the high level steps for the science concept.
2. Further refine and define the tasks needed for each high level step.
3. Present the problem as an animation. (*)
Present the problem as an animation.
Correct Correct
4. From your Alice lessons, when testing your animation, you should test that comments
were added below each sequence of instructions in the code. True or false? Mark for Review
(1) Points
True
False (*)
Incorrect Incorrect. Refer to Section 2 Lesson 12.
5. In Alice, which of the following programming statements moves the butterfly forward,
double the distance to the tree? Mark for Review
(1) Points
this.Butterfly move backward {this.Butterfly getDistanceTo this.Tree / 2}
this.Butterfly move forward {this.Butterfly getDistanceTo this.Tree / 2}
this.Butterfly move backward {this.Butterfly getDistanceTo this.Tree * 2}
this.Butterfly move forward {this.Butterfly getDistanceTo this.Tree * 2} (*)
6. In Alice, which of the following programming statements moves the alien backward the
distance to the asteroid, minus 2 meters? Mark for Review
(1) Points
this.Alien move backward {this.Alien getDistanceTo this.Asteroid * 2}
this.Alien move forward {this.Asteroid getDistanceTo this.Alien / 2}
this.Alien move backward {this.Alien getDistanceTo this.Asteroid -2} (*)
this.Asteroid move backward {this.Alien getDistanceTo this.Asteorid / 2}
Correct Correct
7. From your Alice lessons, which programming instruction represents the following
movement: A turtle moves forward half the distance to the flower. Mark for Review
(1) Points
this.Turtle move Forward this.Turtle getDistanceTo this.Flower / 0.5
this.Turtle move Forward this.Turtle getDistanceTo this.Flower * 2
this.Turtle move Forward this.Turtle getDistanceTo this.Flower / 2.0 (*)
this.Turtle move Forward this.Turtle getDistanceTo this.Flower / 1.0
Incorrect Incorrect. Refer to Section 2 Lesson 7.
8. In Alice, there is no way of seeing the code as Java code. True or false? Mark for Review
(1) Points
True
False (*)
Incorrect Incorrect. Refer to Section 2 Lesson 10.
9. Variable values can be changed as often as you like. True or false? Mark for Review
(1) Points
True (*)
False
Correct Correct
10. A textual storyboard helps the reader understand the actions that will take place during
the animation. True or false? Mark for Review
(1) Points
True (*)
False
Correct Correct
11. From your Alice lessons, which of the following is a tool to show the logic of an
animation? Mark for Review
(1) Points
Scene editor
Class chart
Flowchart (*)
Visual storyboard
Pie chart
Correct Correct
12. A flowchart is a useful way to illustrate how your Alice animation’s characters will look.
True or false? Mark for Review
(1) Points
True
False (*)
Incorrect Incorrect. Refer to Section 2 Lesson 5.
13. In Alice, when is the sceneActivationListener executed? Mark for Review
(1) Points
At the beginning of the animation (*)
When the user clicks on on object
When an object appears on screen
At the end of the animation
Correct Correct
14. In Alice, what tab would you choose to start a new animation with a pre-populated world?
Mark for Review
(1) Points
Starters (*)
Recent
My Projects
Blank Slate
Incorrect Incorrect. Refer to Section 2 Lesson 11.
15. From your Alice lessons, what is the purpose of nesting? Mark for Review
(1) Points
To add visual structure to your program. (*)
To add random movements to your program.
To add text to your program that tells the viewer what the code does.
To add more procedures to your program.
Incorrect Incorrect. Refer to Section 2 Lesson 4.
16. In Alice, Do In Order and Do Together: Mark for Review
(1) Points
Are move statements
Are control statements (*)
Are complex statements
None of the above
Correct Correct
17. In Alice, a walking motion for a bipedal object can be achieved without the Do Together
control statement. True or false? Mark for Review
(1) Points
True
False (*)
Correct Correct
18. In Alice, which of the following is not a control statement? Mark for Review
(1) Points
Do In Order
Count
While
Move (*)
Correct Correct
19. In Alice, we use the While control statement to implement the conditional loop. True or
false? Mark for Review
(1) Points
True (*)
False
Correct Correct
20. Manually manipulating an Alice object with your cursor is a way to precisely position an
object. True or false? Mark for Review
(1) Points
True
False (*)
Correct Correct
21. Which of the following does not describe variables? Mark for Review
(1) Points
Has a type associated with it.
A place in memory where data of a specific type can be stored for later retrieval and use.
Arranged in rows and columns. (*)
Has a unique name.
Correct Correct
22. In Alice, where are arithmetic operators available? Mark for Review
(1) Points
(Choose all correct answers)
If control
Size argument
Amount argument (*)
Duration argument (*)
Get Distance functions (*)
Correct Correct
23. Which of the following is not a reason for why comments are helpful in an Alice program?
Mark for Review
(1) Points
Comments describe the intention of the programming instructions.
Comments can outline the programming instructions.
Comments help during debugging and testing so the tester knows how the programming
statements are supposed to work.
Comments change the functionality of the program. (*)
Correct Correct
24. Which option copies a programming instruction to the clipboard? Mark for Review
(1) Points
Paste
Copy to Clipboard (*)
Is Enabled
Clipboard
25. Use you Greenfoot knowledge: What range of numbers does the following method
return?
Greenfoot.getRandomNumber(30) Mark for Review
(1) Points
A random number between 1 and 30.
A random number between 0 and 30.
A random number between 1 and 29.
A random number between 0 and 29. (*)
Correct Correct
26. When a Greenfoot code segment is executed in an if-statement, each line of code is
executed in sequential order. True or false? Mark for Review
(1) Points
True (*)
False
Correct Correct
27. Which of the following Greenfoot methods returns a random number between 0, up to
and including 10,000? Mark for Review
(1) Points
Greenfoot.getRandomNumber(0-10,000)
Greenfoot.getRandomNumber(9,999)
Greenfoot.getRandomNumber(10,000)
Greenfoot.getRandomNumber(10,001) (*)
Correct Correct
28. From your Greenfoot lessons, when does an if-else statement execute it’s second code
segment? Mark for Review
(1) Points
When an instance is created.
If a condition is true.
After the first code segment is executed.
When a random number is less than 10.
If a condition is false. (*)
Correct Correct
29. In Greenfoot, the move method expects what type of information in its parameters? Mark
for Review
(1) Points
Degrees to turn
Integer of steps to move forward (*)
String statement
True or false response
Correct Correct
30. In Greenfoot, which of the following options are not possible when associating an image
file with an instance? Mark for Review
(1) Points
Add a video (*)
Import an image
Draw an image
Select an image from the Greenfoot library
Correct Correct
31. Using the Greenfoot IDE, only five instances can be added to a scenario. True or false?
Mark for Review
(1) Points
True
False (*)
Correct Correct
32. In Greenfoot, the body of the method is located in between which of the following
characters? Mark for Review
(1) Points
Square brackets [ ]
Curly brackets { } (*)
Asterisks **
Parnetheses ( )
Correct Correct
33. Which keyword is used to add an actor to a Greenfoot world? Mark for Review
(1) Points
add
new
super
addObject (*)
Incorrect Incorrect. Refer to Section 3 Lesson 8.
34. In Greenfoot, the == operator is used to test if two values are equal. True or false? Mark
for Review
(1) Points
True (*)
False
Incorrect Incorrect. Refer to Section 3 Lesson 8.
35. In Greenfoot, a defined variable is a variable that is defined in an instance. True or false?
Mark for Review
(1) Points
True
False (*)
Incorrect Incorrect. Refer to Section 3 Lesson 8.
36. In Greenfoot you can interact with the scenario using a mouse. Mark for Review
(1) Points
True (*)
False
Correct Correct
37. From your Greenfoot lessons, the isKeyDown method is located in which class? Mark for
Review
(1) Points
Actor
Greenfoot (*)
World
GreenfootImage
Correct Correct
38. From your Greenfoot lessons, a problem statement defines the purpose for your game.
True or false? Mark for Review
(1) Points
True (*)
False
Correct Correct
39. Which of the following type of audience should you ask to play your Greenfoot game
during the testing phase? Mark for Review
(1) Points
Target (*)
Testing
Primary
Programmer
Correct Correct
40. Use your Greenfoot knowldege: If an Actor class Fly has a variable defined to store the
current speed, which of the following statements would successfully add a Fly and define the
current speed as 2? Mark for Review
(1) Points
addObject (new Fly(), 150, 150);
addObject (new Fly(2, 90), 150, 150);
addObject (new Fly(), 2, 150, 150);
addObject (new Fly(2), 150, 150); (*)
Incorrect Incorrect. Refer to Section 3 Lesson 9.
41. In Greenfoot, what is a common letter used for the loop variable? Mark for Review
(1) Points
I (*)
X
A
Y
Correct Correct
42. In the Greenfoot IDE, what does the AND operator (&&) do? Mark for Review
(1) Points
Compares two boolean values, and returns a boolean value which is true if and only if both
of its operands are true. (*)
Compares two boolean values and returns a boolean value which is true if either one of the
operands is true.
Compares two boolean values, and returns a boolean value which is true if and only if one of
its operands are true.
Compares two boolean variables or expressions and returns a result that is true if either of
its operands are true.
Correct Correct
43. From your Greenfoot lessons, which symbol represents string concatenation? Mark for
Review
(1) Points
Symbol + (*)
Symbol =
Symbol &
Symbol <
Correct Correct
44. How would the following sentence be written in Greenfoot source code? If Bee is turning,
and the keyboard key “d” is down… Mark for Review
(1) Points
if (!Greenfoot.isKeyDown && isTurning(“d”) )
if (!isTurning && Greenfoot.isKeyDown(“d”) )
if (&&isTurning ! Greenfoot.isKeyDown(“d”) )
if (isTurning && Greenfoot.isKeyDown(“d”) ) (*)
Incorrect Incorrect. Refer to Section 3 Lesson 10.
45. From your Greenfoot lessons, how do you call a defined method? Mark for Review
(1) Points
Write the method in the documentation.
Write the method in the instance.
Write the method in the Actor class.
Write the method in the World superclass.
Call the method from the act method. (*)
Correct Correct
46. A collision in Greenfoot is when two actors make contact? Mark for Review
(1) Points
True (*)
False
Correct Correct
47. In Greenfoot, which of the following methods return the world that the instance lives in?
Mark for Review
(1) Points
World getClass()
getXY()
getRotation()
World getWorld() (*)
Incorrect Incorrect. Refer to Section 3 Lesson 3.
48. From your Greenfoot lessons, where do you review a class’s inherited methods? Mark
for Review
(1) Points
Inspector
Documentation (*)
If-statement
Act method
Correct Correct
49. In Greenfoot, which of the following are execution controls? Mark for Review
(1) Points
(Choose all correct answers)
Move
Run (*)
Act (*)
Speed (*)
Turn
Incorrect Incorrect. Refer to Section 3 Lesson 1.
50. In Greenfoot, the Run button repeatedly executes all of the programming statements in
the class’s act method in sequential order until the pause button is clicked. True or false?
Mark for Review
(1) Points
True (*)
False
Correct Correct
1. In Java code the { } brackets are used to represent what statements? Mark for Review
(1) Points
(Choose all correct answers)
while
end (*)
for
begin (*)
[Correct] Correct
2. From your Alice lessons, variables are fixed and cannot be changed. True or false? Mark
for Review
(1) Points
True
False (*)
[Correct] Correct
3. When presenting your Alice animation, it is not important to give the audience a reason to
listen to the presentation. True or false? Mark for Review
(1) Points
True
False (*)
[Correct] Correct
4. From your Alice lessons, animations should be tested by the programmer before they are
considered complete. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
5. In an Alice program, which code is executed when the Run button is clicked? Mark for
Review
(1) Points
The code entered in the class’s procedure in the procedures tab.
The one-shot procedures selected in the Scene editor.
The code entered in myFirstMethod in the Code editor. (*)
The code entered in myMethod in the Code editor.
[Correct] Correct
6. When is an instance created in Alice? Mark for Review
(1) Points
After the code is created.
After the class icon is dragged into the scene. (*)
After the scenario is saved.
After the folder is selected in the gallery.
[Correct] Correct
7. In Alice, which of the following programming statements moves the cat backward, half the
distance to the bird? Mark for Review
(1) Points
this.Cat move backward {this.Bird getDistanceTo this.Cat / 2}
this.Cat move backward {this.Cat getDistanceTo this.Bird / 2} (*)
this.Bird move forward {this.Bird getDistanceTo this.Cat / 2}
this.Cat move forward {this.Bird getDistanceTo this.Cat / 2}
[Incorrect] Incorrect. Refer to Section 2 Lesson 9.
8. In Alice, which of the following programming statements moves the alien backward the
distance to the asteroid, minus 2 meters? Mark for Review
(1) Points
this.Alien move forward {this.Asteroid getDistanceTo this.Alien / 2}
this.Alien move backward {this.Alien getDistanceTo this.Asteroid -2} (*)
this.Asteroid move backward {this.Alien getDistanceTo this.Asteorid / 2}
this.Alien move backward {this.Alien getDistanceTo this.Asteroid * 2}
[Correct] Correct
9. In Alice, when two objects are synchronized and move together, this means that one
object is: Mark for Review
(1) Points
A vehicle of another (*)
An instance of another
A class of another
An object of another
[Correct] Correct
10. In Alice, the setVehicle procedure will associate one object to another. True or false?
Mark for Review
(1) Points
True (*)
False
[Correct] Correct
11. In Alice, which of the following is not a control statement? Mark for Review
(1) Points
Count
Move (*)
Do In Order
While
[Correct] Correct
12. If you need to repeat a group of Java statements many times, which Java construct
should you use? Mark for Review
(1) Points
(Choose all correct answers)
do while loop (*)
if
while loop (*)
repeat…until
[Correct] Correct
13. The condition in a WHILE loop is a boolean expression. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
14. Which of the following is not a relational operator? Mark for Review
(1) Points
>
<
// (*)
=
[Incorrect] Incorrect. Refer to Section 2 Lesson 13.
15. A data type defines the type of procedures a variable can store. True or false? Mark for
Review
(1) Points
True
False (*)
[Correct] Correct
16. In Alice, when is the sceneActivationListener executed? Mark for Review
(1) Points
When an object appears on screen
When the user clicks on on object
At the beginning of the animation (*)
At the end of the animation
[Incorrect] Incorrect. Refer to Section 2 Lesson 11.
17. Alice provides pre-populated worlds through which new menu tab? Mark for Review
(1) Points
Blank Slates
File System
Recent
Starters (*)
[Correct] Correct
18. Which of the following is not one of the positioning axes used in Alice 3? Mark for
Review
(1) Points
z
w (*)
y
x
[Correct] Correct
19. Functions answer questions about an object, such as its height, width, depth and even
distance to another object. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
20. In Alice, the If control structure can process one true and one false response. True or
false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
21. In Alice, which of the following arguments could be replaced with a random number?
Mark for Review
(1) Points
(Choose all correct answers)
Direction
Procedure name
Duration (*)
Distance (*)
Object name
[Correct] Correct
22. In Alice, which of the following situations could benefit from declaring a new procedure?
Mark for Review
(1) Points
(Choose all correct answers)
A single motion, such as walking, takes up a lot of room in myFirstMethod. (*)
An object needs to say three statements.
An object does not have a default procedure for a motion, such as swimming. (*)
Multiple objects need to use a motion, such as bunnies hopping. (*)
An object needs to move forward, then move up 10 meters.
[Incorrect] Incorrect. Refer to Section 2 Lesson 5.
23. Which of the following is a reason why procedural abstraction may be used in
programming an animation? Mark for Review
(1) Points
(Choose all correct answers)
The programmer wants to reuse the code. (*)
The code is difficult to read. (*)
The programmer wants to save the animation.
The code is too long. (*)
[Incorrect] Incorrect. Refer to Section 2 Lesson 5.
24. From your Alice lessons, what does inheritance mean? Mark for Review
(1) Points
Each subclass inherits the methods and properties of its superclass. (*)
Each class has its own methods and properties that are non-transferable to any other class.
Each superclass inherits the methods and properties of its subclass.
Each class inherits the methods and properties of all classes available in Alice.
[Correct] Correct
Section 3
(Answer all questions in this section)
25. In Greenfoot, which method would you use to obtain input from the user? Mark for
Review
(1) Points
ask() (*)
getText()
input()
getInput()
[Correct] Correct
26. In Greenfoot, what type of parameter does the isKeyDown method expect? Mark for
Review
(1) Points
Boolean
Method
String (*)
Integer
[Correct] Correct
27. In Greenfoot, string concatenation reduces the number of redundant characters or
phrases you need to type into each array. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
28. From your Greenfoot lessons, which of the following are examples of actions that can be
achieved using the while loop? Mark for Review
(1) Points
Create 50 instances of the Fly class.
Call the move method 1 million times.
Call the move and turn methods 10 times.
Create 100 instances of an Actor subclass.
All of the above. (*)
[Correct] Correct
29. Which of the following is an example of string concatenation? Mark for Review
(1) Points
Instead of entering “.png” after each image file name, add && “.png” after the imageName
value in the programming statement.
Instead of entering “.png” after each image file name, add = “.png” after the imageName
value in the programming statement.
Instead of entering “.png” after each image file name, add + “.png” after the imageName
value in the programming statement. (*)
Instead of entering “.png” after each image file name, add “.png” after the imageName value
in the programming statement.
[Correct] Correct
30. In Greenfoot, which of the following statements could prevent an infinite loop from
occurring? Mark for Review
(1) Points
i = i + 1 (*)
I = 100 + i
i=1
i=i
[Correct] Correct
1. From your Greenfoot lessons, which of the following is not a step to creating a new
subclass? Mark for Review
(1) Points
Click New subclass…
Right-click on a superclass.
Name the class.
Program the class to move forward. (*)
Select an image for the class.
[Correct] Correct
32. In Greenfoot, the Run button repeatedly executes all of the programming statements in
the class’s act method in sequential order until the pause button is clicked. True or false?
Mark for Review
(1) Points
True (*)
False
[Correct] Correct
33. Which one of the following can be used to detect when 2 actors collide? Mark for Review
(1) Points
hasCollided()
isContact()
isCollision()
isTouching() (*)
[Correct] Correct
34. A collision in Greenfoot is when two actors make contact? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
35. Writing more generic statements to handle the creation and positioning of many objects
is one Abstraction technique? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
36. When designing a game in Greenfoot, it helps to define the actions that will take place in
a textual storyboard. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
37. Which of the following is an incorrectly written programming statement? Mark for Review
(1) Points
turn(2);
move(): (*)
move(2);
turn(25);
[Correct] Correct
38. Which of the following comparison operators represents “greater than or equal”? Mark
for Review
(1) Points
==
>= (*)
>
!=
[Correct] Correct
39. When a Greenfoot code segment is executed in an if-statement, each line of code is
executed in sequential order. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
40. Which of the following Greenfoot methods returns a random number between 0, up to
and including 10,000? Mark for Review
(1) Points
Greenfoot.getRandomNumber(10,001) (*)
Greenfoot.getRandomNumber(9,999)
Greenfoot.getRandomNumber(0-10,000)
Greenfoot.getRandomNumber(10,000)
[Correct] Correct
41. In Greenfoot, which of the following is the correct notation for calling a method for an
instance of a class? Mark for Review
(1) Points
class-name.method-name(parameters);
Method-name.object-name(parameters);
object-name.method-name(parameters); (*)
Method-name.object-name;
[Correct] Correct
42. Which Greenfoot control operator is used to test if two values are equal? Mark for
Review
(1) Points
!= operator
>= operator
== operator (*)
= operator
[Correct] Correct
43. Constructors are called automatically when a new intance of a class is created? True or
false? Mark for Review
(1) Points
True (*)
False
[Incorrect] Incorrect. Refer to Section 3 Lesson 8.
44. Using the Greenfoot IDE, when is a constructor automatically executed? Mark for
Review
(1) Points
When the act method is executed.
When a new image is added to the class.
When a new instance of the class is created. (*)
When source code is written.
[Correct] Correct
45. From your Greenfoot lessons, if the condition in an if-statement is true, the first code
segment is executed. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
46. The list below provides actions you can perform in the Greenfoot code editor except one.
Which one should be removed? Mark for Review
(1) Points
Write source code to tell the class how to act in the scenario.
Write and edit source code.
Write and edit comments.
Review the online Java Library documentation. (*)
[Correct] Correct
47. In Greenfoot, the turn method expects what type of information in its parameters? Mark
for Review
(1) Points
Degrees to turn (*)
Parameter void
Integer of steps to move forward
String statement
True or false response
[Correct] Correct
48. In the Greenfoot IDE, an instance’s position is on the x and y coordinates. True or false?
Mark for Review
(1) Points
True (*)
False
[Correct] Correct
49. In Greenfoot, the instance has a source code editor. True or false? Mark for Review
(1) Points
True
False (*)
[Correct] Correct
50. A variable is also known as a ____________. Mark for Review
(1) Points
Field (*)
Class
Method
Instance
Syntax
[Correct] Correct
1. In Alice, how would you get the length of a fish object? Mark for Review
(1) Points
getHeight
getDepth (*)
getWidth
getLength
[Incorrect] Incorrect. Refer to Section 2 Lesson 7.
Which of the following ways can you modify the code in the code editor window? Mark for
Review
(1) Points
(Choose all correct answers)
Drag to reorder (*)
Copy & paste (*)
Count
Disable (*)
[Incorrect] Incorrect. Refer to Section 2 Lesson 3.
1. An event is any action initiated by the user that is designed to influence the program メ s
execution during play. Mark for Review
(1) Points
True (*)
False
Correct Correct
2. When you import a class from another file you have to import the entire class. True or
false? Mark for Review
(1) Points
True
False (*)
Correct Correct
3. In Alice, which of the following programming statements moves the cat backward, half the
distance to the bird? Mark for Review
(1) Points
this.Cat move backward {this.Bird getDistanceTo this.Cat / 2}
this.Bird move forward {this.Bird getDistanceTo this.Cat / 2}
this.Cat move backward {this.Cat getDistanceTo this.Bird / 2} (*)
this.Cat move forward {this.Bird getDistanceTo this.Cat / 2}
Incorrect Incorrect. Refer to Section 2 Lesson 9.
4. In Alice, we can avoid object collision using what? Mark for Review
(1) Points
Slowing movements down.
Using object detection.
Downloading the Alice 3 collision detector app.
Using math operators. (*)
Correct Correct
5. Which Alice execution task corresponds with the following storyboard statement?
Cat rolls to the left. Mark for Review
(1) Points
Cat roll Right 1
roll Left 1
Cat roll Left 1
this.Cat roll Left 1.0 (*)
Incorrect Incorrect. Refer to Section 2 Lesson 4.
6. How do you create a programming instruction in Alice? Mark for Review
(1) Points
Click and drag the desired programming instruction into the Scene editor.
Click and drag the desired programming instruction into the Functions tab.
Click and drag the desired programming instruction into the Procedures tab.
Click and drag the desired programming instruction into the myFirstMethod tab. (*)
Correct Correct
7. Alice objects move relative to the orientation of the person viewing the animation. True or
false? Mark for Review
(1) Points
True
False (*)
Incorrect Incorrect. Refer to Section 2 Lesson 2.
8. From your Alice lessons, built-in functions provide precise property details for the following
areas: Mark for Review
(1) Points
Proximity and point of view.
Proximity and size.
Distance to and nesting.
Proximity, size, spatial relation, and point of view. (*)
Correct Correct
9. Main is an example of what in the following code?
public static void main (String[] args) {
System.out.println{“Hello World!”);
} Mark for Review
(1) Points
An instance
A method (*)
A class
A variable
Incorrect Incorrect. Refer to Section 2 Lesson 14.
10. Main is an example of what in the following code?
public static void main (String[] args) {
System.out.println{“Hello World!”);
} Mark for Review
(1) Points
A class
An instance
A variable
A method (*)
Incorrect Incorrect. Refer to Section 2 Lesson 14.
11. In Alice, which of the following situations could benefit from declaring a new procedure?
Mark for Review
(1) Points
(Choose all correct answers)
An object does not have a default procedure for a motion, such as swimming. (*)
Multiple objects need to use a motion, such as bunnies hopping. (*)
A single motion, such as walking, takes up a lot of room in myFirstMethod. (*)
An object needs to say three statements.
An object needs to move forward, then move up 10 meters.
Incorrect Incorrect. Refer to Section 2 Lesson 5.
12. In Alice, what are the forms of a scenario? Mark for Review
(1) Points
(Choose all correct answers)
A section of code to write.
A task to perform. (*)
A system to start.
A person to help.
A problem to solve. (*)
Correct Correct
13. Defining the scenario, and the Alice animation to represent the scenario, is the first step
to programming your animation. True or false? Mark for Review
(1) Points
True (*)
False
Correct Correct
14. What can be used as a guideline to ensure your Alice animation fulfills animation
principles? Mark for Review
(1) Points
An animation checklist (*)
Other programmers
A close friend
The Internet
Correct Correct
15. The animation checklist helps you confirm that all elements of the Alice animation are
operating as expected. True or false? Mark for Review
(1) Points
True (*)
False
Correct Correct
16. When you disable a programming instruction, it is still executed when you run the Alice
animation. True or false? Mark for Review
(1) Points
True
False (*)
Correct Correct
17. Which of the following is not an Alice variable value type? Mark for Review
(1) Points
Color
Decimal Number
Whole Number
Function (*)
Correct Correct
18. In Alice, there is no way of seeing the code as Java code. True or false? Mark for
Review
(1) Points
True
False (*)
Correct Correct
19. The following are examples of what in Java?
boolean
bite
char
short
int
long
float
double
Mark for Review
(1) Points
Specifications
Types (*)
Expressions
Variables
Correct Correct
20. Examine the following code. What are the variables?
Mark for Review
(1) Points
(Choose all correct answers)
i (*)
t (*)
n (*)
args (*)
Correct Correct
21. In Alice, which procedure is used to assign one object as the vehicle of another? Mark
for Review
(1) Points
setVehicle (*)
Vehicle
setObjectVehicle
setClassVehicle
Incorrect Incorrect. Refer to Section 2 Lesson 6.
22. In Alice, a walking motion for a bipedal object can be achieved without the Do Together
control statement. True or false? Mark for Review
(1) Points
True
False (*)
Correct Correct
23. In Alice, Do In Order and Do Together: Mark for Review
(1) Points
Are move statements
Are control statements (*)
Are complex statements
None of the above
Correct Correct
24. A conditional loop is a loop that will continue forever. True or false? Mark for Review
(1) Points
True
False (*)
Correct Correct
Section 3
(Answer all questions in this section)
25. In Greenfoot, you will never have to cast as we only ever use 2 classes – World and
Actor. Mark for Review
(1) Points
True
False (*)
Correct Correct
26. The list below provides actions you can perform in the Greenfoot code editor except one.
Which one should be removed? Mark for Review
(1) Points
Write source code to tell the class how to act in the scenario.
Review the online Java Library documentation. (*)
Write and edit source code.
Write and edit comments.
Correct Correct
27. From your Greenfoot lessons, which of the following methods return the current rotation
of the object? Mark for Review
(1) Points
getXY()
World getClass()
World getWorld()
int getRotation() (*)
Correct Correct
28. When designing a game in Greenfoot, it helps to define the actions that will take place in
a textual storyboard. True or false? Mark for Review
(1) Points
True (*)
False
Correct Correct
29. When a program is tested once and it works then testing is complete. Mark for Review
(1) Points
True
False (*)
Correct Correct
30. In Greenfoot you can interact with the scenario using a mouse. Mark for Review
(1) Points
True (*)
False
Correct Correct
31. In Greenfoot, which class has methods that allow you to get the status of the mouse?
Mark for Review
(1) Points
Scenario
Actor
World
Greenfoot (*)
Correct Correct
32. Which of the following are examples of default superclasses that are present in a new
Greenfoot scenario? Mark for Review
(1) Points
(Choose all correct answers)
Cat
Parrot
World (*)
Dog
Actor (*)
Incorrect Incorrect. Refer to Section 3 Lesson 1.
33. Which of the following demonstrates a Greenfoot subclass/superclass relationship? Mark
for Review
(1) Points
A single person is a superclass of the human subclass.
A computer is a subclass of a video game superclass.
A rose is a subclass of the flower superclass. (*)
A dog is a subclass of the cat superclass.
Incorrect Incorrect. Refer to Section 3 Lesson 1.
34. Which of the following Greenfoot logic operators represents “not”? Mark for Review
(1) Points
&
! (*)
=
&&
Correct Correct
35. If an end to a while loop is not established, what happens? Mark for Review
(1) Points
The code stops after 10 executions.
The code executes and does not stop. (*)
The condition becomes false after one minute of executions.
The code stops after 20 executions.
Correct Correct
36. Use your Greenfoot knowledge to answer the question: String concatenation is a way to
avoid having to write additional characters in your source code. True or false? Mark for
Review
(1) Points
True (*)
False
Correct Correct
37. In a Greenfoot loop constructor, which component is a counter that controls how many
times the statement is executed? Mark for Review
(1) Points
Loop variable (*)
Local loop
Condition
While loop
Incorrect Incorrect. Refer to Section 3 Lesson 10.
38. In Greenfoot, the body of the method is located in between which of the following
characters? Mark for Review
(1) Points
Curly brackets { } (*)
Asterisks **
Parnetheses ( )
Square brackets [ ]
Correct Correct
39. In Greenfoot, the instance has a source code editor. True or false? Mark for Review
(1) Points
True
False (*)
Correct Correct
40. A variable is also known as a ____________. Mark for Review
(1) Points
Class
Instance
Method
Syntax
Field (*)
Correct Correct
41. Using the Greenfoot IDE, only five instances can be added to a scenario. True or false?
Mark for Review
(1) Points
True
False (*)
Correct Correct
42. In Greenfoot, which keyword calls the World superclass? Mark for Review
(1) Points
addObject
super (*)
new
world
constructor
Correct Correct
43. In a Greenfoot if-else statement, if the condition is true, the if-statement is executed, and
then the else-statement is executed. True or false? Mark for Review
(1) Points
True
False (*)
Correct Correct
44. Use you Greenfoot knowledge: What range of numbers does the following method
return?
Greenfoot.getRandomNumber(30) Mark for Review
(1) Points
A random number between 0 and 29. (*)
A random number between 1 and 30.
A random number between 0 and 30.
A random number between 1 and 29.
Correct Correct
45. Which of the following comparison operators represents “greater than or equal”? Mark
for Review
(1) Points
>
!=
>= (*)
==
Correct Correct
46. In Greenfoot, which of the following statement is true about Defined Methods? Mark for
Review
(1) Points
A defined method only relates to the World class.
A defined method is only relevant to the Greenfoot Development team.
A defined method must be called by your source code, normally in the Act method. (*)
A defined method is automatically executed once created.
Correct Correct
47. In reference to Greenfoot, if the following method was defined in a superclass,
public void turnAtEdge(){

}
all subclasses of the superclass will inherit the method.
True or false? Mark for Review
(1) Points
True (*)
False
Correct Correct
48. Where can we review the available classes and methods in Greenfoot, including the stop
method? Mark for Review
(1) Points
Greenfoot Application Programmers’ Interface (API) (*)
Object menu
Class Application Programmers’ Interface (API)
Class menu
Incorrect Incorrect. Refer to Section 3 Lesson 8.
49. In Greenfoot, we typically use the act method in the class to automatically create the
Actor instances when the world is initialized. True or false? Mark for Review
(1) Points
True
False (*)
Correct Correct
50. Which of the following Greenfoot programming statements creates a new instance of
Bee and places it at x = 140, y = 130 in the world? Mark for Review
(1) Points
new(Bee( ) 140, 130);
new(addObject(Bee ), 140, 130);
addObject(new( ), 140, 130);
addObject(new Bee( ), 140, 130); (*)
Correct Correct
2. From your Greenfoot lessons, a scenario is a game or simulation implemented in
Greenfoot. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
3. In Greenfoot, after a subclass is created and compiled, you cannot edit the subclass’s
source code. True or false? Mark for Review
(1) Points
True
False (*)
[Correct] Correct
1. What are Java’s simple types?
boolean, byte, char, double, float, int, long, and short (*)
boolean, byte, string, thread, int, double, long and short
object, byte, string, char, float, int, long and short
boolean, thread, stringbuffer, char, int, float, long and short
boolean, thread, char, double, float, int, long and short
2. Which of the following are relational operators in Java? (Choose all correct answers)
< (*)
<= (*)
=
!= (*)
All of the above.
3. What is the output of the following lines of code?
int j=6,k=4,m=12,result;
result=j/m*k;
System.out.println(result);
2
0 (*)
48
24
4. A local variable has precedence over a global variable in a Java method. True or false?
True (*) False
5. What does the following program output?
total cost: + 40
total cost: 48
total cost: 40 (*)
“total cost: ” 48
“total cost: ” 40
6. What is the result when the following code segment is compiled and executed?
int x = 22, y = 10;
double p = Math.sqrt( ( x + y ) /2);
System.out.println(p);
Syntax error “sqrt(double) in java.lang.Math cannot be applied to int”
4.0 is displayed (*)
2.2 is displayed
5.656854249492381 is displayed
ClassCastException
7. Determine whether this boolean expression evaluates to true or false:
!(3<4&&6>6||6<=6&&7-2==6)
True (*) False
8. In an if-else construct the condition to be evaluated must end with a semi-colon. True or
false?
True False (*)
9. Which of the two diagrams below illustrate the general form of a Java program?
Example A
Example B (*)
10. In a For loop the counter is not automatically incremented after each loop iteration. Code
must be written to increment the counter. True or false?
True (*) False
11. When the For loop condition statement is met the construct is exited. True or false?
True False (*)
12. You can return to the Eclipse Welcome Page by choosing Welcome from what menu?
File
Edit
Help (*)
Close
13. In Eclipse, when you run a Java Application, where may the results display?
Editor Window
Console View (*)
Debug View
Task List
None of the above
14. A combination of views and editors are referred to as _______________.
A workspace
A physical location
A perspective (*)
All of the above
15. What are the Eclipse Editor Area and Views used for?(Choose all correct answers)
To modify elements. (*)
To navigate a hierarchy of information. (*)
To choose the file system location to delete a file.
16. What is the output of the following code segment:
int n = 13;
System.out.print(doNothing(n));
System.out.print(” “, n);
where the code from the function doNothin is:
public double doNothing(int n)
{
n = n + 8;
return (double) 12/n;
}
1.75, 13
0.571, 21
1.75, 21
0.571, 13 (*)
17. Updating the input of a loop allows you to implement the code with the next element
rather than repeating the code always with the same element. True or false?
True (*) False
18. One advantage to using a WHILE loop over a FOR loop is that a WHILE loop always has
a counter. True or false? True False (*)
19. Which of the following could be a reason to use a switch statement in a Java program?
Because it allows the code to be run through until a certain conditional statement is true.
Because it allows the program to run certain segments of code and neglect to run others
based on the input given. (*)
Because it terminates the current loop.
Because it allows the user to enter an input in the console screen and prints out a message
that the user input was successfully read in.
20. In Java, an instance field referenced using the this keyword generates a compilation
error. True or false?
True False (*)
21. Consider
public class YourClass{ public YourClass(int i){/*code*/} // more code…}
To instantiate YourClass, what would you write?
YourClass y = new YourClass();
YourClass y = new YourClass(3); (*)
YourClass y = YourClass(3);
YourClass y = YourClass();
None of the above.
22. A constructor must have the same name as the class it is declared within. True or false?
True (*) False
23. Which of the following keywords are used to control access to the member of a class?
default
public (*)
class
All of the above.
None of the above.
24. Which of the following creates a method that compiles with no errors in the class?
(*)
All of the above.
None of the above
25. The following code creates an Object of type Horse. True or false?
Whale a=new Whale();
True False (*)
26. What operator do you use to call an object’s constructor method and create a new
object?
+
new (*)
instanceOf
27. Which of the following declares a one dimensional array name scores of type int that can
hold 14 values?
int scores;
int[] scores=new int[14]; (*)
int[] scores=new int[14];
int score= new int[14]
28. Which of the following statements is not a valid array declaration?
int number[];
float []averages;
double marks[5];
counter int[]; (*)
29. What is the output of the following segment of code if the command line arguments are
“a b c d e f”?
1
3
5
6 (*)
30. Which of the following declares a one dimensional array named names of size 8 so that
all entries can be Strings?
String names=new String[8];
String[] name=new Strings[8];
String[] names=new String[8]; (*)
String[] name=String[8];
31. What will the following code segment output?
String s=”\\\\\
System.out.println(s);
“\\\\\”
\\\\\\\\
\\
\\\\ (*)
32. Consider the following code snippet.
What is printed? Mark for Review
(1) Points
88888 (*)
88888888
1010778
101077810109
ArrayIndexOutofBoundsException is thrown
33. Given the code
String s1 = “abcdef”;
String s2 = “abcdef”;
String s3 = new String(s1);
Which of the following would equate to false?
s1 == s2
s1 = s2
s3 == s1 (*)
s1.equals(s2)
s3.equals(s1)
34. How would you use the ternary operator to rewrite this if statement?
if (balance < 500)
fee = 10;
else
fee = 0;
fee = ( balance < 500) ? 0 : 10;
fee= ( balance < 500) ? 10 : 0; (*)
fee = ( balance >= 5) ? 0 : 10;
fee = ( balance >= 500) ? 10 : 0;
fee = ( balance > 5) ? 10 : 0;
35. If an exception is thrown by a method, where can the catch for the exception be?
There does not need to be a catch in this situation.
The catch must be in the method that threw the exception.
The catch can be in the method that threw the exception or in any other method that called
the method that threw the exception. (*)
The catch must be immediately after the throw.
36. Choose the best response to this statement: An error can be handled by throwing it and
catching it just like an exception.
True. Errors and exceptions are the same objects and are interchangeable.
False. An error is much more severe than an exception and cannot be dealt with adequately
in a program. (*
True. Although errors may be more severe than exceptions they can still be handled in code
the same way exceptions are. False. Exceptions are caused by a mistake in the code and
errors occur for no particular reason and therefore cannot be handled or avoided.
37. Which of the following could be a reason to throw an exception?
To eliminate exceptions from disrupting your program. (*)
You have a fatal error in your program.
You have encountered a Stack Overflow Error.
To make the user interface harder to navigate.
38. Suppose you misspell a method name when you call it in your program. Which of the
following explains why this gives you an exception?
Because the parameters of the method were not met.
Because the interpreter does not recognize this method since it was never initialized, the
correct spelling of the method was initialized.
Because the interpreter tries to read the method but when it finds the method you intended
to use it crashes.
This will not give you an exception, it will give you an error when the program is compiled. (*)
39. Which of the following is the correct way to call an overriden method needOil() of a super
class Robot in a subclass SqueakyRobot?
Robot.needOil(SqueakyRobot);
SqueakyRobot.needOil();
super.needOil(); (*)
needOil(Robot);
40. Why are hierarchies useful for inheritance?
They keep track of where you are in your program.
They restrict a superclass to only have one subclass.
They organize constructors and methods in a simplified fashion.
They are used to organize the relationship between a superclass and its subclasses. (*)
41. It is possible for a subclass to be a superclass. True or false?
True (*) False
42. Static methods can write to instance variables. True or false?
True False (*)
43. Static classes are designed as thread safe class instances. True or false?
True False (*)
44. Public static variables can’t have their value reset by other classes. True or false?
True False (*)
45. Choose the correct implementation of a public access modifier for the method divide.
divide(int a, int b, public) {return a/b;}
public divide(int a, int b) {return a/b;} (*)
divide(int a, int b) {public return a/b;}
divide(public int a, public int b) {return a/b;}
46. Which of the following specifies accessibility to variables, methods, and classes?
Methods
Parameters
Overload constructors
Access specifiers (*)
47. Which segment of code represents a correct way to call a variable argument method
counter that takes in integers as its variable argument parameter?
counter(String a, int b);
counter(int[] numbers);
counter(1, 5, 8, 17, 11000005); (*)
counter(“one”,”two”,String[] nums);
48. Which of the following can be declared final?
Classes
Methods
Local variables
Method parameters
All of the above (*)
49. Which of the following would be most beneficial for this scenario?
Joe is a college student who has a tendency to lose his books. Replacing them is getting
costly. In an attempt to get organized, Joe wants to create a program that will store his
textbooks in one group of books, but he wants to make each book type the subject of the
book (i.e. MathBook is a book). How could he store these different subject books into a
single array?
By ignoring the subject type and initializing all the book as objects of type Book.
By overriding the methods of Book.
Using polymorphism. (*)
This is not possible. Joe must find another way to collect the books.
50. What is Polymorphism?
A way of redefining methods with the same return type and parameters.
A way to create multiple methods with the same name but different parameters.
A class that cannot be initiated.
The concept that a variable or reference can hold multiple types of objects. (*)
1. Select the statement that declares a number of type double and initializes it to 6 times 10
to the 5th power.
double number=6*10^5;
double number=6e5; (*)
double number=6(e5);
double number=6*10e5;
2. Which of the following expressions will evaluate to true when x and y are boolean
variables with opposite values?
I. (x || y) && !(x && y)
II. (x && !y) || (!x && y)
III. (x || y) && (!x ||!y)
I only
II only
I and III
II and III
I, II, and III (*)
3. The six relational operators in Java are:
>,<,=,!,<=,>=
>,<,==,!=,<=,>= (*)
>,<,=,!=,<=,>=
>,<,=,!=,=<,=>
4. Examine the following code: What is the value of variable x?
2 (*)
2.5
6
14
5. What is the result when the following code segment is compiled and executed?
int x = 22, y = 10;
double p = Math.sqrt( ( x + y ) /2);
System.out.println(p);
Syntax error “sqrt(double) in java.lang.Math cannot be applied to int”
4.0 is displayed (*)
2.2 is displayed
5.656854249492381 is displayed
ClassCastException
6. Which of the following is not a legal name for a variable?
2bad (*)
zero
theLastValueButONe
year2000
7. What is the output of the following lines of code?
int j=6,k=8,m=2,result;
result=j-k%3*m;
System.out.println(result);
6
0
-42
2 (*)
8. When importing another package into a class you must import only the package classes
that will be called and not the entire package. True or false?
True
False (*)
9. Which of the two diagrams below illustrate the correct syntax for variables used in an if-
else statement?
Example A (*)
Example B
10. In an if-else construct the condition to be evaluated must end with a semi-colon. True or
false?
True
False (*)
Incorrect. Refer to Section 4 Lesson 2.
11. In the code fragment below, the syntax for the for loop’s initialization is correct. True or
false?
public class ForLoop {
public static void main (String args[])
{
for ((int 1=10) (i<20) (i++))<
{System.out.Println (“i: “+i); }
}
}
True
False (*)
12. In Eclipse, when you run a Java Application, where may the results display?
Editor Window
Console View (*)
Debug View
Task List
None of the above
13. A combination of views and editors are referred to as _______________.
A workspace
A physical location
A perspective (*)
All of the above
14. You can return to the Eclipse Welcome Page by choosing Welcome from what menu?
File
Edit
Help (*)
Close
15. A workspace is:
The physical location onto which you will store and save your files.
The location where all projects are developed and modified.
The location where you can have one or more stored perspectives.
All of the above. (*)
16. What should replace the comment “//your answer here” in the code below if the code is
meant to take no action when i % 2 is 0 (in other words when i is even)?
for(int i = 0; i < 10; i++){
if(i%2 == 0)
//your answer here
else
k+=3;
}
continue; (*)
break;
return;
k+=1;
17. One advantage to using a WHILE loop over a FOR loop is that a WHILE loop always has
a counter. True or false?
True
False (*)
18. Consider that a Scanner has been initialized such that:
Scanner in = new Scanner(System.in);
Which of the following lines of code reads in the user’s input and sets it equal to a new String
called input?
String input = in.next(); (*)
String input = in.close();
String input = new String in.next();
String input = in.nextInt();
19. Switch statements work on all input types including, but not limited to, int, char, and
String. True or false?
True
False (*)
20. What is wrong with the following class declaration?
class Account{ ;
privateint number;
privateString name;;
Account;;
}
Classes cannot include strings.
Classes cannot include mixed data types.
The constructor method has no definition. (*)
There is nothing wrong.
21. A class always has a constructor. True or false?
True (*)
False
22. Which of the following creates an instance of the class below?
ThisClass t=new ThisClass();
ThisClass t;
ThisClass t=new ThisClass(3,4);
ThisClass t=new ThisClass(5); (*)
Incorrect. Refer to Section 5 Lesson 2.
23. Which of the following creates a class named Student with one constructor, and 2
instance variables name and gpa?
public class Student { private String name; private float gpa; }
public class Student private String name; private float gpa; Student();
public class Student { private String name; private float gpa; Student(){ name=”Jane Doe”;
gpa=3.0;} } (*)
public class Student { private String name; Student{ name=”Jane Doe”; float gpa=3.0; }
Incorrect. Refer to Section 5 Lesson 2.
24. Which of the following creates an object from the Animal class listed below:
Animal cat=new Animal();
Animal cat=Animal(50,30);
Animal cat=new Animal(50,30); (*)
Animal cat=new Animal(50);
25. What is true about the code below:
Car car1=new Car();
Car car2=new Car();
car2=car1;
The references car1 and car2 are pointing to two Car Objects in memory.
The reference car2 points to an exact copy of the Car Object that car1 references.
There are no more Car objects in memory.
There is a Car object that car1 referenced that is now slated for removal by the garbage
collector. (*)
There is a Car object that car2 referenced that is now slated for removal by the garbage
collector.
Incorrect. Refer to Section 5 Lesson 2.
26. A constructor must have the same name as the class it is declared within. True or false?
True (*)
False
Section 6
27. What is the output of the following segment of code?
int array[][] = {{1,2,3},{3,2,1}};
for(int i=0;i<2;i++)
for(int j=0;j<3;j++)
System.out.print(2*array[1][1]);
444444 (*)
123321
246642
222222
This code doesn’t compile.
28. Which of the following statements adds 5 to every element of the one dimensional array
prices and then prints it to the screen?
for(int i=0;i,<,=,!,<=,>=
� >,<,=,!=,=<,=>
� >,<,=,!=,<=,>=
� >,<,==,!=,<=,>= (*)
2. Determine whether this boolean expression evaluates to true or false:
!(3<4&&5>6||6<=6&&7-1==6) True False (*)
3. The three logic operators in Java are:
� !=,=,==
� &&, ||, ! (*)
� &&,!=,=
� &,|,=
4. What will print if the following Java code is executed?
0 3 (*) 4 5
5. What is the difference between the symbols = and == ?
� The symbol = is used in if statements and == is used in loops.
� The symbol == is used to assign values to variables and the = is used in declarations.
� The = is use to assign values to variables and the == compares values. (*)
� There is no difference.
6. What is the output of the following lines of code?
int j=7,k=5,m=8,result; result=j/m*k; System.out.println(result);
0 (*) 4.375 0.175 280
7. What is the output of the following lines of code?
int j=7,k=5,m=8,result; result=j-k%3*m; System.out.println(result);
0 16 2 -9 (*)
8. Which of the following is not correct Java code?
� double x=Math.sqrt(16);
� double x=Math.pow(3,4)*5.0;
� double x=Math.PI*5.0;
� double x=Math.pow; (*)
9. Which line of Java code assigns the value of 5 raised to the power of 8 to a?
� double a=15^8;
� double a=Math.pow(5,8); (*)
� int a=Math.pow(8,5);
� int a=Math.pow(5,8);
� double a=pow(8,5);
10. Write a declaration statement that will hold a number like 2.541.
� char number;
� int number;
� float number; (*)
� boolean number;
11. Which of the following is the name of a Java primitive data type?
� String
� int (*)
� Rectangle
� Object
12. Which of the following is not a legal name for a variable?
� R2d2
� dgo2sleep
� 4geeks (*)
� to_be_or_not_to_be
13. Which of the following examples of Java code is not correct?
� int x=6;
� double d=4.5;
� boolean b=1; (*)
� char c=’r’;
14. Which of the following statements correctly assigns “3 times 10 to the 4th power” to the
variable number?
� double number=3*10^4;
� double number=3(e4);
� double number=3e4; (*)
� double number=3*10e4;
15. Which line of code does not assign 3.5 to the variable x?
� double x=3.5
� x=3.5;
� 3.5=x; (*)
� x=7.0/2.0;
16. Consider the following:
You are writing a class and are using a global variable. Inside a method you declare a local
variable with the same name as the global variable.
This programming style is poor because inside the method the global variable will have
precedence over the local variable with the same name.
True or false? True False (*)
17. What will the method methodA print to the screen?
� 18 (*)
� 15
�6
�3
18.Which line of Java code properly calculates the volume of a cone using
where r and h are Java primitive integers?
� double V=1/3*3.14*r*r*h;
� double V=(double)1/3*Math.PI*Math.pow(r,2)*h; (*)
� double V=1/3*Math.PI*Math.pow(r,2)*h;
� double V=(double)1/3*Math.PI*Math.pow(2,r)*h;
� double V=1/3*3.14*r(2)*h;
19. Given the following declaration: int z=5,m=6;
Which line of Java code properly casts one type into another without data loss?
� double x=(double)z/m; (*)
� double x=z/m;
� double x=(double)(z/m);
� double x= double z/m;
Quiz 1 Sectiunea 6
1. Which of the following statements is a valid array declaration?
� int number();
� float average[]; (*)
� double[] marks; (*)
� counter int[];
2.The following array declaration is valid: int[] y = new int[5]; True (*) False
3. Which of the following declares a one dimensional array named “score” of type int that can
hold 9 values?
� int score;
� int[] score;
� int[] score=new int[9]; (*)
� int score=new int[9];
4. Which of the following declares and initializes a two dimensional array?
� int[][] array={{1,1,1},{1,1,1},{1,1,1}}; (*)
� int[] array={{1,1,1},{1,1,1},{1,1,1}};
� int[][] array={1,1,1},{1,1,1},{1,1,1};
� int[][] array={1,1,1,1,1,1,1,1,1};
5. Which of the following declares and initializes a one dimensional array named words of
size 10 so that all entries can be Strings?
� String words=new String[10];
� char words=new char[10];
� char[] words=new char[10];
� String[] words=new String[10]; (*)
6. What is the output of the following segment of code?
� 222220
� 0 (*)
� 220
�2
� This code does not compile.
7. What is the output of the following segment of code?
� 1286864
� 643432
� 262423242322
� 666666 (*)
� This code does not compile.
8. Which of the following declares and initializes a two dimensional array named values with
2 rows and 3 columns where each element is a reference to an Object?
� String[][] values={“apples”,”oranges”,”pears”};
� String[][] values=new String[3][2];
� String[][] values=new String[2][3]; (*)
� String[][] values;
9. Which of the following declares and initializes a two dimensional array where each
element is a reference type?
� String words=new String[10];
� char[][] words;
� char[][] words=new char[10][4];
� String[][] words=new String[10][3]; (*)
10. Which of the following statements print every element of the one dimensional array
prices to the screen?
� for(int i=0; i < prices.length; i++){System.out.println(prices[i]);} (*)
� System.out.println(prices.length);
� for(int i=1; i <= prices.length; i++){System.out.println(prices[i]);}
� for(int i=0; i <= prices.length; i++){System.out.println(prices[i]);}
11. What is the output of the following segment of code?
� 753
�6
� 7766554433221
� 7531 (*)
 This code does not compile.
12. The following creates a reference in memory named y that can refer to five different
integers via an index. True or false? int[] y = new int[5]; True (*) False
13. The following creates a reference in memory named z that can refer to seven different
doubles via an index. True or false? double z[] = new double[7]; True (*) False
14. What is the output of the following segment of code if the command line arguments are
“apples oranges pears”?
� apples
� pears (*)
� oranges
� args
� This code doesn’t compile.
15. What is the output of the following segment of code if the command line arguments are
“apples oranges pears”?
�0
�1
�2
� 3 (*)
� This code does not compile.
16. What will be the content of array variable table after executing the following code?
�000
000
000
�100
010
0 0 1 (*)
�100
110
111
�001
010
100
17.What is the output of the following segment of code?
� 1286864 (*)
� 643432
� 262423242322
� 666666
� This code does not compile.
18. After execution of the following statement, which of the following are true?
int number[] = new int[5];
� number[0] is undefined
� number[4] is null
� number[2] is 0 (*)
� number.length() is 6
19. The following array declaration is valid. True or false? int x[] = int[10]; True False (*)
Quiz 2 Sectiunea 6
1. Consider the following code snippet. What is printed?
String river = new String(“Hudson”); System.out.println(river.length());
6 (*) 7 8 Hudson river
2. Which of the following creates a String reference named str and instantiates it?
� String str;
� str=”str”;
� String s=”str”;
� String str=new String(“str”); (*)
3. Declaring and instantiating a String is much like any other type of variable. However, once
instantiated, they are final and cannot be changed. True or false? True (*) False
4. Which of the following statements declares a String object called name?
� String name; (*)
� String name
� int name;
� double name;
5. Suppose that s1 and s2 are two strings. Which of the statements or expressions are
valid?
� String s3 = s1 + s2; (*)
� String s3 = s1 – s2;
� s1 <= s2
� s1.compareTo(s2); (*)
� int m = s1.length(); (*)
6. Consider the following code snippet. What is printed?
� PoliiPolii (*)
� Polii
� auaacauaac
� auaac
� ArrayIndexOutofBoundsException is thrown
7. What will the following code segment output?
� “\\\\\”
� \”\\\\\”
� “\\” (*)
� “\\\”
8. What will the following code segment output?
� “”\\”
� “”\”
� “”\
” (*)
� “””\
“”
� “”\
“”
9. The following program prints “Equal”. True or false?
� True (*)
� False
10. Which of the following creates a String named string?
� char string;
� String s;
� String string; (*)
� String String;
� String char;
11. Given the code, which of the following would equate to true?
String s1 = “yes”;
String s2 = “yes”;
String s3 = new String(s1);
� s1 == s2 (*)
� s1 = s2
� s3 == s1
� s1.equals(s2) (*)
� s3.equals(s1) (*)
12. The String methods equals and compareTo perform the exact same function. True or
false?
True False (*)
13. The == operator can be used to compare two String objects. The result is always true if
the two strings are identical. True or false? True False (*)
14. The following program prints “Equal”. True or false?
� True
� False (*)
15. Given the code below, which of the following calls are valid? String s = new String(“abc”);
� s.trim() (*)
� s.replace(‘a’, ‘A’) (*)
� s.substring(2) (*)
� s.toUpperCase() (*)
� s.setCharAt(1,’A’)
16. Consider the following code snippet. What is printed?
String ocean = new String(“Atlantic Ocean”); System.out.println(ocean.indexOf(‘a’));
0 2 3 (*) 11 12
17. Consider the following code snippet. What is printed?
� 55555
� 87668 (*)
� AtlanticPacificIndianArcticSouthern
� The code does not compile.
� An ArrayIndexOutofBoundsException is thrown.
18. Consider the following code snippet. What is printed?
� 55555
� 87658
� AtlanticPacificIndianArcticSouthern
� The code does not compile.
� An ArrayIndexOutofBoundsException is thrown. (*)
19.How would you use the ternary operator to rewrite this if statement?
if (skillLevel > 5)
numberOfEnemies = 10;
else
numberOfEnemies = 5;
� numberOfEnemies = ( skillLevel > 5) ? 5 : 10;
� numberOfEnemies = ( skillLevel < 5) ? 10 : 5;
� numberOfEnemies = ( skillLevel >= 5) ? 5 : 10;
� numberOfEnemies = ( skillLevel >= 5) ? 10 : 5;
� numberOfEnemies = ( skillLevel > 5) ? 10 : 5; (*)
20. How would you use the ternary operator to rewrite this if statement?
if (gender == “male”)
System.out.print(“Mr.”);
else
System.out.print(“Ms.”);
� System.out.print( (gender == “male”) ? “Mr.” : “Ms.” ); (*)
� System.out.print( (gender == “male”) ? “Ms.” : “Mr.” );
� (gender == “male”) ? “Mr.” : “Ms.” ;
� (gender == “male”) ? “Ms.” : “Mr.” ;
Quiz 3 Sectiunea 6
1. Which of the following would give you an array index out of bounds exception?
� Misspelling a variable name somewhere in your code.
� Refering to an element of an array that is at an index less than the length of the array
minus one.
� Using a single equal symbol to compare the value of two integers.
� Refering to an element of an array that is at an index greater than the length of that array
minus one. (*)
� Unintentionally placing a semicolon directly after initializing a for loop.
2. What exception message indicates that a variable may have been mispelled somewhere
in the program?
� variableName cannot be resolved to a variable (*)
� method methodName(int) is undefined for the type className
� Syntax error, insert “;” to complete statement
� All of the Above
3. Which of the following defines an Exception?
� A very severe non-fixable problem with interpreting and running your code.
� Code that has no errors and therefore runs smothly.
� A problem that can be corrected or handled by your code. (*)
� An interpreter reading your code.
4. What do exceptions indicate in Java?
� The code has considered and dealt with all possible cases.
� A mistake was made in your code. (*)
� There are no errors in your code.
� Exceptions do not indicate anything, their only function is to be thrown.
� The code was not written to handle all possible conditions. (*)
5. Which line of code shows the correct way to throw an exception?
� new throw Exception(“Array index is out of bounds”);
� throw new Exception(“Array index is out of bounds”); (*)
� throw Exception(“Array index is out of bounds”);
� throws new Exception(“Array index is out of bounds”);
6. What does the interpreter look for when an exception is thrown?
� It does not look for anything. It just keeps reading through your code.
� It does not look for anything. It stops interpreting your code.
� The end of the code.
� A catch statement in the code. (*)
7. Which of the following would be a correct way to handle an index out of bounds
exception?
� Throw the exception and catch it. In the catch, set the index to the index of the array
closest to the one that was out of bounds. (*)
� Do nothing, it will fix itself.
� Throw the exception that prints out an error message. There is no need to have the catch
handle the exception if it has already been thrown.
� Rewrite your code to avoid the exception by not permititng the use of an index that is not
inside the array. (*)
8. A computer company has one million dollars to give as a bonus to the employees, and
they wish to distribute it evenly amongst them.
The company writes a program to calculate the amount each employee receives, given the
number of employees.
Unfortunately, the employees all went on strike before they heard about the bonus. This
means that the company has zero employees.
What will happen to the program if the company enters 0 into the employment number?
� An unfixable error will occur.
� The program will calculate that each employee will receive zero dollars because there are
zero employees.
� An exception will occur because it is not possible to divide by zero. (*)
� The programmers will have proven their worth in the company because without them the
company wrote faulty code.
10. The first step to using a top-down approach to programming is to create a table to align
the storyboard steps to the programming instructions. True or false? Mark for Review
(1) Points
True
False (*)
In Alice, when using a while loop you can only execute a single line of code within it. True or
false? Mark for Review
(1) Points
True
False (*
What does an instance of the World class do? Mark for Review
(1) Points
Provide the source code for instances.
Provide the acting objects for the scenario.
Provide the superclass for acting objects.
Provide the background scenery for the scenario. (*)
Defined methods are methods that are only created by the Greenfoot development team?
Mark for Review
(1) Points
True
False (*)
Correct Correct
2. In the Greenfoot IDE, any new methods you create are written in the class’s source code.
True or false? Mark for Review
(1) Points
True (*)
False
Correct Correct
3. In Greenfoot a collision is when 2 actors touch? Mark for Review
(1) Points
True (*)
False
Correct Correct
4. In Greenfoot, you can only interact with the scenario using a keyboard. Mark for Review
(1) Points
True
False (*)
Correct Correct
5. In Greenfoot, the sound file must be saved in the scenario and written in the source code
for it to play. True or false? Mark for Review
(1) Points
True (*)
False
Correct Correct
6. In Greenfoot, what type of parameter does the isKeyDown method expect? Mark for
Review
(1) Points
String (*)
Boolean
Integer
Method
Correct Correct
7. Using Greenfoot, how do we change the size and resolution of the World instance? Mark
for Review
(1) Points
Delete the instance.
Edit the values in the class’s act method.
Edit the methods in the class.
Edit the values in the constructor. (*)
Correct Correct
8. In Greenfoot the showText() method belongs to which class? Mark for Review
(1) Points
There is no such method.
Actor
World (*)
Greenfoot
Correct Correct
9. Greenfoot Actor instances get their images from which of the following? Mark for Review
(1) Points
Their class (*)
Their image editor
Their methods
Their source code
Correct Correct
10. From your Greenfoot lessons, abstraction techniques can only be used once in a class’s
source code. True or false? Mark for Review
(1) Points
True
False (*)
Correct Correct
11. In Java what is casting? Mark for Review
(1) Points
When you remove an object instance.
When you take an Object of one particular type and turn it into another Object type. (*)
When you reset an object instance.
Casting is not possible in Java.
Correct Correct
12. From your Greenfoot lessons, which one of the following is an example of when an
abstraction technique is used? Mark for Review
(1) Points
Initialising a variable
Adding a property to an instance
Passing a paramater in a constructor to set an initial speed. (*)
Adding a property to a Class
Correct Correct
13. In Greenfoot, what happens if the end to a while loop isn’t established? Mark for Review
(1) Points
The code will keep executing and will never stop. (*)
The code will not execute.
The code will execute once and then stop, due to controls in Greenfoot.
The code will prompt you to enter a loop counter.
Correct Correct
14. In Greenfoot, arrays are a way to hold and access multiple variables, and assign
different values to new instances each time the while loop executes and produces a new
instance. True or false? Mark for Review
(1) Points
True (*)
False
Correct Correct
15. From your Greenfoot lessons, which symbol represents string concatenation? Mark for
Review
(1) Points
Symbol =
Symbol <
Symbol &
Symbol + (*)
Correct Correct
Test: Java Fundamentals Midterm Exam
Review your answers, feedback, and question scores below. An asterisk (*) indicates a
correct answer.
Section 2
(Answer all questions in this section)
1. You want an event to happen when an object collides with another object, which category
of event handler would you choose? Mark for Review
(1) Points
Mouse
Scene Activation/time
Keyboard
Position/Orientation (*)
Correct Correct
2. An Alice event is considered what? Mark for Review
(1) Points
A party with at least 20 people.
A keystroke or mouse click. (*)
An object’s orientation.
Error handling.
Correct Correct
3. How do you create a programming instruction in Alice? Mark for Review
(1) Points
Click and drag the desired programming instruction into the Procedures tab.
Click and drag the desired programming instruction into the Functions tab.
Click and drag the desired programming instruction into the Scene editor.
Click and drag the desired programming instruction into the myFirstMethod tab. (*)
Correct Correct
4. What does a visual storyboard help the reader understand? Mark for Review
(1) Points
(Choose all correct answers)
How the initial scene will be set up. (*)
The components of the scene. (*)
The actions that will take place. (*)
The code that is debugged.
Correct Correct
5. A flowchart is a useful way to illustrate how your Alice animation’s characters will look.
True or false? Mark for Review
(1) Points
True
False (*)
Correct Correct
Page 1 of 10 Next Summary
Test: Java Fundamentals Midterm Exam
Review your answers, feedback, and question scores below. An asterisk (*) indicates a
correct answer.
Section 2
(Answer all questions in this section)
6. In Alice, new procedures are declared in the Scene editor. True or false? Mark for Review
(1) Points
True
False (*)
Correct Correct
7. From your Alice lessons, variables are fixed and cannot be changed. True or false? Mark
for Review
(1) Points
True
False (*)
Correct Correct
8. Define the value of the variable LapCount based on the following math calculation:
LapCount + 10 = 15 Mark for Review
(1) Points
2
5 (*)
4
15
10
Correct Correct
9. In Alice, how is a one-shot procedure different from procedures in the Code editor? Mark
for Review
(1) Points
One-shot procedures are only available for acting objects, while procedures are available for
all objects.
One-shot procedures are available in the Code editor, while procedures are available in the
Scene editor.
A one-shot procedure executes only one time to re-position the object, while procedures in
the Code editor execute every time the Run button is clicked. (*)
All of the above
Incorrect Incorrect. Refer to Section 2 Lesson 2.
10. Which of the following are examples of elements you would test in your Alice animation?
Mark for Review
(1) Points
(Choose all correct answers)
Objects move with smooth timing. (*)
Math expressions calculate as expected. (*)
All of the procedures display in alphabetical order in the Procedures tab.
Event listeners trigger the correct responses. (*)
Correct Correct
Previous Page 2 of 10 Next Summary
Test: Java Fundamentals Midterm Exam
Review your answers, feedback, and question scores below. An asterisk (*) indicates a
correct answer.
Section 2
(Answer all questions in this section)
11. The Alice animation should be tested throughout development, not just at the end of the
animation’s development. True or false? Mark for Review
(1) Points
True (*)
False
Correct Correct
12. If the value already exists in the variable it is overwritten by the assignment operator (=).
True or false? Mark for Review
(1) Points
True (*)
False
Correct Correct
13. Results of arithmetic operations cannot be stored in a variable. True or false? Mark for
Review
(1) Points
True
False (*)
Correct Correct
14. In Alice, a walking motion for a bipedal object can be achieved without the Do Together
control statement. True or false? Mark for Review
(1) Points
True
False (*)
Correct Correct
15. In Alice, the procedures’ arguments allow the programmer to adjust the object, motion,
distance amount, and time duration. True or false? Mark for Review
(1) Points
True (*)
False
Correct Correct
Previous Page 3 of 10 Next Summary
Test: Java Fundamentals Midterm Exam
Review your answers, feedback, and question scores below. An asterisk (*) indicates a
correct answer.
Section 2
(Answer all questions in this section)
16. In Alice, which procedure is used to assign one object as the vehicle of another? Mark
for Review
(1) Points
setObjectVehicle
setClassVehicle
Vehicle
setVehicle (*)
Correct Correct
17. In Alice, which of the following programming statements moves the cat backward, half
the distance to the bird? Mark for Review
(1) Points
this.Cat move backward {this.Cat getDistanceTo this.Bird / 2} (*)
this.Cat move forward {this.Bird getDistanceTo this.Cat / 2}
this.Cat move backward {this.Bird getDistanceTo this.Cat / 2}
this.Bird move forward {this.Bird getDistanceTo this.Cat / 2}
Correct Correct
18. An example of an expression is: Mark for Review
(1) Points
“I feel happy.”
3*3=9 (*)
Move forward 1 meter
If or Where
Correct Correct
19. From your Alice lessons, random numbers are numbers generated by the user with a
pattern in their sequence. True or false? Mark for Review
(1) Points
True
False (*)
Correct Correct
20. Which of the following statements about methods is false? Mark for Review
(1) Points
Methods whose return type is not void are required to include a return statement specifying
what to return.
Java does not permit nesting one method definition within another method’s definition.
Classes must be defined directly within a method definition. (*)
The order in which methods are listed within the class is not important.
Correct Correct
1. Which of the two diagrams below illustrate the general form of a Java program?
Mark for Review
(1) Points
Example A
Example B (*)
Incorrect Incorrect. Refer to Section 4 Lesson 2.
2. The following defines an import keyword: Mark for Review
(1) Points
Precedes the name of the class.
Defines where this class lives relative to other classes, and provides a level of access
control.
Provides the compiler information that identifies outside classes used within the current
class. (*)
Correct Correct
3. When importing another package into a class you must import only the package classes
that will be called and not the entire package. True or false? Mark for Review
(1) Points
True
False (*)
Incorrect Incorrect. Refer to Section 4 Lesson 2.
4. The following defines an import keyword: Mark for Review
(1) Points
Provides the compiler information that identifies outside classes used within the current
class. (*)
Precedes the name of the class.
Defines where this class lives relative to other classes, and provides a level of access
control.
Correct Correct
5. What is the purpose of the Eclipse Editor Area and Views? Mark for Review
(1) Points
(Choose all correct answers)
To choose the file system location to delete a file.
To modify elements. (*)
To navigate a hierarchy of information. (*)
Incorrect Incorrect. Refer to Section 4 Lesson 1.
6. For every opening curly brace { there must be a closing curly brace} or the program will
not compile without error. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
7. A _______________ is used to organize Java related files. Mark for Review
(1) Points
Package (*)
Workspace
Collection
Project
Incorrect Incorrect. Refer to Section 4 Lesson 1.
8. What is the output of the following lines of code?
int j=6,k=4,m=12,result;
result=j/m*k;
System.out.println(result); Mark for Review
(1) Points
2
0 (*)
48
24
Incorrect Incorrect. Refer to Section 4 Lesson 3.
9. What will the method methodA print to the screen?
Mark for Review
(1) Points
18 (*)
6
15
3
Correct Correct
10. Examine the following code:
What is the value of variable x? Mark for Review
(1) Points
6
2 (*)
2.5
14
Correct Correct
11. What does the following program output?
Mark for Review
(1) Points
total cost: 48
total cost: + 40
total cost: 40 (*)
“total cost: ” 48
“total cost: ” 40
Incorrect Incorrect. Refer to Section 4 Lesson 3.
12. Which of the following statements correctly assigns “3 times 10 to the 4th power” to the
variable number? Mark for Review
(1) Points
double number=3*10e4;
double number=3*10^4;
double number=3(e4);
double number=3e4; (*)
Correct Correct
13. The following program prints “Equal”. True or false?
Mark for Review
(1) Points
True (*)
False
Incorrect Incorrect. Refer to Section 4 Lesson 4.
14. What is printed by the following code segment?
Mark for Review
(1) Points
\\\\\\\\\\\\\\
\\\\
\\
\\\\\\\ (*)
Incorrect Incorrect. Refer to Section 4 Lesson 4.
15. What will the following code segment output?
String s=”\\\n\”\n\\\n\””;
System.out.println(s);
Mark for Review
(1) Points
“”\
“”
\
“”

\

\


\” \”
\

\
” (*)
11. How would you use the ternary operator to rewrite this if statement?
if (balance < 500)
fee = 10;
else
fee = 0; Mark for Review
(1) Points
fee = ( balance < 500) ? 0 : 10;
fee = ( balance >= 5) ? 0 : 10;
fee= ( balance < 500) ? 10 : 0; (*)
fee = ( balance > 5) ? 10 : 0;
fee = ( balance >= 500) ? 10 : 0;
Correct Correct
12. How would you use the ternary operator to rewrite this if statement?
if (skillLevel > 5)
numberOfEnemies = 10;
else
numberOfEnemies = 5; Mark for Review
(1) Points
numberOfEnemies = ( skillLevel > 5) ? 10 : 5; (*)
numberOfEnemies = ( skillLevel < 5) ? 10 : 5;
numberOfEnemies = ( skillLevel >= 5) ? 10 : 5;
numberOfEnemies = ( skillLevel >= 5) ? 5 : 10;
numberOfEnemies = ( skillLevel > 5) ? 5 : 10;
Correct Correct
13. In an if-else construct, the condition to be evaluated must be contained within
parentheses. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
14. In Java, each case seqment of a switch statement requires the keyword break to avoid
“falling through”. Mark for Review
(1) Points
True (*)
False
Correct Correct
15. The six relational operators in Java are: Mark for Review
(1) Points
>, <, ==, !=, <=, >= (*)
>, <, =, !, <=, >=
>, <, =, !=, <=, >=
>, <, =, !=, =<, =>
Correct Correct
Section 4
(Answer all questions in this section)
1. The six relational operators in Java are: Mark for Review
(1) Points
>,<,=,!,<=,>=
>,<,==,!=,<=,>= (*)
>,<,=,!=,<=,>=
>,<,=,!=,=<,=>
Correct
2. The three logic operators in Java are: Mark for Review
(1) Points
&&, ||, ! (*)
!=,=,==
&&,!=,=
&,|,=
Correct
3. What does the following program output?
Mark for Review
(1) Points
total cost: + 40
total cost: 48
total cost: 40 (*)
“total cost: ” 48
“total cost: ” 40
Incorrect. Refer to Section 4 Lesson 3.
4. Which line of Java code will assign the square root of 11 to a? Mark for Review
(1) Points
double a=11^(1/2);
double a=sqrt(11);
int a=Math.sqrt(11);
double a=Math.sqrt*11;
double a=Math.sqrt(11); (*)
Correct
5. What two values can a boolean variable have? Mark for Review (1) Points
Numbers and characters
True and false (*)
Relational and logic operators
Arithmetic and logic operators
Integers and floating point types
Correct
Page 1 of 10 Next Summary
Test: Java Fundamentals Final Exam
Section 4
(Answer all questions in this section)
6. Given the following declaration, which line of Java code properly casts one type into
another without data loss?
int i=3,j=4; double y=2.54; Mark for Review (1) Points
int x=(double)2.54;
double x=i/j;
double x=(double)(i/j);
double x= double i/j;
double x=(double)i/j; (*)
Correct
7. Which of the following is a legal identifier? Mark for Review
(1) Points
7up
boolean
grand Total
apple (*)
Correct
8. In a For loop the counter is not automatically incremented after each loop iteration. Code
must be written to increment the counter. True or false? Mark for Review (1) Points
True (*)
False
Incorrect. Refer to Section 4 Lesson 2.
9. When the For loop condition statement is met the construct is exited. True or false? Mark
for Review (1) Points
True
False (*)
Incorrect. Refer to Section 4 Lesson 2.
10. Which of the two diagrams below illustrate the general form of a Java program?
Mark for Review
(1) Points
Example A
Example B (*)
Correct
Previous Page 2 of 10 Next Summary
Test: Java Fundamentals Final Exam
Section 4
(Answer all questions in this section)
11. A counter used in a For loop cannot be initialized within the For loop header. True or
false? Mark for Review (1) Points
True
False (*)
Correct
12. When you open more than one file in Eclipse the system will __________________.
Mark for Review (1) Points
Close the previously opened file.
Use tabs to display all files open. (*)
Put the new file opened in a View area only.
None of the above.
Incorrect. Refer to Section 4 Lesson 1.
13. A combination of views and editors are referred to as _______________. Mark for
Review
(1) Points
A workspace
A physical location
A perspective (*)
All of the above
Incorrect. Refer to Section 4 Lesson 1.
14. In Eclipse, when you run a Java Application, where may the results display? Mark for
Review
(1) Points
Editor Window
Console View (*)
Debug View
Task List
None of the above
Correct
15. What are the Eclipse Editor Area and Views used for? Mark for Review (1) Points
(Choose all correct answers)
To modify elements. (*)
To navigate a hierarchy of information. (*)
To choose the file system location to delete a file.
Correct
Previous Page 3 of 10 Next Summary
Test: Java Fundamentals Final Exam
Review your answers, feedback, and question scores below. An asterisk (*) indicates a
correct answer.
Section 5
16. Which of the following best describes a WHILE loop? Mark for Review (1) Points
A loop that contains a segment of code that is executed before the conditional statement is
tested.
A loop that executes the code at least one time even if the conditional statement is false.
A loop that is executed repeatedly until the conditional statement is false. (*)
A loop that contains a counter in parenthesis with the conditional statement.
Correct
17. Switch statements work on all input types including, but not limited to, int, char, and
String. True or false? Mark for Review (1) Points
True
False (*)
Correct
18. Why are loops useful? Mark for Review (1) Points
They save programmers from having to rewrite code.
They allow for repeating code a variable number of times.
They allow for repeating code until a certain argument is met.
All of the above. (*)
Correct
19. Which of the following correctly matches the switch statement keyword to its function?
Mark for Review (1) Points
(Choose all correct answers)
switch: tells the compiler the value to compare the input against
default: signals what code to execute if the input does not match any of the cases (*)
case: signals what code is executed if the user input matches the specified element (*)
if: records the user’s input and sends it to the case statements to find a possible match
switch: identifies what element will be compared to the element of the case statements to
find a possible match (*)
Correct
20. What is wrong with the following class declaration?
class Account{ ;
privateint number;
privateString name;;
Account;;
}
Mark for Review (1) Points
Classes cannot include strings.
Classes cannot include mixed data types.
The constructor method has no definition. (*)
There is nothing wrong.
Correct
Previous Page 4 of 10 Next Summary
Test: Java Fundamentals Final Exam
Review your answers, feedback, and question scores below. An asterisk (*) indicates a
correct answer.
Section 5
21. Which of the following may be part of a class definition? Mark for Review (1) Points
Instance variables
Instance methods
Constructors
All of the above. (*)
None of the above.
Incorrect. Refer to Section 5 Lesson 2.
22. The constructor method must always have at least one parameter. True or false? Mark
for Review (1) Points
True
False (*)
Correct
23. A constructor must have the same name as the class it is declared within. True or false?
Mark for Review (1) Points
True (*)
False
Correct
24. The basic unit of encapsulation in Java is the primitive data type. True or false? Mark for
Review (1) Points
True
False (*)
Correct
25. In Java, an instance field referenced using the this keyword generates a compilation
error. True or false? Mark for Review (1) Points
True
False (*)
Correct
Previous Page 5 of 10 Next Summary
Test: Java Fundamentals Final Exam
Review your answers, feedback, and question scores below. An asterisk (*) indicates a
correct answer.
Section 5
26. A constructor is used to create objects. True or false? Mark for Review (1) Points
True (*)
False
Correct
Section 6
27. Which of the following statements adds all of the elements of the one dimensional array
prices and then prints it to the screen? Mark for Review (1) Points
a) for(int i=0;i= str2
Str1 -= str2;
Correct
34. The == operator tests if two String references are pointing to the same String object.
True or false? Mark for Review (1) Points
True (*)
False
Correct
35. What does it mean to catch an exception? Mark for Review (1) Points
It means you have fixed the error.
It means to throw it.
It means to handle it. (*)
It means there was never an exception in your code.
Correct
Previous Page 7 of 10 Next Summary
Test: Java Fundamentals Final Exam
Review your answers, feedback, and question scores below. An asterisk (*) indicates a
correct answer.
Section 6
36. A logic error occurs if an unintentional semicolon is placed at the end of a loop initiation
because the interpreter reads this as the only line inside the loop, a line that does nothing.
Everything that follows the semicolon is interpreted as code outside of the loop. True or
false? Mark for Review (1) Points
True
False (*)
Incorrect. Refer to Section 6 Lesson 3.
37. Which of the following correctly matches the symbol with its function? Mark for Review
(1) Points
(Choose all correct answers)
== (two equal signs) compares values of primitive types such as int or char. (*)
== (two equal signs) compares the values of non-primitive objects.
== (two equal signs) compares the memory location of non-primitive objects. (*)
= (single equals sign) compares the value of primitive types such as int or char.
.equals() compares the value of non-primitive objects. (*)
Incorrect. Refer to Section 6 Lesson 3.
38. What is wrong with this code?
Mark for Review (1) Points
It is missing a semicolon.
It does not handle the exception.
It gives you an out of bounds exception.
There is nothing wrong with this code. (*)
Correct
Section 7
(Answer all questions in this section)
39. Identify the correct way to declare an abstract class. Mark for Review (1) Points
abstract public class ClassName{…}
public abstract ClassName(…)
public class abstract ClassName(…)
public abstract class ClassName{…} (*)
Correct
40. Which of the following are true about abstract methods? Mark for Review (1) Points
(Choose all correct answers)
They cannot have a method body. (*)
They must be overridden in a non-abstract subclass. (*)
They must be declared in an abstract class. (*)
They may contain implementation.
They must be overloaded.
Correct
Previous Page 8 of 10 Next Summary
Test: Java Fundamentals Final Exam
Review your answers, feedback, and question scores below. An asterisk (*) indicates a
correct answer.
Section 7
(Answer all questions in this section)
41. What is true about the Object class? Mark for Review (1) Points
(Choose all correct answers)
It is the highest superclass. (*)
It extends other classes.
Its methods can be overridden in subclasses. (*)
Its methods can be overloaded in subclasses. (*)
Correct
42. An access modifier is a keyword that allows subclasses to access methods, data, and
constructors from their parent class. True or false? Mark for Review (1) Points
True (*)
False
Correct
43. Which of the following correctly describes an Is-A relationship? Mark for Review
(1) Points
A helpful term used to conceptualize the relationships among nodes or leaves in an
inheritance hierarchy. (*)
A programming philosophy that promotes simpler, more efficient coding by using exiting
code for new applications.
It restricts access to a specified segment of code.
A programming philosophy that promotes protecting data and hiding implementation in order
to preserve the integrity of data and methods.
Correct
44. If a variable in a superclass is private, could it be directly accessed or modified by a
subclass? Why or why not? Mark for Review (1) Points
Yes. A subclass inherits full access to all contents of its super class.
Yes. Any variable passed through inheritance can be changed, but private methods cannot.
No. A private variable can only be modified by the same class with which it is declared
regardless of its inheritance. (*)
No. Nothing inherited by the super class can be changed in the subclass.
Correct
45. Which of the following are access specifiers? Mark for Review (1) Points
(Choose all correct answers)
protected (*)
public (*)
secured
default (no access modifier) (*)
private (*)
Correct
Previous Page 9 of 10 Next Summary
Test: Java Fundamentals Final Exam
Review your answers, feedback, and question scores below. An asterisk (*) indicates a
correct answer.
Section 7
(Answer all questions in this section)
46. Which of the following correctly defines overloading? Mark for Review (1) Points
Having more than one constructor with the same name but different arguments. (*)
Having more than one constructor with different names and the same arguments.
A variable argument method that returns an array.
A type of access specifier that only allows access from inside the same class.
Correct
47. Which of the following is the correct way to code a method with a return type an object
Automobile? Mark for Review (1) Points
a) Automobile upgrade(String carA){
carA=”Turbo”;
return carA;}
b) Automobile upgrade(Automobile carA){
carA.setTurbo(“yes”);
return carA;} (*)
c) String upgrade(String carA){
carA=”Turbo”;
return carA;}
d) upgrade(Automobile carA) Automobile{
carA.setTurbo(“yes”);
return carA;}
None of the above. It is not possible to return an object.
Correct
48. Static methods can’t act like “setter” methods. True or false? Mark for Review
(1) Points
True
False (*)
Incorrect. Refer to Section 7 Lesson 2.
49. Static classes are designed as thread safe class instances. True or false? Mark for
Review
(1) Points
True
False (*)
Correct
50. Static methods can read instance variables. True or false? Mark for Review (1) Points
True
False (*)
Correct
Previous Page 10 of 10 Summary
1. What are Java’s simple types?
boolean, byte, char, double, float, int, long, and short (*)
boolean, byte, string, thread, int, double, long and short
object, byte, string, char, float, int, long and short
boolean, thread, stringbuffer, char, int, float, long and short
boolean, thread, char, double, float, int, long and short
2. Which of the following are relational operators in Java? (Choose all correct answers)
< (*)
<= (*)
=
!= (*)
All of the above.
3. What is the output of the following lines of code?
int j=6,k=4,m=12,result;
result=j/m*k;
System.out.println(result);
2
0 (*)
48
24
4. A local variable has precedence over a global variable in a Java method. True or false?
True (*) False
5. What does the following program output?
total cost: + 40
total cost: 48
total cost: 40 (*)
“total cost: ” 48
“total cost: ” 40
6. What is the result when the following code segment is compiled and executed?
int x = 22, y = 10;
double p = Math.sqrt( ( x + y ) /2);
System.out.println(p);
Syntax error “sqrt(double) in java.lang.Math cannot be applied to int”
4.0 is displayed (*)
2.2 is displayed
5.656854249492381 is displayed
ClassCastException
7. Determine whether this boolean expression evaluates to true or false:
!(3<4&&6>6||6<=6&&7-2==6)
True (*) False
8. In an if-else construct the condition to be evaluated must end with a semi-colon. True or
false?
True False (*)
9. Which of the two diagrams below illustrate the general form of a Java program?
Example A
Example B (*)
10. In a For loop the counter is not automatically incremented after each loop iteration. Code
must be written to increment the counter. True or false?
True (*) False
11. When the For loop condition statement is met the construct is exited. True or false?
True False (*)
12. You can return to the Eclipse Welcome Page by choosing Welcome from what menu?
File
Edit
Help (*)
Close
13. In Eclipse, when you run a Java Application, where may the results display?
Editor Window
Console View (*)
Debug View
Task List
None of the above
14. A combination of views and editors are referred to as _______________.
A workspace
A physical location
A perspective (*)
All of the above
15. What are the Eclipse Editor Area and Views used for?(Choose all correct answers)
To modify elements. (*)
To navigate a hierarchy of information. (*)
To choose the file system location to delete a file.
16. What is the output of the following code segment:
int n = 13;
System.out.print(doNothing(n));
System.out.print(” “, n);
where the code from the function doNothin is:
public double doNothing(int n)
{
n = n + 8;
return (double) 12/n;
}
1.75, 13
0.571, 21
1.75, 21
0.571, 13 (*)
17. Updating the input of a loop allows you to implement the code with the next element
rather than repeating the code always with the same element. True or false?
True (*) False
18. One advantage to using a WHILE loop over a FOR loop is that a WHILE loop always has
a counter. True or false? True False (*)
19. Which of the following could be a reason to use a switch statement in a Java program?
Because it allows the code to be run through until a certain conditional statement is true.
Because it allows the program to run certain segments of code and neglect to run others
based on the input given. (*)
Because it terminates the current loop.
Because it allows the user to enter an input in the console screen and prints out a message
that the user input was successfully read in.
20. In Java, an instance field referenced using the this keyword generates a compilation
error. True or false?
True False (*)
21. Consider
public class YourClass{ public YourClass(int i){/*code*/} // more code…}
To instantiate YourClass, what would you write?
YourClass y = new YourClass();
YourClass y = new YourClass(3); (*)
YourClass y = YourClass(3);
YourClass y = YourClass();
None of the above.
22. A constructor must have the same name as the class it is declared within. True or false?
True (*) False
23. Which of the following keywords are used to control access to the member of a class?
default
public (*)
class
All of the above.
None of the above.
24. Which of the following creates a method that compiles with no errors in the class?
(*)
All of the above.
None of the above
25. The following code creates an Object of type Horse. True or false?
Whale a=new Whale();
True False (*)
26. What operator do you use to call an object’s constructor method and create a new
object?
+
new (*)
instanceOf
27. Which of the following declares a one dimensional array name scores of type int that can
hold 14 values?
int scores;
int[] scores=new int[14]; (*)
int[] scores=new int[14];
int score= new int[14]
28. Which of the following statements is not a valid array declaration?
int number[];
float []averages;
double marks[5];
counter int[]; (*)
29. What is the output of the following segment of code if the command line arguments are
“a b c d e f”?
1
3
5
6 (*)
30. Which of the following declares a one dimensional array named names of size 8 so that
all entries can be Strings?
String names=new String[8];
String[] name=new Strings[8];
String[] names=new String[8]; (*)
String[] name=String[8];
31. What will the following code segment output?
String s=”\\\\\
System.out.println(s);
“\\\\\”
\\\\\\\\
\\
\\\\ (*)
32. Consider the following code snippet.
What is printed? Mark for Review
(1) Points
88888 (*)
88888888
1010778
101077810109
ArrayIndexOutofBoundsException is thrown
33. Given the code
String s1 = “abcdef”;
String s2 = “abcdef”;
String s3 = new String(s1);
Which of the following would equate to false?
s1 == s2
s1 = s2
s3 == s1 (*)
s1.equals(s2)
s3.equals(s1)
34. How would you use the ternary operator to rewrite this if statement?
if (balance < 500)
fee = 10;
else
fee = 0;
fee = ( balance < 500) ? 0 : 10;
fee= ( balance < 500) ? 10 : 0; (*)
fee = ( balance >= 5) ? 0 : 10;
fee = ( balance >= 500) ? 10 : 0;
fee = ( balance > 5) ? 10 : 0;
35. If an exception is thrown by a method, where can the catch for the exception be?
There does not need to be a catch in this situation.
The catch must be in the method that threw the exception.
The catch can be in the method that threw the exception or in any other method that called
the method that threw the exception. (*)
The catch must be immediately after the throw.
36. Choose the best response to this statement: An error can be handled by throwing it and
catching it just like an exception.
True. Errors and exceptions are the same objects and are interchangeable.
False. An error is much more severe than an exception and cannot be dealt with adequately
in a program. (*
True. Although errors may be more severe than exceptions they can still be handled in code
the same way exceptions are. False. Exceptions are caused by a mistake in the code and
errors occur for no particular reason and therefore cannot be handled or avoided.
37. Which of the following could be a reason to throw an exception?
To eliminate exceptions from disrupting your program. (*)
You have a fatal error in your program.
You have encountered a Stack Overflow Error.
To make the user interface harder to navigate.
38. Suppose you misspell a method name when you call it in your program. Which of the
following explains why this gives you an exception?
Because the parameters of the method were not met.
Because the interpreter does not recognize this method since it was never initialized, the
correct spelling of the method was initialized.
Because the interpreter tries to read the method but when it finds the method you intended
to use it crashes.
This will not give you an exception, it will give you an error when the program is compiled. (*)
39. Which of the following is the correct way to call an overriden method needOil() of a super
class Robot in a subclass SqueakyRobot?
Robot.needOil(SqueakyRobot);
SqueakyRobot.needOil();
super.needOil(); (*)
needOil(Robot);
40. Why are hierarchies useful for inheritance?
They keep track of where you are in your program.
They restrict a superclass to only have one subclass.
They organize constructors and methods in a simplified fashion.
They are used to organize the relationship between a superclass and its subclasses. (*)
41. It is possible for a subclass to be a superclass. True or false?
True (*) False
42. Static methods can write to instance variables. True or false?
True False (*)
43. Static classes are designed as thread safe class instances. True or false?
True False (*)
44. Public static variables can’t have their value reset by other classes. True or false?
True False (*)
45. Choose the correct implementation of a public access modifier for the method divide.
divide(int a, int b, public) {return a/b;}
public divide(int a, int b) {return a/b;} (*)
divide(int a, int b) {public return a/b;}
divide(public int a, public int b) {return a/b;}
46. Which of the following specifies accessibility to variables, methods, and classes?
Methods
Parameters
Overload constructors
Access specifiers (*)
47. Which segment of code represents a correct way to call a variable argument method
counter that takes in integers as its variable argument parameter?
counter(String a, int b);
counter(int[] numbers);
counter(1, 5, 8, 17, 11000005); (*)
counter(“one”,”two”,String[] nums);
48. Which of the following can be declared final?
Classes
Methods
Local variables
Method parameters
All of the above (*)
49. Which of the following would be most beneficial for this scenario?
Joe is a college student who has a tendency to lose his books. Replacing them is getting
costly. In an attempt to get organized, Joe wants to create a program that will store his
textbooks in one group of books, but he wants to make each book type the subject of the
book (i.e. MathBook is a book). How could he store these different subject books into a
single array?
By ignoring the subject type and initializing all the book as objects of type Book.
By overriding the methods of Book.
Using polymorphism. (*)
This is not possible. Joe must find another way to collect the books.
50. What is Polymorphism?
A way of redefining methods with the same return type and parameters.
A way to create multiple methods with the same name but different parameters.
A class that cannot be initiated.
The concept that a variable or reference can hold multiple types of objects. (*)
Quiz 1 Sectiunea 6
1. Which of the following statements is a valid array declaration?
� int number();
� float average[]; (*)
� double[] marks; (*)
� counter int[];
2.The following array declaration is valid: int[] y = new int[5]; True (*) False
3. Which of the following declares a one dimensional array named “score” of type int that can
hold 9 values?
� int score;
� int[] score;
� int[] score=new int[9]; (*)
� int score=new int[9];
4. Which of the following declares and initializes a two dimensional array?
� int[][] array={{1,1,1},{1,1,1},{1,1,1}}; (*)
� int[] array={{1,1,1},{1,1,1},{1,1,1}};
� int[][] array={1,1,1},{1,1,1},{1,1,1};
� int[][] array={1,1,1,1,1,1,1,1,1};
5. Which of the following declares and initializes a one dimensional array named words of
size 10 so that all entries can be Strings?
� String words=new String[10];
� char words=new char[10];
� char[] words=new char[10];
� String[] words=new String[10]; (*)
6. What is the output of the following segment of code?
� 222220
� 0 (*)
� 220
�2
� This code does not compile.
7. What is the output of the following segment of code?
� 1286864
� 643432
� 262423242322
� 666666 (*)
� This code does not compile.
8. Which of the following declares and initializes a two dimensional array named values with
2 rows and 3 columns where each element is a reference to an Object?
� String[][] values={“apples”,”oranges”,”pears”};
� String[][] values=new String[3][2];
� String[][] values=new String[2][3]; (*)
� String[][] values;
9. Which of the following declares and initializes a two dimensional array where each
element is a reference type?
� String words=new String[10];
� char[][] words;
� char[][] words=new char[10][4];
� String[][] words=new String[10][3]; (*)
10. Which of the following statements print every element of the one dimensional array
prices to the screen?
� for(int i=0; i < prices.length; i++){System.out.println(prices[i]);} (*)
� System.out.println(prices.length);
� for(int i=1; i <= prices.length; i++){System.out.println(prices[i]);}
� for(int i=0; i <= prices.length; i++){System.out.println(prices[i]);}
11. What is the output of the following segment of code?
� 753
�6
� 7766554433221
� 7531 (*)
? This code does not compile.
12. The following creates a reference in memory named y that can refer to five different
integers via an index. True or false? int[] y = new int[5]; True (*) False
13. The following creates a reference in memory named z that can refer to seven different
doubles via an index. True or false? double z[] = new double[7]; True (*) False
14. What is the output of the following segment of code if the command line arguments are
“apples oranges pears”?
� apples
� pears (*)
� oranges
� args
� This code doesn’t compile.
15. What is the output of the following segment of code if the command line arguments are
“apples oranges pears”?
�0
�1
�2
� 3 (*)
� This code does not compile.
16. What will be the content of array variable table after executing the following code?
�000
000
000
�100
010
0 0 1 (*)
�100
110
111
�001
010
100
17.What is the output of the following segment of code?
� 1286864 (*)
� 643432
� 262423242322
� 666666
� This code does not compile.
18. After execution of the following statement, which of the following are true?
int number[] = new int[5];
� number[0] is undefined
� number[4] is null
� number[2] is 0 (*)
� number.length() is 6
19. The following array declaration is valid. True or false? int x[] = int[10]; True False (*)
Quiz 2 Sectiunea 6
1. Consider the following code snippet. What is printed?
String river = new String(“Hudson”); System.out.println(river.length());
6 (*) 7 8 Hudson river
2. Which of the following creates a String reference named str and instantiates it?
� String str;
� str=”str”;
� String s=”str”;
� String str=new String(“str”); (*)
3. Declaring and instantiating a String is much like any other type of variable. However, once
instantiated, they are final and cannot be changed. True or false? True (*) False
4. Which of the following statements declares a String object called name?
� String name; (*)
� String name
� int name;
� double name;
5. Suppose that s1 and s2 are two strings. Which of the statements or expressions are
valid?
� String s3 = s1 + s2; (*)
� String s3 = s1 – s2;
� s1 <= s2
� s1.compareTo(s2); (*)
� int m = s1.length(); (*)
6. Consider the following code snippet. What is printed?
� PoliiPolii (*)
� Polii
� auaacauaac
� auaac
� ArrayIndexOutofBoundsException is thrown
7. What will the following code segment output?
� “\\\\\”
� \”\\\\\”
� “\\” (*)
� “\\\”
8. What will the following code segment output?
� “”\\”
� “”\”
� “”\
” (*)
� “””\
“”
� “”\
“”
9. The following program prints “Equal”. True or false?
� True (*)
� False
10. Which of the following creates a String named string?
� char string;
� String s;
� String string; (*)
� String String;
� String char;
11. Given the code, which of the following would equate to true?
String s1 = “yes”;
String s2 = “yes”;
String s3 = new String(s1);
� s1 == s2 (*)
� s1 = s2
� s3 == s1
� s1.equals(s2) (*)
� s3.equals(s1) (*)
12. The String methods equals and compareTo perform the exact same function. True or
false?
True False (*)
13. The == operator can be used to compare two String objects. The result is always true if
the two strings are identical. True or false? True False (*)
14. The following program prints “Equal”. True or false?
� True
� False (*)
15. Given the code below, which of the following calls are valid? String s = new String(“abc”);
� s.trim() (*)
� s.replace(‘a’, ‘A’) (*)
� s.substring(2) (*)
� s.toUpperCase() (*)
� s.setCharAt(1,’A’)
16. Consider the following code snippet. What is printed?
String ocean = new String(“Atlantic Ocean”); System.out.println(ocean.indexOf(‘a’));
0 2 3 (*) 11 12
17. Consider the following code snippet. What is printed?
� 55555
� 87668 (*)
� AtlanticPacificIndianArcticSouthern
� The code does not compile.
� An ArrayIndexOutofBoundsException is thrown.
18. Consider the following code snippet. What is printed?
� 55555
� 87658
� AtlanticPacificIndianArcticSouthern
� The code does not compile.
� An ArrayIndexOutofBoundsException is thrown. (*)
19.How would you use the ternary operator to rewrite this if statement?
if (skillLevel > 5)
numberOfEnemies = 10;
else
numberOfEnemies = 5;
� numberOfEnemies = ( skillLevel > 5) ? 5 : 10;
� numberOfEnemies = ( skillLevel < 5) ? 10 : 5;
� numberOfEnemies = ( skillLevel >= 5) ? 5 : 10;
� numberOfEnemies = ( skillLevel >= 5) ? 10 : 5;
� numberOfEnemies = ( skillLevel > 5) ? 10 : 5; (*)
20. How would you use the ternary operator to rewrite this if statement?
if (gender == “male”)
System.out.print(“Mr.”);
else
System.out.print(“Ms.”);
� System.out.print( (gender == “male”) ? “Mr.” : “Ms.” ); (*)
� System.out.print( (gender == “male”) ? “Ms.” : “Mr.” );
� (gender == “male”) ? “Mr.” : “Ms.” ;
� (gender == “male”) ? “Ms.” : “Mr.” ;
Quiz 3 Sectiunea 6
1. Which of the following would give you an array index out of bounds exception?
� Misspelling a variable name somewhere in your code.
� Refering to an element of an array that is at an index less than the length of the array
minus one.
� Using a single equal symbol to compare the value of two integers.
� Refering to an element of an array that is at an index greater than the length of that array
minus one. (*)
� Unintentionally placing a semicolon directly after initializing a for loop.
2. What exception message indicates that a variable may have been mispelled somewhere
in the program?
� variableName cannot be resolved to a variable (*)
� method methodName(int) is undefined for the type className
� Syntax error, insert “;” to complete statement
� All of the Above
3. Which of the following defines an Exception?
� A very severe non-fixable problem with interpreting and running your code.
� Code that has no errors and therefore runs smothly.
� A problem that can be corrected or handled by your code. (*)
� An interpreter reading your code.
4. What do exceptions indicate in Java?
� The code has considered and dealt with all possible cases.
� A mistake was made in your code. (*)
� There are no errors in your code.
� Exceptions do not indicate anything, their only function is to be thrown.
� The code was not written to handle all possible conditions. (*)
5. Which line of code shows the correct way to throw an exception?
� new throw Exception(“Array index is out of bounds”);
� throw new Exception(“Array index is out of bounds”); (*)
� throw Exception(“Array index is out of bounds”);
� throws new Exception(“Array index is out of bounds”);
6. What does the interpreter look for when an exception is thrown?
� It does not look for anything. It just keeps reading through your code.
� It does not look for anything. It stops interpreting your code.
� The end of the code.
� A catch statement in the code. (*)
7. Which of the following would be a correct way to handle an index out of bounds
exception?
� Throw the exception and catch it. In the catch, set the index to the index of the array
closest to the one that was out of bounds. (*)
� Do nothing, it will fix itself.
� Throw the exception that prints out an error message. There is no need to have the catch
handle the exception if it has already been thrown.
� Rewrite your code to avoid the exception by not permititng the use of an index that is not
inside the array. (*)
8. A computer company has one million dollars to give as a bonus to the employees, and
they wish to distribute it evenly amongst them.
The company writes a program to calculate the amount each employee receives, given the
number of employees.
Unfortunately, the employees all went on strike before they heard about the bonus. This
means that the company has zero employees.
What will happen to the program if the company enters 0 into the employment number?
� An unfixable error will occur.
� The program will calculate that each employee will receive zero dollars because there are
zero employees.
� An exception will occur because it is not possible to divide by zero. (*)
� The programmers will have proven their worth in the company because without them the
company wrote faulty code.
1. Which line of code does not assign 3.5 to the variable x? Mark for Review
(1) Points
double x=3.5
x=3.5;
3.5=x; (*)
x=7.0/2.0;
[Correct] Correct
2. What is the output of the following lines of code?
int j=7,k=5,m=8,result;
result=j-k%3*m;
System.out.println(result); Mark for Review
(1) Points
0
16
-9 (*)
2
[Incorrect] Incorrect. Refer to Section 4 Lesson 3.
3. Which of the following is not a legal name for a variable? Mark for Review
(1) Points
to_be_or_not_to_be
R2d2
4geeks (*)
dgo2sleep
[Correct] Correct
4. Which of the following is not a legal name for a variable? Mark for Review
(1) Points
year2000
zero
2bad (*)
theLastValueButONe
[Correct] Correct
5. Given the following declaration, which line of Java code properly casts one type into
another without data loss?
int i=3,j=4; double y=2.54; Mark for Review
(1) Points
double x= double i/j;
double x=(double)(i/j);
double x=i/j;
int x=(double)2.54;
double x=(double)i/j; (*)
[Correct] Correct
6. Two variables are required to support a conversion of one unit of measure to another unit
of measure. True or False? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
7. In a project, 2 of the classes must contain a main method. True or False? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 4 Lesson 1.
8. In Eclipse, when you run a Java Application, where may the results display? Mark for
Review
(1) Points
Editor Window
Console View (*)
Debug View
Task List
None of the above
[Correct] Correct
9. The following defines an import keyword: Mark for Review
(1) Points
Provides the compiler information that identifies outside classes used within the current
class. (*)
Defines where this class lives relative to other classes, and provides a level of access
control.
Precedes the name of the class.
[Correct] Correct
10. The following defines a class keyword: Mark for Review
(1) Points
Precedes the name of the class. (*)
Provides the compiler information that identifies outside classes used within the current
class.
Defines where this class lives relative to other classes, and provides a level of access
control.
[Incorrect] Incorrect. Refer to Section 4 Lesson 2.
11. Which of the following defines a driver class? Mark for Review
(1) Points
Contains a main method and other static methods. (*)
Contains classes that define objects.
Contains a main method, a package, static methods, and classes that define objects.
None of the above.
[Correct] Correct
12. When importing another package into a class you must import the entire package as well
as the package classes that will be called. True or False? Mark for Review
(1) Points
True
False (*)
[Correct] Correct
13. What will the following code segment output?
Mark for Review
(1) Points
“”\\”
“””\
“”
“”\”
“”\
“”
“”\
” (*)
[Incorrect] Incorrect. Refer to Section 4 Lesson 4.
14. The String methods equals and compareTo perform similar functions and differ in their
return type. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
15. The following code is an example of a correct initialization statement:
char c=”c”; Mark for Review
(1) Points
True
False (*)
[Correct] Correct
1. Determine whether this boolean expression evaluates to true or false:
!(3 < 4 && 5 > 6 || 6 <= 6 && 7 – 1 == 6) Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 5 Lesson 1.
2. Which of the following correctly matches the switch statement keyword to its function?
Mark for Review
(1) Points
(Choose all correct answers)
if: records the user’s input and sends it to the case statements to find a possible match
switch: tells the compiler the value to compare the input against
switch: identifies what element will be compared to the element of the case statements to
find a possible match (*)
default: signals what code to execute if the input does not match any of the cases (*)
case: signals what code is executed if the user input matches the specified element (*)
[Correct] Correct
3. The three logic operators in Java are: Mark for Review
(1) Points
&&, !=, =
!=, =, ==
&&, ||, ! (*)
&, |, =
[Correct] Correct
4. Determine whether this boolean expression evaluates to true or false:
!(3 < 4 && 6 > 6 || 6 <= 6 && 7 – 2 == 6) Mark for Review
(1) Points
True (*)
False
[Correct] Correct
5. The following prints Yes on the screen. True or false?
Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 5 Lesson 1.
6. The six relational operators in Java are: Mark for Review
(1) Points
>, <, =, !=, <=, >=
>, <, =, !, <=, >=
>, <, =, !=, =<, =>
>, <, ==, !=, <=, >= (*)
[Correct] Correct
7. What will print if the following Java code is executed?
Mark for Review
(1) Points
4
5
3 (*)
0
[Correct] Correct
8. Which of the following expressions will evaluate to true when x and y are boolean
variables with opposite values?
I. (x || y) && !(x && y)
II. (x && !y) || (!x && y)
III. (x || y) && (!x ||!y) Mark for Review
(1) Points
I only
II only
I and III
II and III
I, II, and III (*)
[Correct] Correct
9. In a for loop, the counter is automatically incremented after each loop iteration. True or
False? Mark for Review
(1) Points
True
False (*)
[Correct] Correct
10. One advantage to using a while loop over a for loop is that a while loop always has a
counter. True or false? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 5 Lesson 2.
11. What is the output of the following code segment?
int num = 7;
while(num >= 0)
{
num -= 3;
}
System.out.println(num); Mark for Review
(1) Points
-2 (*)
1
2
0
[Correct] Correct
12. What should replace the comment “//your answer here” in the code below if the code is
meant to take no action when i % 2 is 0 (in other words when i is even)?
for(int i = 0; i < 10; i++){
if(i%2 == 0)
//your answer here
else
k+=3;
} Mark for Review
(1) Points
continue; (*)
break;
return;
k+=1;
[Incorrect] Incorrect. Refer to Section 5 Lesson 2.
13. For both the if-else construct and the for loop, it is true to say that when the condition
statement is met, the construct is exited. True or False? Mark for Review
(1) Points
True
False (*)
[Correct] Correct
14. In the code fragment below, the syntax for the for loop’s initialization is correct. True or
false?
public class ForLoop {
public static void main (String args[])
{
for ((int 1=10) (i<20) (i++))
{
System.out.println (“i: ” + i);
}
}
}
Mark for Review
(1) Points
True
False (*)
[Correct] Correct
15. What is one significant difference between a while loop and a do-while loop? Mark for
Review
(1) Points
There is no difference between a DO-WHILE loop and a WHILE loop.
A DO-WHILE loop will always execute the code at least once, even if the conditional
statement for the WHILE is never true. A WHILE loop is only executed if the conditional
statement is true. (*)
A DO-WHILE loop does not exist in Java and a WHILE loop does.
A DO-WHILE loop includes an int that serves as a counter and a WHILE loop does not.
[Incorrect] Incorrect. Refer to Section 5 Lesson 2.
1. Which of the following could be a reason to throw an exception? Mark for Review
(1) Points
To make the user interface harder to navigate.
To eliminate exceptions from disrupting your program. (*)
You have a fatal error in your program.
You have encountered a Stack Overflow Error.
[Correct] Correct
2. Which of the following correctly matches the symbol with its function? Mark for Review
(1) Points
(Choose all correct answers)
== (two equal signs) compares values of primitive types such as int or char. (*)
== (two equal signs) compares the memory location of non-primitive objects. (*)
.equals() compares the value of non-primitive objects. (*)
== (two equal signs) compares the values of non-primitive objects.
= (single equals sign) compares the value of primitive types such as int or char.
[Correct] Correct
3. Which of the following would be a correct way to handle an index out of bounds
exception? Mark for Review
(1) Points
(Choose all correct answers)
Do nothing, it will fix itself.
Throw the exception and catch it. In the catch, set the index to the index of the array closest
to the one that was out of bounds. (*)
Rewrite your code to avoid the exception by not permititng the use of an index that is not
inside the array. (*)
Throw the exception that prints out an error message. There is no need to have the catch
handle the exception if it has already been thrown.
[Correct] Correct
4. Which of the following would give you an array index out of bounds exception? Mark for
Review
(1) Points
Unintentionally placing a semicolon directly after initializing a for loop.
Refering to an element of an array that is at an index greater than the length of that array
minus one. (*)
Refering to an element of an array that is at an index less than the length of the array minus
one.
Using a single equal symbol to compare the value of two integers.
Misspelling a variable name somewhere in your code.
[Correct] Correct
5. If an exception is thrown by a method, where can the catch for the exception be? Mark for
Review
(1) Points
The catch must be immediately after the throw.
The catch can be in the method that threw the exception or in any other method that called
the method that threw the exception. (*)
There does not need to be a catch in this situation.
The catch must be in the method that threw the exception.
[Correct] Correct
6. The following array declaration is valid:
int[] y = new int[5]; Mark for Review
(1) Points
True (*)
False
[Correct] Correct
7. The following creates a reference in memory named y that can refer to five different
integers via an index. True or false?
int[] y = new int[5]; Mark for Review
(1) Points
True (*)
False
[Correct] Correct
8. Which of the following declares and initializes a two dimensional array that can hold 6
Object reference types? Mark for Review
(1) Points
Object array=new Object[6];
String[] array=new String[6];
String[][] array=String[6];
Object[][] array=new Object[2][3]; (*)
[Incorrect] Incorrect. Refer to Section 6 Lesson 1.
9. What is the output of the following segment of code if the command line arguments are “a
b c d e f”?
Mark for Review
(1) Points
1
3
6 (*)
5
This code doesn’t compile.
[Correct] Correct
10. What will be the content of array variable table after executing the following code?
Mark for Review
(1) Points
000
000
000
001
010
100
100
110
111
100
010
0 0 1 (*)
[Correct] Correct
11. Which of the following statements is not a valid array declaration? Mark for Review
(1) Points
double marks[5];
counter int[]; (*)
float []averages;
int number[];
[Incorrect] Incorrect. Refer to Section 6 Lesson 1.
12. What is the output of the following segment of code?
Mark for Review
(1) Points
This code does not compile.
7531 (*)
753
6
7766554433221
[Correct] Correct
13. Which of the following declares and initializes a one dimensional array named words of
size 10 so that all entries can be Strings? Mark for Review
(1) Points
char words=new char[10];
String words=new String[10];
String[] words=new String[10]; (*)
char[] words=new char[10];
[Correct] Correct
14. Which of the following declares a one dimensional array named “score” of type int that
can hold 9 values? Mark for Review
(1) Points
int score=new int[9];
int[] score=new int[9]; (*)
int[] score;
int score;
[Correct] Correct
15. What is the output of the following segment of code if the command line arguments are
“apples oranges pears”?
Mark for Review
(1) Points
apples
args
This code does not compile.
oranges
pears (*)
[Correct] Correct
1. Which is the most accurate description of the code reuse philosophy? Mark for Review
(1) Points
A programming philosophy that promotes protecting data and hiding implementation in order
to preserve the integrity of data and methods.
A programming philosophy that promotes simpler, more efficient coding by using existing
code for new applications. (*)
A programming philosophy that promotes stealing your classmates’ code.
A programming philosophy that promotes having no concern about the security of code.
[Correct] Correct
2. What does it mean to inherit a class? Mark for Review
(1) Points
Extending a method from a superclass.
A way of organizing the hierarchy of classes.
The subclass (or child class) gains access to any non-private methods and variables of the
superclass (or parent class). (*)
The access specifier has been set to private.
[Correct] Correct
3. What is a UML? Mark for Review
(1) Points
Unidentified Molding Level, the level of access permitted by the default access specifier.
Unified Modeling Language, a standardized language for modeling systems and structures
in programming. (*)
Universal Model Light, a program that reads the brightness of any given lightbulb.
None of the above.
[Correct] Correct
4. The following code creates an object of type Horse:
Whale a=new Whale(); Mark for Review
(1) Points
True
False (*)
[Correct] Correct
5. Which of the following creates an object from the Car class listed below?
Mark for Review
(1) Points
Car c =new Car();
Car c=new Car;
Car c=Car();
Car c;
Car c = new Car(3000, “Toyota”); (*)
[Incorrect] Incorrect. Refer to Section 7 Lesson 1.
6. What is true about the code below:
Car car1=new Car();
Car car2=new Car();
car2=car1;
Mark for Review
(1) Points
(Choose all correct answers)
There is a Car object that car1 referenced that is now slated for removal by the garbage
collector.
There is a Car object that car2 referenced that is now slated for removal by the garbage
collector.
There are no more Car objects in memory.
The reference car2 points to an exact copy of the Car Object that car1 references. (*)
The references car1 and car2 are pointing to two Car Objects in memory.
[Incorrect] Incorrect. Refer to Section 7 Lesson 1.
7. Why would a programmer use polymorphism rather than sticking to a standard array?
Mark for Review
(1) Points
Because it is easier to add or remove objects using polymorphism even when all of the
objects are of the same type.
Because arrays only work using the same object type and polymorphism provides a way
around this. (*)
A programmer wouldn’t use polymorphism over a standard array.
Because arrays are more complex and polymorphism simplifies them by restricting them to
only contain the same type objects.
[Correct] Correct
8. If a class is immutable then it must be abstract. True or false? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 7 Lesson 5.
9. It is possible to override methods such as equals() and toString() in a subclass of Object
to fit the needs of the objects of the subclass. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
10. Which segment of code represents a correct way to call a variable argument method
counter that takes in integers as its variable argument parameter? Mark for Review
(1) Points
counter(“one”,”two”,String[] nums);
counter(String a, int b);
counter(int[] numbers);
counter(1, 5, 8, 17, 11000005); (*)
[Correct] Correct
11. Which of the following is a possible way to overload constructors? Mark for Review
(1) Points
(*)
 
 
[Incorrect] Incorrect. Refer to Section 7 Lesson 2.
12. Which of the following correctly defines overloading? Mark for Review
(1) Points
A type of access specifier that only allows access from inside the same class.
A variable argument method that returns an array.
Having more than one constructor with the same name but different arguments. (*)
Having more than one constructor with different names and the same arguments.
[Correct] Correct
13. Static classes can have different access specifiers than the parent class. True or false?
Mark for Review
(1) Points
True (*)
False
[Correct] Correct
14. Static methods can change instance variables at run-time. True or false? Mark for
Review
(1) Points
True
False (*)
[Correct] Correct
15. You can create static class methods inside any Java class. True or false? Mark for
Review
(1) Points
True (*)
False
[Correct] Correct
6. What is the function of the word “break” in Java? Mark for Review
(1) Points
It exits the current loop or case statement. (*)
It continues onto the next line of code.
It does not exist in Java.
It stops the program from running.
[Incorrect] Incorrect. Refer to Section 5 Lesson 2.
7. All of the following are essential to initializing a for loop, except which one? Mark for
Review
(1) Points
Updating the counter.
Having a conditional statement.
Initializing the iterator(i).
Having an if statement. (*)
[Incorrect] Incorrect. Refer to Section 5 Lesson 2.
8. The following prints Yes on the screen. True or false?
Mark for Review
(1) Points
True
False (*)
[Correct] Correct
9. The three logic operators in Java are: Mark for Review
(1) Points
&&,!=,=
&&, ||, ! (*)
&,|,=
!=,=,==
[Correct] Correct
10. The six relational operators in Java are: Mark for Review
(1) Points
>, <, =, !, <=, >=
>, <, =, !=, =<, =>
>, <, =, !=, <=, >=
>, <, ==, !=, <=, >= (*)
[Correct] Correct
11. The three logic operators in Java are: Mark for Review
(1) Points
!=, =, ==
&&, ||, ! (*)
&&, !=, =
&, |, =
[Correct] Correct
12. Which of the following are relational operators in Java? Mark for Review
(1) Points
(Choose all correct answers)
< (*)
<= (*)
=
!= (*)
All of the above.
[Correct] Correct
13. Which of the following correctly initializes an instance of Scanner, called “in”, that reads
input from the console screen? Mark for Review
(1) Points
Scanner in = Scanner(System.in);
Scanner in = new Scanner(System.in); (*)
Scanner in = new Scanner(“System.in”);
System.in in = new Scanner();
[Incorrect] Incorrect. Refer to Section 5 Lesson 1.
14. In an if-else construct the condition to be evaluated must end with a semi-colon. True or
false? Mark for Review
(1) Points
True
False (*)
[Correct] Correct
15. In an if-else construct, the condition to be evaluated must be contained within
parentheses. True or False? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
1. Which of the following correctly matches the symbol with its function? Mark for Review
(1) Points
(Choose all correct answers)
== (two equal signs) compares values of primitive types such as int or char. (*)
== (two equal signs) compares the memory location of non-primitive objects. (*)
== (two equal signs) compares the values of non-primitive objects.
.equals() compares the value of non-primitive objects. (*)
= (single equals sign) compares the value of primitive types such as int or char.
Correct Correct
2. What do exceptions indicate in Java? Mark for Review
(1) Points
(Choose all correct answers)
There are no errors in your code.
The code has considered and dealt with all possible cases.
Exceptions do not indicate anything, their only function is to be thrown.
A mistake was made in your code. (*)
The code was not written to handle all possible conditions. (*)
Correct Correct
3. Which of the following defines an Exception? Mark for Review
(1) Points
Code that has no errors and therefore runs smothly.
A very severe non-fixable problem with interpreting and running your code.
A problem that can be corrected or handled by your code. (*)
An interpreter reading your code.
Correct Correct
4. Which of the following could be a reason to throw an exception? Mark for Review
(1) Points
To make the user interface harder to navigate.
You have encountered a Stack Overflow Error.
To eliminate exceptions from disrupting your program. (*)
You have a fatal error in your program.
Correct Correct
5. What exception message indicates that a variable may have been mispelled somewhere
in the program? Mark for Review
(1) Points
variableName cannot be resolved to a variable (*)
method methodName(int) is undefined for the type className
Syntax error, insert “;” to complete statement
All of the above
Correct Correct
6. The following array declaration is valid. True or false?
int k[] = new int[10]; Mark for Review
(1) Points
True (*)
False
Correct Correct
7. What will array arr contain after the following code segment has been executed?
int [] arr = {5, 4, 2, 1, 0};
for (int i = 1; i < arr.length; i++)
{
arr[i – 1] += arr[i];
} Mark for Review
(1) Points
7, 3, 2, 1, 0
9, 6, 3, 1, 0 (*)
9, 6, 1, 3, 0
None of the above.
10, 6, 3, 1, 0
Correct Correct
8. The following segment of code initializes a 2 dimensional array of references. True or
false?
String[][] array={{“a”, “b”, “C”},{“a”, “b”, “c”}}; Mark for Review
(1) Points
True (*)
False
Correct Correct
9. Which of the following declares and initializes a one dimensional array named words of
size 3 so that all entries can be Strings? Mark for Review
(1) Points
String[] words={“Over”,”the”,”mountain”}; (*)
String[] words=new String[3];
String strings=new String[3];
String[] words={“Oracle”,”Academy”}];
Incorrect Incorrect. Refer to Section 6 Lesson 1.
10. What is the output of the following segment of code?
Mark for Review
(1) Points
220
2
0 (*)
This code does not compile.
222220
Incorrect Incorrect. Refer to Section 6 Lesson 1.
11. The following segment of code initializes a 2 dimensional array of primitive data types.
True or false?
double[][] a=new double[4][5]; Mark for Review
(1) Points
True (*)
False
Correct Correct
12. The following array declaration is valid. True or false?
; int x[] = int[10]; Mark for Review
(1) Points
True
False (*)
Incorrect Incorrect. Refer to Section 6 Lesson 1.
13. The following creates a reference in memory named y that can refer to five different
integers via an index. True or false?
int[] y = new int[5]; Mark for Review
(1) Points
True (*)
False
Correct Correct
14. The following segment of code prints all five of the command line arguments entered into
this program. True or false?
Mark for Review
(1) Points
True
False (*)
Incorrect Incorrect. Refer to Section 6 Lesson 1.
15. Which of the following declares and initializes a one dimensional array that can hold 5
Object reference types? Mark for Review
(1) Points
Object[] array=new Object[4];
String[] array=new String[5];
String[] array=String[4];
Object array=new Object[5]; (*)
Incorrect Incorrect. Refer to Section 6 Lesson 1.
1. What is the output of the following segment of code?
Mark for Review
(1) Points
111
11 (*)
This code doesn’t compile.
1111
321111
Incorrect Incorrect. Refer to Section 6 Lesson 1.
2. Which of the following statements is not a valid array declaration? Mark for Review
(1) Points
float []averages;
int number[];
double marks[5];
counter int[]; (*)
Correct Correct
3. Which of the following statements add all of the elements of the one dimensional array
prices, and then prints the sum to the screen? Mark for Review
(1) Points
int total = 0;
for(int i = 0; i total+=prices[i];
System.out.println(total); (*)
int total = 0;
for(int i = 0; i total+=prices[i];
int total = 0;
for(int i = 1; i total = total+prices[i];
System.out.println(prices);
int total = 0;
for(int i = 0; i total+=prices[i];
System.out.println(prices);
Correct Correct
4. What is the output of the following segment of code?
int num[]={9,8,7,6,5,4,3,2,1};
for(int i=0;i<9;i=i+3)
System.out.print(num[i]); Mark for Review
(1) Points
9630
97531
This code doesn’t compile.
963 (*)
987654321
Incorrect Incorrect. Refer to Section 6 Lesson 1.
5. Which of the following declares and initializes a two dimensional array with 3 rows and 2
columns? Mark for Review
(1) Points
int a={{1,1,1},{1,1,1}};
int a={{1,1},{1,1},{1,1}};
int[][] a={{1,1,1},{1,1,1}};
int[][] a={{1,1},{1,1},{1,1}}; (*)
Incorrect Incorrect. Refer to Section 6 Lesson 1.
6. Which of the following declares and initializes a one dimensional array named words of
size 3 so that all entries can be Strings? Mark for Review
(1) Points
String[] words={“Over”,”the”,”mountain”}; (*)
String[] words={“Oracle”,”Academy”}];
String strings=new String[3];
String[] words=new String[3];
Incorrect Incorrect. Refer to Section 6 Lesson 1.
7. The following creates a reference in memory named q that can refer to eight different
doubles via an index. True or false?
double[] q = new double[8]; Mark for Review
(1) Points
True (*)
False
Correct Correct
8. The following array declaration is valid. True or false?
int[] y = new int[5]; Mark for Review
(1) Points
True (*)
False
Incorrect Incorrect. Refer to Section 6 Lesson 1.
9. What is the output of the following segment of code if the command line arguments are
“apples oranges pears”?
Mark for Review
(1) Points
args
oranges
This code does not compile.
apples
pears (*)
Correct Correct
10. Which of the following declares and initializes a two dimensional array that can hold 6
Object reference types? Mark for Review
(1) Points
Object array=new Object[6];
String[][] array=String[6];
Object[][] array=new Object[2][3]; (*)
String[] array=new String[6];
Correct Correct11. Which of the following would be a correct way to handle an index out of
bounds exception? Mark for Review
(1) Points
(Choose all correct answers)
Do nothing, it will fix itself.
Throw the exception that prints out an error message. There is no need to have the catch
handle the exception if it has already been thrown.
Rewrite your code to avoid the exception by not permititng the use of an index that is not
inside the array. (*)
Throw the exception and catch it. In the catch, set the index to the index of the array closest
to the one that was out of bounds. (*)
Correct Correct
12. It is possible to throw and catch a second exception inside a catch block of code. True or
false? Mark for Review
(1) Points
True (*)
False
Correct Correct
13. Which of the following defines an Exception? Mark for Review
(1) Points
A very severe non-fixable problem with interpreting and running your code.
Code that has no errors and therefore runs smothly.
A problem that can be corrected or handled by your code. (*)
An interpreter reading your code.
Correct Correct
14. What does the interpreter look for when an exception is thrown? Mark for Review
(1) Points
It does not look for anything. It just keeps reading through your code.
It does not look for anything. It stops interpreting your code.
A catch statement in the code. (*)
The end of the code.
Correct Correct
15. Choose the best response to this statement: An error can be handled by throwing it and
catching it just like an exception. Mark for Review
(1) Points
True. Although errors may be more severe than exceptions they can still be handled in code
the same way exceptions are.
True. Errors and exceptions are the same objects and are interchangeable.
False. An error is much more severe than an exception and cannot be dealt with adequately
in a program. (*)
False. Exceptions are caused by a mistake in the code and errors occur for no particular
reason and therefore cannot be handled or avoided.
Correct Correct
How many times will the following loop be executed?
What is the value of x after the loop has finished?
What is the value of count after the loop has finished?
int count = 17;
int x = 1;
while(count > x){
x*=3;
count-=3;
} Mark for Review
(1) Points
3; 27; 8 (*)
3; 9; 11
5; 27; 8
5; 30; 5
4; 8; 27
Incorrect Incorrect. Refer to Section 5 Lesson 2.
What is the function of the word “break” in Java?
Which of the following correctly initializes a for loop that executes 5 times? Mark for Review
(1) Points
for(int i = 0; i == 6; i++)
for(int i = 1; i < 5; I++)
for(int i = 1; i < 6; i++) (*)
for(int i = 0; i < 5; I++)
Correct Correct
8. The following code fragment properly implements the switch statement. True or false?
default(input)
switch ‘+’:
answer+=num;
break;
case ‘-‘:
answer-=num;
break;
!default
System.out.println(“Invalid input”); Mark for Review
(1) Points
True
False (*)
Incorrect Incorrect. Refer to Section 5 Lesson 1.
What will print if the following Java code is executed?
if ((5.1 > 4.3 && 6.2 < 8.4) && !(7.2 < 3.5 || 1.2 == 2.1 || 2.2 != 2.25))
System.out.print(“TRUE”);
else
System.out.print(“FALSE”); Mark for Review
(1) Points
True
False (*)
A computer company has one million dollars to give as a bonus to the employees, and they
wish to distribute it evenly amongst them.
The company writes a program to calculate the amount each employee receives, given the
number of employees.
Unfortunately, the employees all went on strike before they heard about the bonus. This
means that the company has zero employees.
What will happen to the program if the company enters 0 into the employment number?
Mark for Review
(1) Points
(Choose all correct answers)
An exception will occur because it is not possible to divide by zero. (*)
The programmers will have proven their worth in the company because without them the
company wrote faulty code.
An unfixable error will occur.
The program will calculate that each employee will receive zero dollars because there are
zero employees.
What will be the content of the array variable table after executing the following code?
Mark for Review
(1) Points
111
011
001
100
010
001
001
010
100
100
110
1 1 1 (*)
10. What is the output of the following segment of code?
Mark for Review
(1) Points
666666
643432
262423242322
1286864 (*)
This code does not compile.
13. Which of the following declares and initializes a two dimensional array named values
with 2 rows and 3 columns where each element is a reference to an Object? Mark for
Review
(1) Points
String[][] values;
String[][] values={“apples”,”oranges”,”pears”};
String[][] values=new String[2][3]; (*)
String[][] values=new String[3][2];
Correct Correct
14. The following creates a reference in memory named k that can refer to six different
integers via an index. True or false?
int k[]= int[6]; Mark for Review
(1) Points
True
False (*)
Incorrect Incorrect. Refer to Section 6 Lesson 1.
15. Which of the following declares and initializes a one dimensional array named values of
size 5 so that all entries contain 1? Mark for Review
(1) Points
int values={1,1,1,1,1};
int[] values={1};
int values[]={1,1,1,1,1,1};
int[] values={1,1,1,1,1}; (*)
Incorrect Incorrect. Refer to Section 6 Lesson 1.
1. The following creates a reference in memory named z that can refer to seven different
doubles via an index. True or false?
double z[] = new double[7]; Mark for Review
(1) Points
True (*)
False
Incorrect Incorrect. Refer to Section 6 Lesson 1.
2. The following array declaration is valid. True or false?
int k[] = new int[10]; Mark for Review
(1) Points
True (*)
False
Incorrect Incorrect. Refer to Section 6 Lesson 1.
11. What does it mean to catch an exception? Mark for Review
(1) Points
It means to handle it. (*)
It means you have fixed the error.
It means there was never an exception in your code.
It means to throw it.
Correct Correct
12. Suppose you are writing a program where the user is prompted to the give coordinates
where they believe the princess is inside of the castle.
Your program moves the prince to the coordinates that the user specified. If the princess is
not found at those coordinates, the user is given a clue that helps them guess coordinates
closer to the princess. The user is allowed to enter their new guess of where the princess is.
Assume your program does not take into consideration the possibility that the user may
enter coordinates outside of the castle where the princess could not be. What would be the
result of the user entering coordinates outside of the castle? How could this be handled in
your code? Mark for Review
(1) Points
(Choose all correct answers)
An exception would occur. This could be handled by throwing the exception in your code if
the user enters invalid coordinates. When the exception is caught, the prince could be
moved to the coordinate inside the castle that is closest to those that the user specified. (*)
An exception would occur but could not be handled inside your code. The user would have
to restart the program and enter proper coordinates.
An exception would occur. This could be handled by throwing an exception in your code if
the user enters invalid coordinates. When the exception is caught, the user could be
prompted to enter coordinates within the given range of the castle. (*)
An error would occur. Errors cannot be handled by code.
Correct Correct
13. Which of the following defines an Exception? Mark for Review
(1) Points
Code that has no errors and therefore runs smothly.
An interpreter reading your code.
A very severe non-fixable problem with interpreting and running your code.
A problem that can be corrected or handled by your code. (*)
Correct Correct
14. A logic error occurs if an unintentional semicolon is placed at the end of a loop initiation
because the interpreter reads this as the only line inside the loop, a line that does nothing.
Everything that follows the semicolon is interpreted as code outside of the loop. True or
false? Mark for Review
(1) Points
True
False (*)
Correct Correct
15. What is wrong with this code?
Mark for Review
(1) Points
It gives you an out of bounds exception.
It is missing a semicolon.
It does not compile. (*)
There is nothing wrong with this code.
Incorrect Incorrect. Refer to Section 6 Lesson 2.
5. What is true about the Object class? Mark for Review
(1) Points
(Choose all correct answers)
It extends other classes.
Its methods can be overloaded in subclasses. (*)
Its methods can be overridden in subclasses. (*)
It is the highest superclass. (*)
Incorrect Incorrect. Refer to Section 7 Lesson 5.
6. What is the Java keyword final used for in a program? Mark for Review
(1) Points
It permits redefining methods of a parent class inside the child class, with the same name,
parameters, and return type.
There is no such keyword in Java.
It permits access to the class variables and methods from anywhere.
It restricts a class from being extendable and restricts methods from being overridden. (*)
It terminates the program.
The final keyword makes a static variable act like a constant. True or false? Mark for Review
(1) Points
True (*)
False
Static methods can read static variables. True or false? Mark for Review
(1) Points
True (*)
False
Incorrect Incorrect. Refer to Section 7 Lesson 3.
11. What does it mean to inherit a class? Mark for Review
(1) Points
The access specifier has been set to private.
The subclass (or child class) gains access to any non-private methods and variables of the
superclass (or parent class). (*)
Extending a method from a superclass.
A way of organizing the hierarchy of classes.
Correct Correct
12. Which of the following correctly describes an “is-a” relationship? Mark for Review
(1) Points
A programming philosophy that promotes simpler, more efficient coding by using exiting
code for new applications.
It restricts access to a specified segment of code.
A programming philosophy that promotes protecting data and hiding implementation in order
to preserve the integrity of data and methods.
A helpful term used to conceptualize the relationships among nodes or leaves in an
inheritance hierarchy. (*)
Correct Correct
13. What type(s) would work for a variable argument method? Mark for Review
(1) Points
(Choose all correct answers)
Integers, Strings, and Booleans (*)
Constructors
Arrays (*)
Objects (*)
All of the above
Correct Correct
14. Identify the error(s) in the class below. Choose all that apply
Mark for Review
(1) Points
Final cannot be used as an access modifier.
The parameters must be the same for all methods with the same name.
Private cannot be used as an access modifier.
Two methods cannot have the same name.
No method named min is defined. (*)
Correct Correct
15. Which of the following could be a reason to need to pass an object into a method? Mark
for Review
(1) Points
Easier access to the information contained within the object.
The ability to make changes to an object inside of the method.
Comparing two objects.
All of the above. (*)
Correct Correct
2. Which of the following is true about a do-while loop? Mark for Review
(1) Points
It is a post-test loop.
It is a modified while loop that allows the program to run through the loop once before testing
the boolean condition.
It continues looping until the condition becomes false.
All of the above. (*)
[Incorrect] Incorrect. Refer to Section 5 Lesson 2.
14. How would you use the ternary operator to rewrite this if statement?
if (gender == “female”) System.out.print(“Ms.”);
else
System.out.print(“Mr.”); Mark for Review
(1) Points
System.out.print( (gender == “female”) ? “Mr.” : “Ms.” );
(gender == “female”) ? “Mr.” : “Ms.” ;
System.out.print( (gender == “female”) ? “Ms.” : “Mr.” ); (*)
(gender == “female”) ? “Ms.” : “Mr.” ;
[Incorrect] Incorrect. Refer to Section 5 Lesson 1.
 

What is wrong with this code?

1  Mark
.  for Review
(1) Points
It is missing a
semicolon.

It gives you an out of


bounds exception.

It does not compile.


(*)

There is nothing
wrong with this code.

Inc
orre
ct.
Ref
er
to
Sect
ion
6
Les
son
2.

 Mar
k for
Review
What does it mean to catch an (1) Points
2.  exception?

It means you have


fixed the error.

It means to throw it.


It means there was
never an exception in
your code.

It means to handle it.


(*)

Cor
rect

 Mar
k for
Review
What do exceptions indicate in (1) Points
3.  Java?

(Choose all correct answers)

The code has


considered and dealt
with all possible
cases.

Exceptions do not
indicate anything,
their only function is
to be thrown.

There are no errors in


your code.

The code was not


written to handle all
possible conditions.
(*)
A mistake was made
in your code. (*)

Cor
rect

 Mar
k for
Review
Which of the following could be (1) Points
4.  a reason to throw an exception?

To make the user


interface harder to
navigate.

You have
encountered a Stack
Overflow Error.

To eliminate
exceptions from
disrupting your
program. (*)

You have a fatal


error in your
program.

Cor
rect
A logic error occurs if an
unintentional semicolon is
placed at the end of a loop
initiation because the interpreter
reads this as the only line inside
the loop, a line that does  Mar
nothing. Everything that follows k for
the semicolon is interpreted as Review
code outside of the loop. True or (1) Points
5.  false?

True

False (*)

Cor
rect

What will be the content of array


variable table after executing the
following code?

 Mark
6 for
.  Review
(1) Points

000
000
000
100
110
111

001
010
100

100
010
0 0 1 (*)

Correct

 
Mark
for
Revi
Which of the following declares and initializes a ew
two dimensional array named values with 2 rows (1)
and 3 columns where each element is a reference Point
7.  to an Object? s

String[][] values=new String[2][3];


(*)

String[][] values=new String[3][2];

String[][]
values={“apples”,”oranges”,”pears”}
;

String[][] values;
Correct

 
Mark
for
Revi
ew
Which of the following declares and initializes a (1)
one dimensional array that can hold 5 Object Point
8.  reference types? s

Object[] array=new Object[4];

String[] array=new String[5];

Object array=new Object[5]; (*)

String[] array=String[4];

Correct

 
Mark
for
Revi
The following creates a reference in memory
ew
named y that can refer to five different integers
(1)
via an index. True or false?
Point
9.  int[] y = new int[5]; s

True (*)
False

Correct

What is the output of the following segment of


code if the command line arguments are “apples
oranges pears”?

 
Mark
for
Revi
ew
(1)
Point
10.  s

This code does not compile.

3 (*)

Incorrect. Refer to
Section 6 Lesson 1.

 
 
 
 

The
followin
g
segment
of code
initialize
sa2
dimensi
onal
array of
referenc
es. True
or false?
String[]
[]
array={
{“a”,
“b”,
“C”},
1 {“a”,  Mark for
1.  “b”, Review
“c”}}; (1) Points

True (*)

False

Correct

Which of the following declares and initializes a one  Mark


dimensional array named values of size 5 so that all entries for Review
12.  contain 1? (1) Points
int values[]={1,1,1,1,1,1};

int values={1,1,1,1,1};

int[] values={1,1,1,1,1}; (*)

int[] values={1};

Correct

What is the output of the following segment of code?

 Mark
for Review
13.  (1) Points

456789

This code doesn’t compile.

987654

777777 (*)

555555

Correct
What will be the content of the array variable table after
executing the following code?

 Mark
for Review
14.  (1) Points

100
010
001

111
011
001

100
110
1 1 1 (*)

001
010
100

Incorrect. Refer to Section 6


Lesson 1.

double array[] = new double[8];


 Mark
After execution of this statement, which of the following are for Review
15.  true? (1) Points
array[2] is 8

array.length is 8 (*)

array[4] is null

array[0] is undefined

Incorrect. Refer to Section 6


Lesson 1.

int j=6,k=4,m=12,result;
result=j/m*k; 
System.out.println(result);

S-ar putea să vă placă și