Java Fundamentals Midterm Exam
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)
1In Alice, procedural abstraction is the concept of making code easier to Mark for
. understand and reuse. True or false?
Review
(1) Points
True (*)
False
Correct
2In Alice, if a procedure is declared for a clownFish class, which classes Mark for
. can use the procedure?
Review
(1) Points
Correct
3From your Alice lessons, which of the following is a tool to show the Mark for
. logic of an animation?
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 Mark for
. point of another object?
Review
(1) Points
getObject
getDuration
getDepth
getDistance (*)
5Which of the following statements about what happens when the Mark for
. following code is executed is false?
Review
(1) Points
Correct
7. The Alice IF control structure requires the false statement to Mark for Review
be populated. True or false?
(1) Points
True
False (*)
Correct
(1) Points
Correct
9. In Alice, the setVehicle procedure will associate one object to Mark for Review
another. True or false?
(1) Points
True (*)
False
10. Which of the following actions would require a control Mark for Review
statement to control animation timing?
(1) Points
True
False (*)
Correct
13. Which of the following programming instructions commands the fish Mark for
to continuously move forward a random speed between 0.5 and 1.0
meters, minus 0.25 meters, until it collides with the shark? Review
(1) Points
(*)
Correct
14. From your Alice lessons, what does the Count control statement do? Mark for
Review
(1) Points
Correct
15. From your Alice lessons, when testing your animation, you should Mark for
test that comments were added below each sequence of instructions in
the code. True or false? 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 Mark for Review
you confirm the items on the "Checklist for Animation Completion"?
(1) Points
Correct
17.Debugging and testing is the process of running the animation one Mark for Review
time, and adjusting the control statements, procedures, and
arguments. (1) Points
True
False (*)
18.From your Alice lessons, complete the following sentence: When Mark for Review
coded, an event triggers a ___________.
(1) Points
Infinite loop
Gallery
Procedure (*)
Scene
Correct
19.In Alice, which of the following programming statements moves the Mark for Review
butterfly forward, double the distance to the tree?
(1) Points
Correct
20.In Alice, which of the following programming statements moves the Mark for Review
fish forward, the distance to the rock, minus the depth of the rock?
(1) Points
Correct
2Examine the following code. What are the variables? Mark for Review
1.
(1) Points
args
n (*)
i (*)
t
Incorr
ect.
Refer
to
Sectio
n2
Lesso
n 13.
+
/
-
*
%
None of the above
(*)
Corre
ct
Section 3
(Answer all questions in this section)
True (*)
False
Corre
ct
The programming
statements are
executed.
The if-statement is
executed.
The act method is
deleted.
The programming
statements are not
executed. (*)
Corre
ct
25. Use your Greenfoot Mark for
knowledge to answer
the question. One Review
reason to write a (1) Points
defined method in a
class is to change the
behavior of the class.
True or false?
True
False (*)
Incorr
ect.
Refer
to
Sectio
n3
Lesso
n6
26.From Mark for Review
your
Greenfoot (1) Points
lessons,
how do
you call a
defined
method?
Correct
27. Which of the following type of audience should you ask to Mark for
play your Greenfoot game during the testing phase?
Review
(1) Points
Testing
Target (*)
Primary
Programmer
28. From your Greenfoot lessons, a problem statement defines Mark for
the purpose for your game. True or false?
Review
(1) Points
True (*)
False
Correct
29. Using Greenfoot, how do we change the size and resolution Mark for
of the World instance?
Review
(1) Points
Correct
True
False (*)
Correct
31.Using the Mark for Review
Greenfoot
IDE, when is (1) Points
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.
Correct
32. From your Greenfoot lessons, which of the following is an Mark for
example of a type of data passed through a parameter?
Review
(1) Points
Methods
Classes
Integers (*)
Scenarios
True
False (*)
34. From your Greenfoot lessons, which of the following are Mark for
properties of an instance?
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 Mark for
method name?
Review
void turnLeft() (1) Points
()
void
turnLeft (*)
Left
Correct
36.From your Mark for Review
Greenfoot
lessons, (1) Points
which of the
following is
not a
characteristic
of a static
method?
37. From your Greenfoot lessons, dot notation allows you to Mark for
use a method from a different class, if the class you are
programming does not possess the method. True or false? Review
(1) Points
True (*)
False
Correct
38. When a Greenfoot code segment is executed in an if- Mark for
statement, each line of code is executed in sequential
order. True or false? Review
(1) Points
True (*)
False
Correct
True (*)
False
Correct
40. From your Greenfoot lessons, the keyDown method is Mark for
located in which class?
Review
(1) Points
Actor
Greenfoot (*)
GreenfootImage
World
Correct
41.From Mark for Review
your
Greenfoot (1) Points
lessons,
which of
the
following
is not a
step to
creating a
new
subclass?
Right-click on a superclass.
Click New subclass...
Name the class.
Select an image for the class.
Program the class to move forward. (*)
True (*)
False
Correct
43. How would the following sentence be written in Greenfoot Mark for
source code? If Duke's leg is down, and the keyboard key "d"
is down... Review
(1) Points
if (&&isDown ! Greenfoot.isKeyDown("d") )
if (!isDown && Greenfoot.isKeyDown("d") )
if (isDown && Greenfoot.isKeyDown("d") ) (*)
if (!Greenfoot.isKeyDown && isDown("d") )
Correct
Review
(1) Points
Review
(1) Points
4In the following Greenfoot array, what statement would you write to access Mark for
6.the "a" key?
Review
Keynames = {"a", "b", "c", "d"}; (1) Points
keynames[2]
keynames["a"]
keynames[0] (*)
keynames["a" key]
Correct
4From your Greenfoot lessons, which line of code is missing something? Mark for
7.
Review
(1) Points
1
3 (*)
4
5
6
Correct
4In Greenfoot, the image below is an example of what construct? Mark for
8.
Review
(1) Points
Method
Comment
Constructor (*)
Class
4Use your Greenfoot skills to answer the question. What is incorrect in this Mark for
9.code?
Review
(1) Points
Spacing missing
Curly brace missing
Parenthesis missing (*)
Comma missing
Correct
5From your Greenfoot lessons, which of the following are examples of Mark for
0.abstraction?
Review
(1) Points
Correct