Uploaded by elmer wilfredo tobias

Java Fundamentals Midterm Exam oracle do

advertisement
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.A loop can be infinite (continue forever) or conditional (stops
upon a condition). True or false?
Mark for Review
(1) Points
True (*)
False
Correct
2.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
Number of seconds to execute the programming instruction
Direction to move
Distance to move forward
Person's height (*)
Correct
3.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.
4.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. Refer to Section 2 Lesson 6.
5.In Alice, Do In Order and Do Together:
Are move statements
Are control statements (*)
Are complex statements
None of the above
Mark for Review
(1) Points
Correct
6. Which of the following is not a type of event listener in Alice?
(1) Points
Scene Activation/Time
Mark for Review
Cursor (*)
Keyboard
Mouse
Position/Orientation
Incorrect. Refer to Section 2 Lesson 11.
7. 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
8. In Alice, we can avoid object collision using what?
(1) Points
Slowing movements down.
Mark for Review
Using math operators. (*)
Downloading the Alice 3 collision detector app.
Using object detection.
Incorrect. Refer to Section 2 Lesson 9.
9. Alice objects move relative to the orientation of the person viewing the
animation. True or false?
(1) Points
True
False (*)
Mark for Review
Incorrect. Refer to Section 2 Lesson 2.
10. In Alice, declaring a new procedure to shorten code and make it easier to read is
a procedural abstraction technique. True or false?
(1) Points
True (*)
Mark for Review
False
Correct
11. From your Alice lessons, a flowchart could be created in a software program, or
documented in a journal. True or false?
(1) Points
True (*)
Mark for Review
False
Correct
12. In Alice, objects inherit the characteristics of their:
(1) Points
Code
Mark for Review
Project
Class (*)
Program
Incorrect. Refer to Section 2 Lesson 5.
13. A complete Alice instruction includes which of the following components?
Mark for Review
(1) Points
(Choose all correct answers)
Image
Class
Procedure (*)
Direction (*)
Amount (*)
Incorrect. Refer to Section 2 Lesson 4.
14. 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?
Review
(1) Points
True (*)
Mark for
False
Correct
15. From your Alice lessons, animations should be tested by the programmer before
they are considered complete. True or false?
(1) Points
True (*)
Mark for Review
False
Correct
16. Java programs can be simple programs that run from the command line, or they can have
complex graphical user interfaces. True or false?
(1) Points
True (*)
Mark for Review
False
Correct
17. 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)
repeat...until
do while loop (*)
while loop (*)
if
Incorrect. Refer to Section 2 Lesson 14.
18. From your Alice lessons, which programming instruction represents the
following movement: A turtle moves forward half the distance to the flower.
Review
(1) Points
this.Turtle move Forward this.Turtle getDistanceTo this.Flower / 2.0 (*)
this.Turtle move Forward this.Turtle getDistanceTo this.Flower / 0.5
Mark for
this.Turtle move Forward this.Turtle getDistanceTo this.Flower / 1.0
this.Turtle move Forward this.Turtle getDistanceTo this.Flower * 2
Incorrect. Refer to Section 2 Lesson 7.
19. Which of the following is not a relational operator?
(1) Points
<
Mark for Review
// (*)
>
=
Correct
20. In Java, which symbol is used to assign one value to another?
Review
(1) Points
<
Mark for
>
= (*)
//
Correct
21. 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?
(1) Points
(*)
Mark for Review
Correct
22. A variable is a named location inside the computer's memory; once there, the
information can be retrieved and changed. True or false?
(1) Points
True (*)
Mark for Review
False
Correct
Section 3 (Answer all questions in this section)
constructors can be used to create new instances of objects. True or false?
Review
(1) Points
True (*)
False
Incorrect. Refer to Section 3 Lesson 8.
23. In Greenfoot,
Mark for
24. When you re-initialize a scenario, Greenfoot automatically displays an instance
of the World subclass in the scenario. True or false?
(1) Points
True (*)
Mark for Review
False
Correct
25. In Greenfoot, actor constructors can be used to create images or values and
assign them to the variables. True or false?
(1) Points
True (*)
Mark for Review
False
Correct
Section 3 (Answer all questions in this section)
checks if a key on the keyboard has been pressed?
(1) Points
keyPress method
26. In Greenfoot, which method
Mark for Review
keyUp method
keyDown method (*)
keyClick method
Incorrect. Refer to Section 3 Lesson 7.
27. Use your Greenfoot skills to answer the question. What is incorrect in this code?
Mark for Review
(1) Points
Spacing missing
Curly brace missing
Parenthesis missing (*)
Comma missing
Correct
28. In Greenfoot, in which programming task are the objects identified?
for Review
(1) Points
Define the problem.
Mark
Design the solution.
Program the solution. (*)
Test the solution.
Incorrect. Refer to Section 3 Lesson 12.
29. From your Greenfoot lessons, which of the following are examples of Q/A test
variations?
Mark for Review
(1) Points
Change the environment.
Change the execution.
Change the data.
All of the above. (*)
Correct
30. Use your Greenfoot knowldege: Abstraction occurs in many different ways in
programming. True or false?
(1) Points
True (*)
Mark for Review
False
Correct
Section 3 (Answer all questions in this section)
31. In Greenfoot, instances inherit
the characteristics of the subclass they belong to, but not the superclass. True or false?
Mark for Review
(1) Points
True
False (*)
Incorrect. Refer to Section 3 Lesson 2.
32. From your Greenfoot lessons, when a method needs additional data to perform a
task, this data comes from parameters. True or false?
(1) Points
True (*)
Mark for Review
False
Correct
33. 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.
34. From your Greenfoot lessons, to view the methods that a class inherits, open the
code editor and select documentation from the Tools menu. True or false?
Review
(1) Points
True (*)
Mark for
False
Correct
35. From your Greenfoot lessons, a comparison operator returns what value when a
number meets its requirement?
(1) Points
0
VOID
1 (*)
NULL
Mark for Review
Incorrect. Refer to Section 3 Lesson 5.
36. Read the following method signature. Using your Greenfoot experience, what does this
method do?
public static int getRandomNumber (int limit)
(1) Points
Returns a random number less than 10.
Mark for Review
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.
Incorrect. Refer to Section 3 Lesson 5.
37. 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?
(1) Points
True
Mark for Review
False (*)
Incorrect. Refer to Section 3 Lesson 5.
38. From your Greenfoot lessons, what can methods belong to?
Review
(1) Points
Galleries
Mark for
(Choose all correct answers)
Classes (*)
Scenarios
Objects (*)
All of the above
Incorrect. Refer to Section 3 Lesson 5.
39. How would the following sentence be written in Greenfoot source code? If
Duke's leg is down, and the keyboard key "d" is down...
(1) Points
if (&&isDown ! Greenfoot.isKeyDown("d") )
if (!isDown && Greenfoot.isKeyDown("d") )
Mark for Review
if (isDown && Greenfoot.isKeyDown("d") ) (*)
if (!Greenfoot.isKeyDown && isDown("d") )
Incorrect. Refer to Section 3 Lesson 10.
40. Use your Greenfoot knowledge: An array object holds a single variable. True or
false?
Mark for Review
(1) Points
True
False (*)
Correct
41. From your Greenfoot lessons, which of the following logic operators represents "and"?
Mark for Review
(1) Points
&
&& (*)
=
!
Incorrect. Refer to Section 3 Lesson 10.
42. 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
Incorrect. Refer to Section 3 Lesson 10.
43. From your Greenfoot lessons, an instance inherits all of the characteristics of the
class, and those characteristics cannot be changed. True or false?
(1) Points
True
Mark for Review
False (*)
Incorrect. Refer to Section 3 Lesson 1.
44. From your Greenfoot lessons, to create a new instance of the Duke class, you
right-click on the class, then select which of the following commands in the class menu?
Mark for Review
(1) Points
New subclass...
Set image...
new Duke() (*)
Inspect
Remove
Correct
45. From your Greenfoot lessons, in an if-statement, the programming statements
written in curly brackets are executed simultaneously. True or false?
(1) Points
True
Mark for Review
False (*)
Correct
46. From your Greenfoot lessons, if the condition in an if-statement is true, the first code
segment is executed. True or false?
(1) Points
True (*)
Mark for Review
False
Incorrect. Refer to Section 3 Lesson 3.
47. From your Greenfoot lessons, how do you test that your code does not contain
bugs?
Mark for Review
(1) Points
Write the code.
Inspect the instances.
Review the documentation.
Compile the code. (*)
Correct
48. When designing a game in Greenfoot, it helps to define the actions that will take
place in a textual storyboard. True or false?
(1) Points
Mark for Review
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?
(1) Points
True (*)
Mark for Review
False
Incorrect. Refer to Section 3 Lesson 6.
50. From your Greenfoot lessons, to save space in the act method, you can write an
entirely new method below it, called a _____________.
(1) Points
Class method
Instance method
Defined method (*)
World method
Code method
Incorrect. Refer to Section 3 Lesson 6.
Mark for Review
Download