You are on page 1of 44

Section 2

1. In computing, a textual storyboard is called a


source code: a list of actions to perform a task or solve a problem. True
or false? Mark for Review
(1) Points

True

False (*)

[Incorrect] Incorrect. Refer to Section 2 Lesson 1.

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

3.

Expressions with relational operators produce true and false values. True
or false?

Mark for Review


(1) Points
True (*)
False

[Correct] Correct
4. A typical application uses various values and these
values continuously change while the program is running. True or false?
Mark for Review
(1) Points

True (*)

False

[Correct] Correct

5. In Alice, which of the following are benefits of


separating out motions into their own procedures? Mark for Review
(1) Points

(Choose all correct answers)

It makes the animation easier to run.

It makes the scene easier to view.

It simplifies code and makes it easier to read. (*)

It allows many objects of a class to use the same procedure. (*)

It can allow subclasses of a superclass to use a procedure. (*)

[Correct] Correct
Section 2

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

7. In Alice, when a new procedure is declared, all


subclasses of the superclass will inherit the procedure. True or false?
Mark for Review
(1) Points

True (*)

False

[Correct] Correct

8. From your Alice lessons, variables are fixed and


cannot be changed. True or false? Mark for Review
(1) Points

True

False (*)

[Correct] Correct

9. From your Alice lessons, what can be used as a


guideline to ensure your animation fulfills animation principles? Mark
for Review
(1) Points

The Internet

Animation checklist (*)

A close friend

None of the above

[Correct] Correct
10. From your Alice lessons, number, boolean, String and
object are all examples of variable types. True or false? Mark for
Review
(1) Points

True (*)

False

[Incorrect] Incorrect. Refer to Section 2 Lesson 8.

Section 2

11. Which of the following is not an example of the


logic of an IF control structure? Mark for Review
(1) Points

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.

[Correct] Correct

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

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] Incorrect. Refer to Section 2 Lesson 3.

14. In Alice, which of the following instructions roll


the Blue Tang fish left 1 meter? Mark for Review
(1) Points

this.blueTang roll Left 1.0 (*)

this.blueTang Left 1.0

this.blueTang Left 1

this.blueTang roll Left 1

[Correct] Correct
15. From your Alice lessons, random numbers are set in
the distance and duration arguments in a procedure. True or false? Mark
for Review
(1) Points

True (*)

False

[Correct] Correct

Section 2

16. From your Alice lessons, what is a one-shot


procedural method? Mark for Review
(1) Points

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.

[Correct] Correct

17. From your Alice lessons, an instance's properties


cannot be modified. True or false? Mark for Review
(1) Points

True

False (*)

[Incorrect] Incorrect. Refer to Section 2 Lesson 2.

18. From your Alice lessons, saving multiple versions of


an Alice animation scene is unimportant, because it does not save time. It
actually wastes time. True or false? Mark for Review
(1) Points

True

False (*)

[Correct] Correct

19. What Alice tool can be used to diagram the If


conditional execution statement? Mark for Review
(1) Points

Cause and effect diagram

Process flow diagram (*)

Conditional flow diagram

[Incorrect] Incorrect. Refer to Section 2 Lesson 6.

20. From your Alice lessons, the If control structure


can process one true and one false response. True or false? Mark for
Review
(1) Points

True (*)

False

[Correct] Correct

Section 2

21. The Alice If control structure requires the false


statement to be populated. True or false? Mark for Review
(1) Points

True
False (*)

[Correct] Correct

22. In Alice, which of the following arguments are


available to further refine an object's movements? Mark for Review
(1) Points

(Choose all correct answers)

Object

Distance (*)

Duration (*)

Delay

[Incorrect] Incorrect. Refer to Section 2 Lesson 5.

23. From your Alice lessons, where should comments be


placed? Mark for Review
(1) Points

Above each set of programming statements. (*)

At the end of the program.

In the scene editor.

In their own procedure.

[Correct] Correct

24. In Alice, once procedures are added to a control


statement, they cannot be changed. True or false? Mark for Review
(1) Points
True

