You are on page 1of 11

Test: Creating a World, Animating Actors, and Ending a Game: Quiz

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 1
(Answer all questions in this section)

1.
In Greenfoot, which method body correctly adds an instance of the World to a scenario, with size
x = 300 y = 300 and a resolution of 2 pixels per cell?
a. world(300, 300, 2);
b. Super(300,300,2);
c. super(2,300,300);
d. super(300,300,2); (*)
2.

A constructor is executed once in the course of a Greenfoot scenario. True or false?


a. True
b. False (*)

3.
Which of the following Greenfoot programming statements creates a new instance of Duke, and
places him at x = 140, y = 130 in the world
a. addObject(new( ), 140, 130);
b. addObject(new Duke( ), 140, 130); (*)
c. new(addObject(Duke ), 140, 130);
d. new(Duke( ) 140, 130);
4.

Which keyword is used to add an actor to a Greenfoot world?


a. addObject
b. add
c. new (*)
d. super

5.

Which of the following is the correct syntax for declaring a variable in Greenfoot?
(Choose all correct answers)
a. public variable-type variable-name; (*)
b. private variable-name, variable-type;
c. public variable-name variable type;
d. private variable-type variable-name; (*)

6.

In Greenfoot, what is the purpose of the variable type


a. Defines the access specifier used with the variable.
b. Defines what kind of data to store in the variable. (*)
c. Defines which class the variable is associated with.
d. Defines the instance that the variable is associated with.

7.

Which operator is used to test if values are equal


a. <
b. == (*)
c. >
d. !>

8.

In Greenfoot, the == operator is used to test if two values are equal. True or false
a. True (*)
b. False

9.
The GreenfootImage class enables Greenfoot actors to maintain their visible image by holding an
object of type GreenfootImage. True or false
a. True (*)
b. False

10.

What does the following programming statement mean?


