Anda di halaman 1dari 74

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, procedural abstraction is the concept of making code easier to
. understand and reuse. True or false?

Mark for
Review
(1) Points

True (*)
False
Correct
2 In Alice, if a procedure is declared for a clownFish class, which classes
. can use the procedure?

Mark for
Review
(1) Points

The clownFish class and Swimmer class


ClownFish class (*)
The pajamaFish class, clownFish class, and Swimmer class
Any class with "Fish" in the class name
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

Visual storyboard
Flowchart (*)
Pie chart
Scene editor
Class chart

Incorrect. Refer to Section 2 Lesson 5.


4In Alice, which function is used to move an object directly to the center
. point of another object?

Mark for
Review
(1) Points

getObject
getDuration
getDepth
getDistance (*)
Incorrect. Refer to Section 2 Lesson 7.
5Which 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 after the block is executed. (*)
The condition loopVal < 5 returns a boolean value.
None of the above.
Correct
6.If you
want one
message
to display
if a user
is below
the age of
18 and a

Mark for Review


(1) Points

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 (*)
Incorrect. Refer to Section 2 Lesson
14.
7. The Alice IF control structure requires the false statement to
be populated. True or false?

Mark for Review


(1) Points

True
False (*)
Correct
8. 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
9. In Alice, the setVehicle procedure will associate one object to
another. True or false?

Mark for Review


(1) Points

True (*)
False
Incorrect. Refer to Section 2 Lesson
6.
10. 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 fish swimming. (*)
A bird flying. (*)
Incorrect. Refer to Section 2 Lesson
6
1In
1.Alice,
how is
a oneshot
procedu
re
differen
t from
procedu
res 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. Refer to Section 2 Lesson 2.

12. From your Alice lessons, variables are fixed and cannot be changed.
True or false?

Mark for
Review
(1) Points

True
False (*)
Correct
13. 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
14. From your Alice lessons, what does the Count control statement do?

Mark for
Review
(1) Points

Executes statements a random number of times.


Executes statements simultaneously.
Executes statements a specific number of times. (*)
Executes statements while a condition is true.
Correct
15. 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 (*)
Correct
Section 2
(Answer all questions in this section)
16.From your Alice lessons, at what point in the animation process do
you confirm the items on the "Checklist for Animation Completion"?

Mark for Review


(1) Points

Before designing the animation.


During and after the animation process. (*)
At the beginning of the animation process.
After adding each procedure to the Code editor.
Correct

17.Debugging and testing is the process of running the animation one


time, and adjusting the control statements, procedures, and
arguments.

Mark for Review


(1) Points

True
False (*)
Incorrect. Refer to Section 2 Lesson 3.
18.From your Alice lessons, complete the following sentence: When
coded, an event triggers a ___________.

Mark for Review


(1) Points

Infinite loop
Gallery
Procedure (*)
Scene
Correct
19.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
20.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 getDepth}


this.Fish move forward {this.Fish getDistanceTo this.Rock this.Rock getDepth} (*)
this.Fish move forward {this.Rock getDistanceTo this.Fish -

this.Fish - 2}
this.Rock move forward {this.Rock getDistanceTo this.Fish this.Fish - 2}
Correct
2Examine the following code. What are the variables?
1.

Mark for Review


(1) Points

(Choose all correct


answers)
args
n (*)
i (*)
t
Incorr
ect.
Refer
to
Sectio
n2
Lesso
n 13.
22. Which of the following
is not a valid arithmetic
operator in Java?
+

Mark for
Review
(1) Points

/
*
%
None of the above
(*)
Corre
ct

Section 3
(Answer all questions in this section)
23. From your Greenfoot
lessons, source code is
written in the Code
editor. True or false?

Mark for
Review
(1) Points

True (*)
False
Corre
ct
24. In Greenfoot, what
happens if the
condition is false in an
if-statement?
The programming
statements are
executed.
The if-statement is
executed.
The act method is
deleted.
The programming
statements are not
executed. (*)
Corre
ct

Mark for
Review
(1) Points