False (*)

[Correct] Correct

25. In Alice, functions are dragged into the control


statement, not the procedure. True or false? Mark for Review
(1) Points

True

False (*)

[Correct] Correct

Section 3

26. 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 rose is a subclass of the flower superclass. (*)

A computer is a subclass of a video game superclass.

A single person is a superclass of the human subclass.

[Correct] Correct

27. In Greenfoot, which of the following are execution


controls? Mark for Review
(1) Points

(Choose all correct answers)


Run (*)

Act (*)

Speed (*)

Move

Turn

[Correct] Correct

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

29. 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
[Incorrect] Incorrect. Refer to Section 3 Lesson 5.

30. From your Greenfoot lessons, classes can only use


the methods they have inherited. They cannot use methods from other
classes. True or false? Mark for Review
(1) Points

True

False (*)

[Correct] Correct

Test: Java Fundamentals Mid Term Exam

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

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

32. From your Greenfoot lessons, which line of code is


missing something?

Mark for Review


(1) Points

1
3 (*)

[Correct] Correct

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

34. Greenfoot does not have tools to record sound. True


or false? Mark for Review
(1) Points

True

False (*)

[Correct] Correct

35. In Greenfoot, which method checks if a key on the


keyboard has been pressed? Mark for Review
(1) Points

keyPress method
keyUp method

keyDown method (*)

keyClick method

[Incorrect] Incorrect. Refer to Section 3 Lesson 7.

Section 3

36. In Greenfoot, actor constructors can be used to


create images or values and assign them to the variables. True or false?
Mark for Review
(1) Points

True (*)

False

[Correct] Correct

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

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

[Incorrect] Incorrect. Refer to Section 3 Lesson 8.

39. In Greenfoot, a local variable is declared at the


beginning of a class. True or false? Mark for Review
(1) Points

True

False (*)

[Incorrect] Incorrect. Refer to Section 3 Lesson 10.

40. In Greenfoot, what is a common letter used for the


loop variable? Mark for Review
(1) Points

I (*)

[Correct] Correct

Section 3

41. In Greenfoot, which of the following statements


could prevent an infinite loop from occurring? Mark for Review
(1) Points

I = 100 + i

i=1
i = i

i = i + 1 (*)

[Correct] Correct

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

[Correct] Correct

43. To execute a method in your Greenfoot game, where is


it called from? Mark for Review
(1) Points

The world

The act method (*)

The actor class

The gallery

[Incorrect] Incorrect. Refer to Section 3 Lesson 6.

44. In Greenfoot, defined methods must be used


immediately. True or false? Mark for Review
(1) Points

True
False (*)

[Correct] Correct

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


Section 3

46. What does the following Greenfoot programming


statement do?

turn(18); Mark for Review


(1) Points

Turn the object 36 degrees.

Turn the object 18 degrees. (*)

Turn the object 18 steps forward.

Move the object 18 steps forward.

[Correct] Correct

47. What type of Greenfoot method would be used to turn


an object? Mark for Review
(1) Points
orientTo( );

turnAround( );

move ( );

turn( ); (*)

[Correct] Correct

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

[Incorrect] Incorrect. Refer to Section 3 Lesson 9.

49. Use your Greenfoot knowldege: Abstraction occurs in


many different ways in programming. True or false? Mark for Review
(1) Points

True (*)

False

[Correct] Correct

50. 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] Correct
1. What Alice tool can be used to diagram the If conditional execution
statement?
Cause and effect diagram
Process flow diagram (*)
Conditional flow diagram

2. A conditional loop is a loop that will continue forever. True or


false?
True False (*)

3. From your Alice lessons, the If control structure can process one
true and one false response. True or false
True (*)

4. 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?
True (*) False

5. Identify an example of an Alice expression.


"I feel happy."
If or Where
3x3=9 (*)
None of the above

6. In Alice, Do In Order and Do Together:


Are move statements
Are control statements (*)
Are complex statements
None of the above

7. In Alice, the vehicle property will associate one object to


