Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Test

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 21
At a glance
Powered by AI
Some key takeaways from the document are that Greenfoot uses object-oriented programming concepts like classes, subclasses, and methods to create interactive simulations. It also utilizes common programming constructs like conditionals, loops, and collision detection.

The main components of a Greenfoot program are the World class, Actor subclasses that inherit from the Actor class, and methods like act() and handle collisions. The World is where instances are placed and the simulation takes place.

Subclasses in Greenfoot allow programmers to create distinct types of objects (like Bee, Flower, etc.) that inherit common properties and behaviors from the Actor class. This promotes code reusability and organization.

Test: Section 3 Quiz 1 - L1-L5

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 3 Quiz 1 - L1-L5


(Answer all questions in this section)

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

True
False (*)

Incorrect. Refer to Section 3 Lesson 4.

2. In Greenfoot, the instance has a source code editor. True or false?


Mark for Review
(1) Points

True
False (*)

Incorrect. Refer to Section 3 Lesson 2.

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

4. Using the Greenfoot IDE, only five instances can be added to a scenario. True or false?
Mark for Review
(1) Points

True
False (*)

Correct

5. 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 (*)
True or false response
Degrees to turn

Correct

Test: Section 3 Quiz 1 - L1-L5

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 3 Quiz 1 - L1-L5


(Answer all questions in this section)

6. In Greenfoot, which of the following are execution controls?


Mark for Review
(1) Points

(Choose all correct answers)

Turn
Speed (*)
Act (*)
Run (*)
Move

Correct

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

8. 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 (*)
Creation of source code
Creation of an instance
Editing of source code

Incorrect. Refer to Section 3 Lesson 1.

9. Which of the following Java syntax is used to correctly create a Bee subclass?
Mark for Review
(1) Points

private class extends Bee


private Bee extends World
public class Bee extends World
public class Bee extends Animal (*)
private class extends Actor

Incorrect. Refer to Section 3 Lesson 1.

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

Test: Section 3 Quiz 1 - L1-L5

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 3 Quiz 1 - L1-L5


(Answer all questions in this section)

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

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

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

Incorrect. Refer to Section 3 Lesson 5.

14. Which of the following comparison symbols represents equals?


Mark for Review
(1) Points

!=
= = (*)
>
<

Correct

15. Which of the following comparison operators represents "greater than or equal"?
Mark for Review
(1) Points

!=
>
==
>= (*)

Correct

Test: Section 3 Quiz 1 - L1-L5

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 3 Quiz 1 - L1-L5


(Answer all questions in this section)

1. Which of the following comparison symbols represents equals?


Mark for Review
(1) Points
!=
= = (*)
>
<

Correct

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

Correct

3. From your Greenfoot lessons, which type of constructor can be used to automate
creation of Actor instances? Mark for Review
(1) Points

Animal
Vector
Actor
World (*)

Correct

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

5. In Greenfoot, a subclass is created by right-clicking on a superclass. True or false?


Mark for Review
(1) Points

True (*)
False

Correct
Test: Section 3 Quiz 1 - L1-L5

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 3 Quiz 1 - L1-L5


(Answer all questions in this section)

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

7. Which of the following demonstrates a Greenfoot subclass/superclass relationship?


Mark for Review
(1) Points

A dog is a subclass of the cat superclass.


A computer is a subclass of a video game superclass.
A rose is a subclass of the flower superclass. (*)
A single person is a superclass of the human subclass.

Correct

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

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


method return type
non-void return type (*)
void return type

Correct
10. From your Greenfoot lessons, which of the following methods return the current
rotation of the object? Mark for Review
(1) Points

World getClass()
getXY()
int getRotation() (*)
World getWorld()

Correct

Test: Section 3 Quiz 1 - L1-L5

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 3 Quiz 1 - L1-L5


(Answer all questions in this section)

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

12. In Greenfoot, the turn method expects what type of information in its parameters?
Mark for Review
(1) Points

String statement
True or false response
Degrees to turn (*)
Integer of steps to move forward
Parameter void

Correct

13. 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. Mark for Review
True or false? (1) Points

True (*)
False

Correct

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

15. A variable is also known as a ____________.


Mark for Review
(1) Points

Field (*)
Instance
Method
Syntax
Class

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

addDefaultManipulation procedure
addListener procedure
addDefaultModelManipulation procedure (*)
addMouseListener procedure

Incorrect. Refer to Section 2 Lesson 12.


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

Incorrect. Refer to Section 2 Lesson 12.

3.A conditional loop is a loop that will continue forever. True or false?
Mark for
Review
(1) Points

True
False (*)

Incorrect. Refer to Section 2 Lesson 8.