25. 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 (*)
Incorr
ect.
Refer
to
Sectio
n3
Lesso
n6
Mark for Review

26.From
your
Greenfoot
lessons,
how do
you call a
defined
method?

(1) Points

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.
Correct
27. 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
Target (*)

Primary
Programmer
Incorrect. Refer to Section 3 Lesson
4.
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
29. Using Greenfoot, how do we change the size and resolution
of the World instance?

Mark for
Review
(1) Points

Edit the methods in the class.


Edit the values in the constructor. (*)
Delete the instance.
Edit the values in the class's act method.
Correct
30. 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
31.Using the
Greenfoot
IDE, when is
a constructor
automatically
executed?

Mark for Review


(1) Points

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.
Correct
32. From your Greenfoot lessons, which of the following is an
example of a type of data passed through a parameter?

Mark for
Review
(1) Points

Methods
Classes
Integers (*)
Scenarios
Incorrect. Refer to Section 3
Lesson 2.
33. In Greenfoot, the properties of an instance can be
modified in the documentation. True or false?

Mark for
Review
(1) Points

True
False (*)
Incorrect. Refer to Section 3
Lesson 2.
34. From your Greenfoot lessons, which of the following are
properties of an instance?

Mark for
Review
(1) Points

Size
Color
Image file
Methods
All of the above (*)

Incorrect. Refer to Section 3


Lesson 2.
35. In the following Greenfoot method signature, which is the
method name?

Mark for
Review
(1) Points

void turnLeft()
()
void
turnLeft (*)
Left
Correct
36.From your
Greenfoot
lessons,
which of the
following is
not a
characteristic
of a static
method?

Mark for Review


(1) Points

Belongs to a class itself


Belongs to an instance itself (*)
Available for other classes to use with dot notation
Signature contains the word static
Is a method
Incorrect. Refer to Section 3
Lesson 5.
37. 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?
True (*)
False
Correct

Mark for
Review
(1) Points

38. When a Greenfoot code segment is executed in an ifstatement, each line of code is executed in sequential
order. True or false?

Mark for
Review
(1) Points

True (*)
False
Correct
39. 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
40. From your Greenfoot lessons, the keyDown method is
located in which class?

Mark for
Review
(1) Points

Actor
Greenfoot (*)
GreenfootImage
World
Correct
41.From
your
Greenfoot
lessons,
which of
the
following
is not a
step to
creating a
new
subclass?

Mark for Review


(1) Points

Right-click on a superclass.
Click New subclass...
Name the class.
Select an image for the class.
Program the class to move forward. (*)
Incorrect. Refer to Section 3 Lesson
1.
42. 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
43. How would the following sentence be written in Greenfoot
source code? If Duke's leg is down, and the keyboard key "d"
is down...

Mark for
Review
(1) Points

if (&&isDown ! Greenfoot.isKeyDown("d") )
if (!isDown && Greenfoot.isKeyDown("d") )
if (isDown && Greenfoot.isKeyDown("d") ) (*)
if (!Greenfoot.isKeyDown && isDown("d") )
Correct
44. 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 section of code one time.
A statement that can execute a method multiple times.
Incorrect. Refer to Section 3 Lesson

45. From your Greenfoot lessons, when do infinite loops occur?

Mark for
Review
(1) Points

When the loop is executed.


Only in while loops.
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.
Section 3
(Answer all questions in this section)
4In the following Greenfoot array, what statement would you write to access
6.the "a" key?
Keynames = {"a", "b", "c", "d"};

Mark for
Review
(1) Points

keynames[2]
keynames["a"]
keynames[0] (*)
keynames["a" key]
Correct
4From your Greenfoot lessons, which line of code is missing something?
7.

Mark for
Review
(1) Points

1
3 (*)
4

5
6
Correct
4In Greenfoot, the image below is an example of what construct?
8.

Mark for
Review
(1) Points

Method
Comment
Constructor (*)
Class
Incorrect. Refer to Section 3 Lesson 12.
4Use your Greenfoot skills to answer the question. What is incorrect in this
9.code?