another. True or false?
True (*) False

8. In Alice, functions are dragged into the control statement, not the
procedure. True or false?
True False (*)

9. Do In Order and Do Together are the only control statements


available in Alice. True or false?
True False (*)

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

Code
Project
Class (*)
Program

11. In Alice, when a new procedure is declared, its motions are coded
in a separate tab. True or false?
True (*) False

12. In Alice, a person object inherits its procedures, functions, and


properties from which of the following classes? (Choose all correct
answers)

Object subclass
Biped class (*)
Quadruped class
Person subclass (*)

13. From your Alice lessons, variables are fixed and cannot be changed.
True or false?
True False (*)

14. Define the value of the variable LapCount based on the following
math calculation: LapCount + 10 = 15
2
4
5 (*)
15
10

15. A variable is a named location inside the computer's memory; once


there, the information can be retrieved and changed. True or false?

True (*) False

16. Which of the following does not describe variables?

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

17. A typical application uses various values and these values


continuously change while the program is running. True or false?

True (*) False

18. Which of the following is a procedure to precisely position an


Alice object?
Move
Turn
Roll
MoveToward
All of the above (*)

19. All objects in Alice have three dimensional coordinates on which


axes? (Choose all correct answers)
x (*)
y (*)
z (*)
w
All of the above
20. 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.

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. Each parameter is listed with its name first, then its data type.
True or false?
True False (*)

23. Which Alice execution task corresponds with the following


storyboard statement?
Cat turns to face mouse.

this.mouse turnToFace this.cat


mouse turnTo cat
this.cat turnToFace this.mouse (*)
cat TurnTo mouse

24. In Alice, which of the following procedures make an object say


something?
talk
speak
say (*)
audible

25. From your Alice lessons, random numbers are set in the distance and
duration arguments in a procedure. True or false?

True (*) False

26. In Greenfoot, what type of parameter does the keyDown method


expect?

String (*)
Boolean
Integer
Method

27. From your Greenfoot lessons, the keyDown method is located in which
class?
Actor
Greenfoot (*)
GreenfootImage
World

28. From your Greenfoot lessons, if the condition in an if-statement is


true, the first code segment is executed. True or false?

True (*) False


29. Use your Greenfoot knowldege: Abstraction occurs in many different
ways in programming. True or false?
True (*) False

30. From your Greenfoot lessons, abstraction techniques can only be


used once in a class's source code. True or false?
True False (*)

31. In Greenfoot, you must first create an instance before you create a
class. True or false?
True False (*)

32. From your Greenfoot lessons, an instance inherits all of the


characteristics of the class, and those characteristics
cannot be changed. True or false?
True False (*)

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

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

True (*) False

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

36. In Greenfoot, which of the following statements could prevent an


infinite loop from occurring?
I = 100 + i
i=1
i = i
i = i + 1 (*)

37. In Greenfoot, which statement is a correct example of string


concatenation?

Duke duke = new Duke(keyNames[i], soundNames[i]);


Duke duke = (keyNames[i], soundNames[i] + ".wav");
Duke duke = new Duke(keyNames[i], soundNames[i] + ".wav"); (*)
Duke duke = (soundNames[i] + ".wav");

38. From your Greenfoot lessons, which of the following logic operators
represents "and"?

&
&& (*)
=
!

39. We can use the Actor constructor to automatically create Actor


instances when the Greenfoot world is initialized. True or false?

True False (*)

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

41. Using the Greenfoot IDE, when is 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.

42. From your Greenfoot lessons, which axes define an object's position
in a world?
(Choose all correct answers)

x (*)
z
y (*)
w

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

44. From your Greenfoot lessons, which of the following comparison


operators represents "greater than"?

> (*)
<
= =
! =

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

True False (*)

46. In the Greenfoot IDE, which of the following is not a property of


an instance?

Position
Inherited methods
Scenario name (*)
Defined methods
47. 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.

48. In the Greenfoot IDE, which of the following are components of a


parameter?
(Choose all correct answers)

Parameter type (*)