image1 = new GreenfootImage("duke12.png );

a.
b.
c.
d.
11.

The variable, image1, cannot use the image file, duke12.png.


The image file, duke12.png, has just been drawn and imported into the scenario.
The image file, duke12.png, is assigned to the variable image1. (*)
Image files from 1-119 are associated with image1.

In Greenfoot, which method is used to end a game?


a. Class.stop( );
b. Greenfoot.stop( ); (*)
c. Duke.stop( );
d. Game.stop(1);

12.

Where can we review the available classes and methods in Greenfoot, including the stop method?
a. Class menu
b. Object menu
c. Class Application Programmers' Interface (API)
d. Greenfoot Application Programmers' Interface (API) (*)

1. From your Greenfoot lessons, which of the following are examples of actions that can be achieved
using the while loop?

Create 50 instances of the Duke


class.
Call the move method 1 million
times.
Call the move and turn methods
10 times.
Create 100 instances of an Actor
subclass.
All of the above. (*)

2. Which of the
following is not a
component of a
while loop?

Mark for
Review
(1) Points

Local variable
Control operator
Loop variable
if statement (*)
while keyword
Incorrec
t. Refer
to
Section
3
Lesson
10.
3. 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.
(*)
Incorrec
t. Refer
to
Section
3
Lesson
10.
4. Infinite loops are a
common cause of
errors in
programming. True
or false?

Mark for
Review
(1) Points

True (*)
False
Correct
5. An array is an object
that holds multiple
methods. True or
false?

Mark for
Review
(1) Points

True
False (*)
Incorrec
t. Refer
to
Section
3
Lesson
10.
6. In Greenfoot, arrays
are a way to hold
and access multiple
variables, and assign
different values to
new instances each
time the while loop
executes and
produces a new
instance. True or
false?

Mark for
Review
(1) Points

True (*)
False
Incorrec
t. Refer
to
Section
3
Lesson
10.
7. Which of the
following Greenfoot
logic operators
represents "not"?

&

Mark for
Review
(1) Points

&&
=
! (*)
Incorrec
t. Refer
to
Section
3
Lesson
10.
8. In the Greenfoot IDE,
what does the AND
operator (&&) do?

Mark for
Review
(1) Points

Compares two
boolean values,
and returns a
boolean value
which is true if
and only if both
of its operands
are true. (*)
Compares two
boolean values,
and returns a
boolean value
which is true if
and only if one
of its operands
are true.
Compares two
boolean values
and returns a
boolean value
which is true if
either one of the
operands is
true.
Compares two
boolean
variables or
expressions and
returns a result
that is true if
either of its
operands are
true.
Incorrec
t. Refer
to
Section
3
Lesson

10.
9. In Greenfoot, a local
variable is declared
at the beginning of a
class. True or false?

Mark for
Review
(1) Points

True
False (*)
Correct
10. In Greenfoot, what
types of values
cannot be stored in a
local variable?

Mark for
Review
(1) Points

Class name
Objects
Integers
World name
Method (*)
Correct
11. In Greenfoot, string
concatenation
reduces the number
of redundant
characters or
phrases you need to
type into each array.
True or false?

Mark for
Review
(1) Points

True (*)
False
Incorrec
t. Refer
to
Section
3
Lesson
10.
12. Which of the
following is an
example of string
concatenation?

Mark for
Review
(1) Points

Instead of
entering ".png"
after each
image file name,
add && ".png"
after the
imageName
value in the
programming
statement.
Instead of
entering ".png"
after each
image file name,
add = ".png"
after the
imageName
value in the
programming
statement.
Instead of
entering ".png"
after each
image file name,
add + ".png"
after the
imageName
value in the
programming
statement. (*)
Instead of
entering ".png"
after each
image file name,
add ".png" after
the imageName
value in the
programming
statement.
1From
. your
Greenfo
ot
lessons
, the
________
__
control
structur
e is
used to
compar
e and
make a
decisio
n.
Conditional (*)

Repetition
Obsolete
Rewind
Incorrect. Refer to Section 3 Lesson 12.
2.
From your Greenfoot lessons, the __________ control structure is often referred
to as loops.

Mark for
Review
(1) Points

Conditional
Repetition (*)
Obsolete
Rewind
Correct
3.
The construct listed below is described as a __________________.
/**
* Get value and store in variable
*/

Mark for
Review
(1) Points

Method
Comment (*)
Variable Assignment
Instruction
Correct
4.
The construct listed below is described as a __________________.
termvar = scanterm.nextLine();

Method
Comment
Variable Assignment (*)
Instruction
Incorrect. Refer to Section 3 Lesson 12.
5.

Mark for
Review
(1) Points

What is wrong with the following line of code?


System.out.println(termvar + '; '+ termdef);

Mark for
Review
(1) Points

There are parenthesis instead of brackets.


There are parenthesis instead of curly braces.
There are single quotes instead of double quotes. (*)
The command is incorrectly capitalized.
Nothing is wrong with the code.
Incorrect. Refer to Section 3 Lesson 12.
6.
Which line of code contains a syntax error?

Mark for
Review
(1) Points

2
3 (*)
4
5
6
Incorrect. Refer to Section 3 Lesson 12.
7.
In which step to create a Greenfoot game do you find and resolve errors in
the game?

Mark for
Review
(1) Points

Define the problem


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

Incorrect. Refer to Section 3 Lesson 12.


8.
In which step to create a Greenfoot game is the solution implemented?

Mark for
Review
(1) Points

Define the problem


Design the solution
Program the solution (*)
Test the solution
Incorrect. Refer to Section 3 Lesson 12.
9.
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 programmer, change the execution


Change the execution, change the data, change the environment (*)
Change the environment, change the execution, change the language
All of the above.
Incorrect. Refer to Section 3 Lesson 12.
10.
The variations listed below are examples of changing what part of Q/A
testing?
Input numbers when characters are expected
Input characters when numbers are expected
Input symbols

Change the environment


Change the execution
Change the data (*)

Mark for
Review
(1) Points

You might also like