Mark for
Review
(1) Points

Spacing missing
Curly brace missing
Parenthesis missing (*)
Comma missing
Correct

5From your Greenfoot lessons, which of the following are examples of


0.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. (*)
Correct
Section 2
(Answer all questions in this section)
1. 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 (*)
Incorrect. Refer to Section 2 Lesson 4.
2. Which of the following is not an Alice variable value type?

Mark for
Review
(1) Points

Color
Decimal Number
Whole Number
Function (*)
Incorrect. Refer to Section 2 Lesson 10.
3. 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
4. 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


getDepth}
this.Fish move forward {this.Fish getDistanceTo this.Rock - this.Rock
getDepth} (*)
this.Fish move forward {this.Rock getDistanceTo this.Fish - this.Fish - 2}
this.Rock move forward {this.Rock getDistanceTo this.Fish - this.Fish 2}
Incorrect. Refer to Section 2 Lesson 9.
5. Identify an example of an Alice expression.

Mark for
Review
(1) Points

"I feel happy."


If or Where
3x3=9 (*)
None of the above
Correct
6. From your
Alice lessons,
complete the
following
sentence:
When coded,
an event
triggers a
___________.

Mark for Review


(1) Points

Infinite loop
Gallery
Procedure (*)
Scene
Correct

7. The Alice IF control structure requires the false statement to be


populated. True or false?

Mark for
Review
(1) Points

True
False (*)
Correct
8. 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
9. 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 (*)
Incorrect. Refer to Section 2 Lesson 12.
10. 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
Incorrect. Refer to Section 2 Lesson 12.

11. When you


want
specific
code to
be
executed
only if
certain
condition
s are met,
what type
of Java
construct
would
you use?

Mark for Review


(1) Points

while loop
if (*)
array
boolean
Correct
12. 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.
Correct
13. 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
14. From your Alice lessons, which of the following are types of
storyboards?

Mark for

Review
(1) Points
(Choose all correct answers)
Actual
Textual (*)
Factual
Visual (*)
Fictional
Incorrect. Refer to Section 2 Lesson 5.
15. 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
Incorrect. Refer to Section 2 Lesson 5.
16. Which of
the
following
actions
would
require a
control
statemen
t to
control
animatio
n timing?

Mark for Review


(1) Points

(Choose all correct answers)


A biped object walking. (*)
A rock object turning.
A fish swimming. (*)
A bird flying. (*)
Correct
17. 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
18. In Alice, the setVehicle procedure will associate one object to
another. True or false?

Mark for
Review
(1) Points

True (*)
False
Correct
19. 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
20. The following are examples of what in Java?
boolean
bite
char
short
int
long
float
double
Types (*)
Expressions
Variables
Specifications

Mark for
Review
(1) Points

Incorrect. Refer to Section 2 Lesson 13.


21. The move
procedure
in Alice
moves an
object in
how many
different
possible
directions
?

Mark for Review


(1) Points

1
4
3
6 (*)
Correct
22. From your Alice lessons, which programming instruction represents
the following movement: A cat moves forward double (or twice) the
distance to the tree.

Mark for
Review
(1) Points

this.Cat move Forward this.Cat getDistanceTo this.tree - 2.0


this.Cat move Forward this.Cat getDistanceTo this.tree / 2.0
this.Cat move Forward this.Cat getDistanceTo this.tree * 2.0 (*)
this.Cat move forward this.Cat getDistanceTo this.tree + 2.0
Correct

Section 3
(Answer all questions in this section)
23. From your Greenfoot lessons, which of the following is an example
of a type of data passed through a parameter?

Mark for
Review
(1) Points

Methods
Classes
Integers (*)
Scenarios

Correct
24. From the Greenfoot IDE, where are inherited methods located?

Mark for
Review
(1) Points

In the computer network


In the Greenfoot image gallery
In the Scene editor
In the documentation (*)
Incorrect. Refer to Section 3 Lesson 2.
25. What type of Greenfoot method would be used to turn an object?

Mark for
Review
(1) Points

