test java fundamentals midterm exam
DESCRIPTION
Test JAVA Fundamentals Midterm ExamTRANSCRIPT
Test: Java Fundamentals Midterm Exam
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Top of FormSection 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.
4. 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 (*)
Incorrect. Refer to Section 2 Lesson 7.
5. 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 after the block is executed. (*)
The condition loopVal < 5 returns a boolean value.
None of the above.
Correct
Bottom of Form
6. 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
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
11. 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. 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
Top of FormSection 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
Bottom of Form21. Examine the following code. What are the variables?
Mark for Review(1) Points
(Choose all correct answers)
args
n (*)
i (*)
t
Incorrect. Refer to Section 2 Lesson 13.
22. Which of the following is not a valid arithmetic operator in Java? Mark for Review(1) Points
+
/
-
*
%
None of the above (*)
Correct
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
Correct
24. In Greenfoot, what happens if the condition is false in an if-statement? Mark for Review(1) Points
The programming statements are executed.
The if-statement is executed.
The act method is deleted.
The programming statements are not executed. (*)
Correct
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 (*)
Incorrect. Refer to Section 3 Lesson 6
26. 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.
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?
void turnLeft() Mark for Review(1) Points
()
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? Mark for Review(1) Points
True (*)
False
Correct
38. 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
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 10.
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)
46. 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]
Correct
47. From your Greenfoot lessons, which line of code is missing something?
Mark for Review(1) Points
1
3 (*)
4
5
6
Correct
48. In Greenfoot, the image below is an example of what construct?
Mark for Review(1) Points
Method
Comment
Constructor (*)
Class
Incorrect. Refer to Section 3 Lesson 12.
49. 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
50. 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. (*)
Correct