Parameter return
Parameter name (*)
Parameter method
Parameter void

49. From your Greenfoot lessons, what is incorrect in this code


example:
setLocation(getX(), (int) (altitude);

Spacing
Capitalization
Parenthesis (*)
Comma

50. In Greenfoot, in which programming task are the objects identified?

Define the problem.


Design the solution.
Program the solution. (*)
Test the solution.

Section 2

1. Which of the following is not a step in the Alice animation


development process? Mark for Review
(1) Points

Sell the animation (*)

Define the scenario

Run the animation

Design a storyboard

Program the animation

Correct

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

3. From your Alice lessons, the If control structure can process one
true and one false response. True or false? Mark for Review
(1) Points

True (*)

False

Correct

4. In Alice, we use the While control statement to implement the


conditional loop. True or false? Mark for Review
(1) Points

True (*)

False

Correct

5. A loop can be infinite (continue forever) or conditional (stops upon


a condition). True or false? Mark for Review
(1) Points

True (*)

False

Section 2

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

7. In Alice, if a procedure is declared for MyClownFish, which classes


can use the procedure? Mark for Review
(1) Points

MyClownFish class and MySwimmer class

MyClownFish class (*)

MyPajamaFish class, MyClownFish class, and MySwimmer class

Any class with "Fish" in the class name

Incorrect. Refer to Section 2 Lesson 4.

8. In Alice, which of the following are benefits of separating out


motions into their own procedures? Mark for Review
(1) Points

(Choose all correct answers)

It makes the animation easier to run.

It makes the scene easier to view.

It simplifies code and makes it easier to read. (*)

It allows many objects of a class to use the same procedure. (*)

It can allow subclasses of a superclass to use a procedure. (*)

Incorrect. Refer to Section 2 Lesson 4.

9. In Alice, which of the following instructions move the Blue Tang fish
forward 2 meters? Mark for Review
(1) Points

this.blueTang move Forward 0.2

this.blueTang move Forward 2

this.blueTang move Backward 2

this.blueTang move Forward 2.0 (*)

Correct

10. From your Alice lessons, the Do In Order control statement is also
referred to by what other name? Mark for Review
(1) Points

Sequence control
Sequential control (*)

Control order

Order control

Incorrect. Refer to Section 2 Lesson 3.

Section 2

11. In Alice, which of the following procedures play a sound? Mark for
Review
(1) Points

playSound

playAudio (*)

playSoundFile

playFile

Incorrect. Refer to Section 2 Lesson 3.

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

True

False (*)

Correct

13. From your Alice lessons, when coding for keyboard control, the
programmer's job is to consider at least 70% of every key stroke the user
could take. True or false? Mark for Review
(1) Points

True

False (*)

Incorrect. Refer to Section 2 Lesson 8.

14. From your Alice lessons, you can run the animation to test that it
works properly. True or false? Mark for Review
(1) Points

True (*)

False
Incorrect. Refer to Section 2 Lesson 8.

15. Expressions with relational operators produce true and false


values. True or false?
Mark for Review
(1) Points
True (*)
False

Correct

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

17. From your Alice lessons, a Do Together statement embedded with two
move statements is an example of what? Mark for Review
(1) Points

Harmony

Compilation

Forward thinking

Nesting (*)

Incorrect. Refer to Section 2 Lesson 5.

18. In Alice, once procedures are added to a control statement, they


cannot be changed. True or false? Mark for Review
(1) Points

True

False (*)

Incorrect. Refer to Section 2 Lesson 5.

19. Do In Order and Do Together are the only control statements


available in Alice. True or false? Mark for Review
(1) Points
True

False (*)

Incorrect. Refer to Section 2 Lesson 5.

20. From your Alice lessons, built-in functions provide precise property
details for the following areas: Mark for Review
(1) Points

Proximity and size

Distance to and nesting

Proximity, size, spatial relation, and point of view (*)

Proximity and point of view

Correct

21. Which of the following is not an example of the logic of an IF control


structure? Mark for Review
(1) Points

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.

Correct

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

Incorrect. Refer to Section 2 Lesson 10.


23. From your Alice lessons, how do you add an instance to a scene in
Alice? Mark for Review
(1) Points

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.

Correct

24. All objects in Alice have three dimensional coordinates on which


axes? Mark for Review
(1) Points

(Choose all correct answers)

x (*)

y (*)

z (*)

All of the above

Incorrect. Refer to Section 2 Lesson 2.

25. From your Alice lessons, what is a one-shot procedural method?


Mark for Review
(1) Points

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.

Correct

Section 3

26. Which of the following Java syntax is used to correctly create a


Duke subclass? Mark for Review
(1) Points

private Dog extends World

public class Dog extends World


public class Duke extends Animal (*)

private class extends Actor

private class extends Duke

Correct

27. In Greenfoot, a subclass is a specialization of a superclass. True


or false? Mark for Review
(1) Points

True (*)

False

Correct

28. From your Greenfoot lessons, source code is written in the code
editor. True or false? Mark for Review
(1) Points

True (*)

False

Correct

29. In Greenfoot, a variable can be saved and accessed later, even if


the instance no longer exists. True or false? Mark for Review
(1) Points

True

False (*)

Correct

30. What does the following Greenfoot programming statement do?

turn(18); Mark for Review


(1) Points

Turn the object 36 degrees.

Turn the object 18 degrees. (*)

Turn the object 18 steps forward.

Move the object 18 steps forward.

Correct
Section 3

31. In the Greenfoot IDE, which of the following are components of a


parameter? Mark for Review
(1) Points

(Choose all correct answers)

Parameter type (*)

Parameter return

Parameter name (*)

Parameter method

Parameter void

Incorrect. Refer to Section 3 Lesson 2.

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

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

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

True
False (*)

Correct

35. What type of parameter does the Greenfoot playSound method expect?
Mark for Review
(1) Points

name of a sound file (as String) (*)

name of an integer (as int)

name of a keyboard key (as String)

name of the class (as String)

Incorrect. Refer to Section 3 Lesson 7.

Section 3

36. From your Greenfoot lessons, which line of code is missing


something?

Mark for Review


(1) Points

3 (*)

Incorrect. Refer to Section 3 Lesson 12.

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

Incorrect. Refer to Section 3 Lesson 12.


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

39. 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. Refer to Section 3 Lesson 5.

40. From your Greenfoot lessons, classes can only use the methods they
have inherited. They cannot use methods from other classes. True or false?
Mark for Review
(1) Points

True

False (*)

Correct

Section 3

41. From your Greenfoot lessons, a problem statement defines the purpose
for your game. True or false? Mark for Review
(1) Points

True (*)

False

Correct

42. Use your Greenfoot knowledge: An array object holds a single


variable. True or false? Mark for Review
(1) Points
True

False (*)

Correct

43. In Greenfoot, a local variable is declared at the beginning of a


class. True or false? Mark for Review
(1) Points

True

False (*)

Incorrect. Refer to Section 3 Lesson 10.

44. From your Greenfoot lessons, which of the following logic operators
represents "and"? Mark for Review
(1) Points

&

&& (*)

Correct

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

Correct

Section 3

46. To execute a method in your Greenfoot game, where is it called from?


Mark for Review
(1) Points

The world

The act method (*)

The actor class


The gallery

Correct

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

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

Incorrect. Refer to Section 3 Lesson 8.

49. Use your Greenfoot knowledge 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. (*)

Correct

50. In Greenfoot, we can 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 (*)

Correct
MIDTERM

1. Examinethefollowing code. What are thevariables?

 args

 n (*)

 i (*)

 t

2. In Java, whichsymbolisusedtoassignonevaluetoanother?

 <

 >

 = (*)

 //

3. Alice usesbuilt-inmathoperators; they are:

 Addandsubtract

 Multiplyand divide

 All of theabove (*)

 None of theabove
4. In Alice, functions are draggedintothe control statement, nottheprocedure. True or false?
True False (*)

5. Fromyour Alice lessons, whereshouldcommentsbeplaced?

 Aboveeach set of programmingstatements. (*)

 At the end of the program.

 In the scene editor.

 In theirownprocedure.

6. An Alice objectcanmove in fourdirections. True or false?

True False (*)

7. Fromyour Alice lessons, comments do notaffectthefunctionality or behavior of objects. True or


false?
True (*) False

8. In Alice, inheritancemeansthatthesuperclassinheritsitstraitsfromthesubclass. True or false?


True False (*)

9. In Alice, declaring a newproceduretoshorten code andmake it easiertoreadis a procedural


abstractiontechnique. True or false

True (*) False

10. In Alice, a personobjectinheritsitsprocedures, functions, andpropertiesfromwhich of


thefollowingclasses
 Objectsubclass

 Biped class (*)

 Quadrupedclass

 Personsubclass (*)

11. A scenariogivesthe Alice animation a purpose. True or false


True (*) False

12. Fromyour Alice lessons, randomnumbers are set in thedistanceanddurationarguments in a


procedure. True or false
True (*) False

13. In Alice, which of thefollowinginstructions turn the Blue Tangfishrightone 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 moveproceduremoves an object in howmanydifferentpossibledirections

 1

 4

 3

 6 (*)

15. A loopcanbe infinite (continue forever) or conditional (stopsupon a condition). True or false?
True (*) False

16. In Alice, weusetheWhile control statementtoimplementtheconditionalloop. True or false?


True (*) False

17. A conditionalloopis a loopthatwill continue forever. True or false?


True False (*)

18. The valuethat a variableholds must be a wholenumber, not a decimal. True or false?
True False (*)

19. Fromyour Alice lessons, whatcanbeused as a


guidelinetoensureyouranimationfulfillsanimationprinciples
 The Internet

 Animationchecklist (*)

 A closefriend

 None of theabove

20. An Alice event isconsideredwhat?

 A party with at least 20 people

 An object'sorientation
 Errorhandling

 A keystroke or mouse click (*)


21. Besidesinvoking a procedure, anotherwaytopreciselyposition an Alice objectistoentervalues in
the x, y, and z coordinates in thePositionproperty. True or false
True (*) False

22. Fromyour Alice lessons, whatis a one-shot procedural method?

 A procedurethatisinvokedwhentheRunbuttonisclicked.

 A procedurethatisusedtomake a scene adjustment. (*)

 A procedurethatisdraggedintothe code editor.

 A procedurethatisusedtolaunchthe program.

23. Fromyour Alice lessons, how do youadd an instanceto a scene in Alice?


 Select theinstancefromyourcomputer'snetwork.

 Write code thatplacestheinstance in the scene.

 Select theclass, then drag theobjectintothe scene. (*)

 CalltheaddObjectmethod.

24. Whenyouwant specific code tobeexecutedonlyifcertainconditions are met, whattype of Java


construct wouldyouuse
 whileloop

 if (*)

 array

 boolean

25. What do lines 7, 10 and 13 do in thefollowing code?


 Export filescalled A, B, and num3.

 Create a single file containing A, B, andthevalue of num3.

 Print "A", "B" andthevalue of num3 on thescreen. (*)

 None of theabove.

26. FromyourGreenfootlessons, abstractiontechniquescanonlybeusedonce in a class'ssource code.


True or false?
True False (*)

27. FromyourGreenfootlessons, which of thefollowing are examples of abstraction?

 Playing a range of soundswhenkeyboardkeys are pressed. (*)

 A single instancedisplays a single image.

 Assigning a differentkeyboardkeytoeachinstance. (*)

 Programming a single movement for a single instance.

 Assigning a differentimage file toeachinstance. (*)

28. In Greenfoot, a constructor has a voidreturntype. True or false


True False (*)

29. FromyourGreenfootlessons, whatistheparameter of thefollowing constructor thatcreates a


newimage, anddesignates it tothe Actor class?

setImage (newGreenfootImage("duke100.png

 setImage

 GreenfootImage
 duke100.png (*)

 new

30. UseyourGreenfootknowledgetoanswerthequestion: Where are definedvariablestypicallyentered


in a class'ssource code
 In thedefinedmethod in thesource code.

 Betweentheconstructorsandmethods in thesource code.

 Aftertheconstructorsandmethods in thesource code.

 At the top of thesource code, beforetheconstructorsandmethods. (*)


31. In Greenfoot, a variablecanbesavedandaccessedlater, eveniftheinstance no longerexists. True or
false ?
True False (*)

32. FromyourGreenfootlessons, when a methodneedsadditional data toperform a task, this data


comesfromparameters. True or false?
True (*) False

33. In theGreenfoot IDE, whichtype of variableallowsinstancestostoreinformation

 Methodvariable

 Instancevariable (*)

 Classvariable

 World variable

34. FromyourGreenfootlessons, how do youcall a definedmethod?


 Callthemethodfromthe act method. (*)

 Callthemethodfromthedefinedmethod.

 Writethemethod in the World superclass.

 Writethemethod in theinstance.

 Writethemethod in thesource code.

35. To execute a method in yourGreenfoot game, whereis it calledfrom?


 The world

 The act method (*)

 The actor class


 The gallery

36. FromyourGreenfootlessons, tosavespace in the act method, youcanwrite an


entirelynewmethodbelow it, called a _____________.
 Classmethod

 Instancemethod

 Definedmethod (*)

 World method

 Code method

37. Whichmethodisusedto play sound in yourGreenfoot game

 getSoundmethod

 findSoundmethod

 playSoundmethod (*)

 importSoundmethod

38. In Greenfoot, whichmethodchecksif a key on thekeyboardhasbeenpressed


 keyPressmethod

 keyUpmethod

 keyDownmethod (*)

 keyClickmethod

39. In theGreenfoot IDE, whatsymbols indicate thatthevariableis an array?


 Square brackets [ ] (*)

 Curlybrackets { }

 Semicolon ;

 Colon :

40. In Greenfoot, which of thefollowingstatementscouldprevent an infinite loopfromoccurring?


 I = 100 + i

 i=1

 i=i

 i = i + 1 (*)
41. In Greenfoot, whathappensifthe end to a whileloopisn'testablished?
 The code willkeepexecutingandwillnever stop. (*)

 The code will execute onceandthen stop, duetocontrols in Greenfoot.

 The code will prompt youtoenter a loopcounter.

 The code willnot execute.

42. In Greenfoot, in whichprogramming task are theobjectsidentified


 Definethe problem.

 Design thesolution.

 Program thesolution. (*)

 Test thesolution.

43. UseyourGreenfootskillstoanswerthequestion. Whatisincorrect in this code?

 Spacingmissing

 Curly brace missing

 Parenthesismissing (*)

 Commamissing

44. FromyourGreenfootlessons, a problem statementdefinesthepurpose for your game. True or false


True (*) False

45. FromyourGreenfootlessons, where do youreview a class'sinheritedmethods

 Act method

 Documentation (*)

 Inspector
 If-statement

46. FromyourGreenfootlessons, theresetbuttonresetsthescenario back toitsinitialposition. True or


false?

True (*) False

47. Which of thefollowing Java syntaxisusedtocorrectly create a Duke subclass

 private Dog extends World

 public class Dog extends World

 public class Duke extends Animal (*)

 private classextends Actor

 private classextends Duke

48. When a Greenfoot code segment isexecuted in an if-statement, each line of code isexecuted in
sequentialorder. True or false? True (*) False

49. In a Greenfootif-elsestatement, iftheconditionistrue, theif-statementisexecuted,


andthentheelse-statementisexecuted. True or false
True False (*)

50. Readthefollowingmethodsignature. UsingyourGreenfootexperience, whatdoesthismethod do?

public static intgetRandomNumber (intlimit)


 Returns a randomnumberlessthan 10.

 Returns a random coordinate position in theworld.

 Returns a randomnumberbetween zero andparameterlimit. (*)

 Returns a randomnumber for instances in the animal classonly.

You might also like