orientTo( );
turnAround( );
move ( );
turn( ); (*)
Correct
From
26. your
Greenfoo
t lessons,
instances
do not
have any
memory.
True or
false?

Mark for Review


(1) Points

True
False (*)
Correct
27. From your Greenfoot lessons, which type of constructor can be used
to automate creation of Actor instances?

Mark for
Review
(1) Points

Animal

World (*)
Actor
Vector
Correct
28. From your Greenfoot lessons, which of the following comparison
operators represents "greater than"?

Mark for
Review
(1) Points

> (*)
<
==
!=
Correct
29. From your Greenfoot lessons, which axes define an object's position
in a world?

Mark for
Review
(1) Points

(Choose all correct answers)


x (*)
z
y (*)
w
Correct
30. 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.
Correct

Mark for
Review
(1) Points

31. In
Greenfoot
, what is a
common
letter
used for
the loop
variable?

Mark for Review


(1) Points

A
I (*)
X
Y
Correct
32. In Greenfoot, when is a local variable most often used?

Mark for
Review
(1) Points

Within the scenario


Within the act method
Within the world constructor
Within loop constructs (*)
Correct
33. Use your Greenfoot knowledge: An array object holds a single
variable. True or false?

Mark for
Review
(1) Points

True
False (*)
Correct
34. 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 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.


Correct
35. 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.
Correct
36. From your
Greenfoot
lessons,
which of
the
following is
an example
of changing
the
environmen
t 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.
Correct
37. Programming tasks to create a Greenfoot game typically occur in
the following order:
1.Define the problem.
2.Design the solution.
3.Program the solution.
4.Test the solution.
True or false?
True (*)
False

Mark for
Review
(1) Points

Correct
38. 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 class's documentation (*)
By right-clicking on an instance (*)
In the Greenfoot gallery
Correct
39. From your Greenfoot lessons, where do you review a class's
inherited methods?

Mark for
Review
(1) Points

Act method
Documentation (*)
Inspector
If-statement
Correct
40. Using the Greenfoot IDE, which of the following programming
statements tells the object to turn 38 degrees?

Mark for
Review
(1) Points

move():
move(2);
turn(38); (*)
turn(38):
Correct
From
41. your
Greenfoo
t
lessons,
how do
you test

Mark for Review


(1) Points

that your
code
does not
contain
bugs?
Write the code.
Inspect the instances.
Review the documentation.
Compile the code. (*)
Correct
42. In Greenfoot, which of the following are execution controls?

Mark for
Review
(1) Points

(Choose all correct answers)


Run (*)
Act (*)
Speed (*)
Move
Turn
Incorrect. Refer to Section 3 Lesson 1.
43. In Greenfoot, you must first create an instance before you create a
class. True or false?

Mark for
Review
(1) Points

True
False (*)
Correct
44. 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
45. From your Greenfoot lessons, where should the stop method be
inserted into the source code?

Mark for
Review
(1) Points

In the defined method.


In the act method. (*)
In the import statement.
In the class header.
Incorrect. Refer to Section 3 Lesson 8.
46. Use your
Greenfoo
t
knowledg
e 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. (*)
Incorrect. Refer to Section 3 Lesson 8.
47. 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.
48. Greenfoot does not have tools to record sound. True or false?

Mark for
Review
(1) Points

True
False (*)
Correct
49. 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
50. 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 (*)
Incorrect. Refer to Section 3 Lesson 6.

1.
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 (*)
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
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
4.
A conditional loop is a loop that will continue forever. True or false?
for Review

Mark

(1) Points
True
False (*)
5.
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
6.
Define the value of the variable LapCount based on the following math
calculation: LapCount + 10 = 15 Mark for Review
(1) Points
2
4
5 (*)
15

10

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 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} (*)

Correct

Correct

8.

In Alice, we can avoid object collision using what?

Review
(1) Points

Slowing movements down.

Using math operators. (*)

Downloading the Alice 3 collision detector app.

Mark for

Using object detection.

Incorrect

Incorrect. Refer to Section 2 Lesson 9.

9.
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

10.
Review
(1) Points