4.Review the code below.


Mark for
Review
(1) Points

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.

Correct

5.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 subclass
A variable class
A submethod
A subprogram
An instance (*)

Incorrect. Refer to Section 2 Lesson 14.


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

7. Which is an example of the Boolean variable type?


Mark for Review
(1) Points

Hello World
3
True or False (*)
An object

Correct

8. 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
9. In Java, which symbol is used to assign one value to another?
Mark for Review
(1) Points

= (*)
<
>
//

Correct

10. In Alice, where are arithmetic operators available?


Mark for Review
(1) Points

(Choose all correct answers)

Size argument
Duration argument (*)
Get Distance functions (*)
If control
Amount argument (*)

Incorrect. Refer to Section 2 Lesson 13.

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. An example of an expression is:


Mark for Review
(1) Points

3*3=9 (*)
Move forward 1 meter
If or Where
"I feel happy."

Correct
12. 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}

Incorrect. Refer to Section 2 Lesson 9.

13. Which Alice execution task corresponds with the following storyboard statement?
<br>Cat rolls to the left. Mark for Review
(1) Points

this.Cat roll Left 1.0 (*)


Cat roll Left 1
roll Left 1
Cat roll Right 1

Correct

14. Creating multiple versions of your Alice project saves time. True or false?
Mark for Review
(1) Points

True (*)
False

Correct

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

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 of the following is not a control statement?
Mark for Review
(1) Points

Move (*)
Count
Do In Order
While

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

Incorrect. Refer to Section 2 Lesson 5.

19. In Alice, objects inherit the characteristics of their:


Mark for Review
(1) Points

Code
Program
Class (*)
Project

Correct

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

22. When creating an event based on a keypress which event handler would you use?
Mark for Review
(1) Points

Mouse
Position/Orientation
Scene Activation/Time
Keyboard (*)

Correct

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

24. One type of object property is an object's position in the scene. True or false?
Mark for Review
(1) Points

True (*)
False

Correct

Section 3
(Answer all questions in this section)

25. The Greenfoot method getRandomNumber is used to create predictable behaviour in


your scenario Mark for Review
(1) Points

True
False (*)

Correct

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. From your Greenfoot lessons, which of the following comparison operators represents
"greater than"? Mark for Review
(1) Points

!=
> (*)
<
==

Correct

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

Correct

29. An if-statement requires which type of information returned from the condition?
Mark for Review
(1) Points

Integer
Method
Action
True or false (*)

Correct

30. 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
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 command would you use to detect if a mouse has been clicked on
an actor? Mark for Review
(1) Points

Greenfoot.pressed(this)
Greenfoot.mouseClicked(this) (*)
Actor.clicked(this)
Greenfoot.clicked(this)

Correct
32. In Greenfoot, which class has methods that allow you to get the status of the mouse?
Mark for Review
(1) Points

World
Greenfoot (*)
Scenario
Actor

Incorrect. Refer to Section 3 Lesson 7.

33. In Java what is casting?


Mark for Review
(1) Points

When you remove an object instance.


Casting is not possible in Java.
When you take an Object of one particular type and turn it into another Object
type. (*)
When you reset an object instance.

Correct

34. Using the Greenfoot IDE, only five instances can be added to a scenario. True or false?
Mark for Review
(1) Points

True
False (*)

Correct

35. In Greenfoot, the body of the method is located in between which of the following
characters? Mark for Review
(1) Points

Curly brackets { } (*)


Square brackets [ ]
Asterisks **
Parnetheses ( )

Correct
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, 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 (*)
True or false response
String statement

Correct

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

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

True (*)
False

Correct

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

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

Incorrect. Refer to Section 3 Lesson 8.


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. When a program is tested once and it works then testing is complete.
Mark for Review
(1) Points

True
False (*)

Incorrect. Refer to Section 3 Lesson 4.

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

43. In Greenfoot, which of the following statements could prevent an infinite loop from
occurring? Mark for Review
(1) Points

i = 100 + i
i=i
i=1
i = i + 1 (*)

Incorrect. Refer to Section 3 Lesson 10.

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

Correct

45. An array is an object that holds multiple methods. True or false?


Mark for Review
(1) Points

True
False (*)

Correct
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. 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 stops after 20 executions.
The condition becomes false after one minute of executions.
The code executes and does not stop. (*)

Correct

47. Which one of the following can be used to detect when 2 actors collide?
Mark for Review
(1) Points

isContact()
isCollision()
hasCollided()
isTouching() (*)

Correct
48. A collision in Greenfoot is when two actors make contact?
Mark for Review
(1) Points

True (*)
False

Correct

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

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

True (*)
False

Correct

You might also like