<

Which of the following is not a relational operator?

Mark for

// (*)

>

Correct

Correct

11.
Which of the following are examples of elements you would test in your Alice
animation? Mark for Review
(1) Points

(Choose all correct answers)

All of the procedures display in alphabetical order in the Procedures tab.

Math expressions calculate as expected. (*)

Objects move with smooth timing. (*)

Event listeners trigger the correct responses. (*)

Incorrect

Incorrect. Refer to Section 2 Lesson 12.

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? Mark for Review
(1) Points

True (*)

False

Correct

Correct

13.
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

A submethod

A subprogram

An instance (*)

A subclass

A variable class

Incorrect

Incorrect. Refer to Section 2 Lesson 14.

14.

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.

15.
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

16.
In Alice, which function is used to move an object directly to the center point
of another object? Mark for Review
(1) Points

getObject

getDuration

getDepth

getDistance (*)

Correct

Correct

17.
In Alice, if a procedure is declared for a clownFish class, which
classes can use the procedure? Mark for Review
(1) Points

The clownFish class and Swimmer class

ClownFish class (*)

The pajamaFish class, clownFish class, and Swimmer class

Any class with "Fish" in the class name

Correct

Correct

18.
From your Alice lessons, which of the following is a tool to show
the logic of an animation? Mark for Review
(1) Points

Visual storyboard

Flowchart (*)

Pie chart

Scene editor

Class chart

Incorrect

Incorrect. Refer to Section 2 Lesson 5.

19.
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 (*)

Incorrect

Incorrect. Refer to Section 2 Lesson 5.

20.
In Alice, each class has a set of pre-defined procedures and
functions. True or false? Mark for Review
(1) Points

True (*)

False

21.
From your Alice lessons, what does the Count control statement do?
for Review
(1) Points

Executes statements a random number of times.

Executes statements simultaneously.

Executes statements a specific number of times. (*)

Mark

Executes statements while a condition is true.

Correct

Correct

22.
From your Alice lessons, complete the following sentence: When
coded, an event triggers a ___________. Mark for Review
(1) Points

Infinite loop

Gallery

Procedure (*)

Scene

Correct

Correct

Section 3
(Answer all questions in this section)

23.
In Greenfoot, you may perform the programming tasks of create
and test many times. True or false?
Mark for Review
(1) Points

True (*)

False

Correct

Correct

24.
From your Greenfoot lessons, which of the following is an
example of changing the environment 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

Incorrect. Refer to Section 3 Lesson 12.

25.
Programming tasks to create a Greenfoot game typically occur
in the following order:

1.Define the problem.


2.Design the solution.
3.Program the solution.
4.Test the solution.

True or false?

Mark for Review

(1) Points

True (*)

False

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.
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

object return type

method return type

Incorrect

Incorrect. Refer to Section 3 Lesson 3.

28.
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

29.
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

addObject (*)

addInstance

Correct

Correct

30.
In Greenfoot, constructors can be used to create new instances
of objects. True or false? Mark for Review
(1) Points

True (*)

False

31.
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

Incorrect. Refer to Section 3 Lesson 8.

32.
In the Greenfoot IDE, which of the following is not a property of
an instance? Mark for Review
(1) Points

Position

Inherited methods

Scenario name (*)

Defined methods

Incorrect

Incorrect. Refer to Section 3 Lesson 2.

33.
From your Greenfoot lessons, which of the following is an
example of a type of data passed through a parameter?
Mark for Review
(1) Points

Methods

Classes

Integers (*)

Scenarios

Correct

Correct

34.
From your Greenfoot lessons, which of the following are
properties of an instance? Mark for Review
(1) Points

Size

Color

Image file

Methods

All of the above (*)

Incorrect

Incorrect. Refer to Section 3 Lesson 2.

35.
From your Greenfoot lessons, instances do not have any
memory. True or false?
Mark for Review
(1) Points

True

False (*)
36.
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

37.
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

Target (*)

Primary

Programmer

Incorrect

Incorrect. Refer to Section 3 Lesson 4.

38.
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

Incorrect

Incorrect. Refer to Section 3 Lesson 1.

39.
From your Greenfoot lessons, an instance inherits all of the
characteristics of the class, and those characteristics cannot be changed. True or
false? Mark for Review

(1) Points

True

False (*)

Correct

Correct

40.
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[2]

keynames["a"]

keynames[0] (*)

keynames["a" key]
41.
In a Greenfoot loop constructor, which component is a counter that controls
how many times the statement is executed? Mark for Review

(1) Points

Local loop

While loop

Loop variable (*)

Condition

Correct

Correct

42.

In Greenfoot, when is a local variable most often used?

for Review
(1) Points

Within the scenario

Within the act method

Within the world constructor

Mark

Within loop constructs (*)

Incorrect

Incorrect. Refer to Section 3 Lesson 10.

43.
From your Greenfoot lessons, when do infinite loops occur?
Mark for Review
(1) Points

When the loop is executed.

Only in while loops.

When the end to the code isn't established. (*)

When the end to the act method isn't established.

Incorrect

Incorrect. Refer to Section 3 Lesson 10.

44.
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

Incorrect

Incorrect. Refer to Section 3 Lesson 5.

45.
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
46.
From your Greenfoot lessons, which programming statement creates a new
Duke object, and places it at x = 120, y = 100 in the world?
Mark for Review
(1) Points

addObject (new Duke( ), 120, 100); (*)

addClass (new Duke( ), 120, 100);

addWorld (new Duke( ), 120, 100);

Move(120,100);

Incorrect

Incorrect. Refer to Section 3 Lesson 5.

47.
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

Incorrect. Refer to Section 3 Lesson 5.

48.
Greenfoot does not have tools to record sound. True or false?
Mark for Review
(1) Points

True

False (*)

Correct

Correct

49.
From your Greenfoot lessons, how do you call a defined method?
Mark for Review
(1) Points

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.

Incorrect

Incorrect. Refer to Section 3 Lesson 6.

50.
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 (*)

Incorrect

Incorrect. Refer to Section 3 Lesson 6.

MIDTERM 1 VAR 2
1. In Alice, we can avoid object collision using what?
Slowing movements down.
Using math operators. (*)
Downloading the Alice3 collision detector app.
Using object detection.
2. From your Alice lessons, which of the following are examples of scenarios?

Conflict and resolution in a play


Process to simulate
Process to demonstrate
Game to play
All of the above (*)
3. In Alice, which of the following is the most likely situation where procedural abstraction
could be used?
Five dogs all need to bark and run at the same time. (*)
One fish needs to swim forward 1 meter.
Two fish say something to each other.
One person moves up 10 meters.
4. In Alice, objects inherit the characteristics of their:
Code
Project
Class (*)
Program
5. In Alice, inheritance means that the superclass inherits its traits from the subclass. True or
false?
True
False (*)
6. In Alice, which function is used to move an object directly to the center point of another
object?
getObject
getDuration
getDepth
getDistance (*)
7. Do In Order and Do Together are the only control statements available in Alice. True or false?
True
False (*)
8. In Alice, once procedures are added to a control statement, they cannot be changed. True or
false?
True
False (*)
9. Which of the following are examples of comments written in an Alice program?
this.dog move forward 2
this.cat turn left 0.5
Boy runs to the girl. (*)
Cat jumps into the tree and meows for help. (*)
10. In the Alice scene editor, where are the procedures located to precisely position an object?
Right click on the object, then select Procedures. (*)
Right click on the object, then select Remove.
In the gallery of classes.
In the package located in the gallery.
11. 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
12. Alice objects move relative to the orientation of the person viewing the animation. True or
false?
True
False (*)

13. The value that a variable holds must be a whole number, not a decimal. True or false?
True
False (*)
14. Define the value of the variable NumSpins based on the following math calculation:
NumSpins / 3 = 8
12
24 (*)
8
NumSpins
15. 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?True
False (*)
6. From your Alice lessons, which control statement executes instructions simultaneously?
Do in order
Count
Variable
Do together (*)
17. In Alice, which of the following instructions roll the Blue Tang fish left 1 meter?
this.blueTang roll Left 1.0 (*)
this.blueTang Left 1.0
this.blueTang Left 1
this.blueTang roll Left 1
18. How do you copy an Alice procedure?
Drag the procedure into the clipboard, then click CTRL + C.
Hold down the control (CTRL) key, then drag the procedure into the clipboard. (*)
Drag the procedure into the clipboard.
Select Copy in the Run menu.
19. Expressions with relational operators produce true and false values. True or false?
True (*)
False
20.
In Alice, where are arithmetic operators available?
Amount argument (*)
Size argument
Duration argument (*)
Get Distance functions (*)
If control
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. The condition in a WHILE loop is a boolean expression. True or false?
True (*)
False
23. What Alice tool can be used to diagram the If conditional execution statement?

Cause and effect diagram


Process flow diagram (*)
Conditional flow diagram
24. The Alice If control structure requires the false statement to be populated. True or false?
True
False (*)
25. A conditional loop is a loop that will continue forever. True or false?
True False
(*)
26.
From your Greenfoot lessons, the reset button resets the scenario back to its initial
position. True or false?
True (*)
False
27. In Greenfoot, a subclass is created by right-clicking on a superclass. True or false?
True (*)
False
28. From the Greenfoot IDE, where are inherited methods located?
In the computer network
In the Greenfoot image gallery
In the scene editor
29. 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.
30. In the Greenfoot IDE, which type of variable allows instances to store information?
Method variable
Instance variable (*)
Class variable
World variable
31. Use your Greenfoot knowldege: Abstraction occurs in many different ways in programming.
True or false?
True (*)
False
32.From your Greenfoot lessons, abstraction techniques can only be used once in a class's source
code. True or false?
True
False (*)
33. From your Greenfoot lessons, what are the ways that you can view a class's methods?

In the scenario
In the class's documentation (*)
By right-clicking on an instance (*)
In the Greenfoot gallery

34. Use your Greenfoot knowledge: A specification of a method is called a


__________________.
Subclass
Class
Signature (*)
Parameter

35. In Greenfoot, dot notation is used to call a _____________ from another class.
Method (*)
Class
Signature
Parameter
36. In Greenfoot, defined methods must be used immediately. True or false?
True
False (*)
37. 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.
38. 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
39. 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
40. From your Greenfoot lessons, which type of constructor can be used to automate creation of
Actor instances?
Animal
World (*)
Actor
Vector
41. From your Greenfoot lessons, when does an if-else statement execute it's second code
segment?
When a random number is less than 10.
When an instance is created.
After the first code segment is executed.
If a condition is false. (*)
If a condition is true.
42. From your Greenfoot lessons, which symbol represents string concatenation?
Symbol &
Symbol <
Symbol =

Symbol + (*)

43. How would the following sentence be written in Greenfoot source code? If Duke's leg is
down, and the keyboard key "d" is down...
if (&&isDown ! Greenfoot.isKeyDown("d") )
if (!isDown && Greenfoot.isKeyDown("d") )
if (isDown && Greenfoot.isKeyDown("d") ) (*)
if (!Greenfoot.isKeyDown && isDown("d") )
44. 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?
True (*)
False
45. In Greenfoot, which method is used to add a new instance to a scenario when the world is
initialized?
addClass
addWorld
addObject (*)
addInstance
46. In Greenfoot, an if-statement is used to alternate between displaying two images in an
instance. True or false?
True
False (*)
47. In Greenfoot, a constructor has a void return type. True or false?
True
False
(*)
48. From your Greenfoot lessons, a problem statement defines the purpose for your game. True
or false?
True (*)
False
49. In Greenfoot, what type of parameter does the keyDown method expect?
String (*)
Boolean
Integer
Method
50. In Greenfoot, which method checks if a key on the keyboard has been pressed?
keyPress method
keyUp method
keyDown method (*)
keyClick method

MIDTERM

1. Examine the following code. What are the variables?

args

n (*)

i (*)

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

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.