You are on page 1of 10

Section 3 - Quiz 2 L6-L10

(Answer all questions in this section)

1.In Greenfoot a collision is when 2 actors touch? Mark for Review

(1) Points

True (*)
False

Correct

2.Which actor method is used to detect a simple collision? Mark for Review

(1) Points

hasCollided()
hasTouched()
isCollision()
isInContactWith()
isTouching() (*)

Incorrect. Refer to Section 3 Lesson 6.

3.In Greenfoot, a way to have all subclasses of a superclass inherit a Mark for Review
method is by adding the method to the superclass. True or false?
(1) Points

True (*)
False

Correct

4.In Greenfoot, the sound file must be saved in the scenario and Mark for Review
written in the source code for it to play. True or false?
(1) Points

True (*)
False

Correct

5.In Greenfoot when you use the method to retrieve input from the Mark for Review
user, the scenario will continue to run in the background?
(1) Points

True
False (*)

Correct
6.In Mark for Review
Greenfoot,
you can (1) Points
only
interact
with the
scenario
using a
keyboard.

True
False (*)

Incorrect. Refer to Section 3


Lesson 7.

7. In Greenfoot, the == operator is used to test if two values Mark for Review
are equal. True or false?
(1) Points

True (*)
False

Correct

8. The GreenfootImage class enables Greenfoot actors to Mark for Review


maintain their visible image by holding an object of type
GreenfootImage. True or false? (1) Points

True (*)
False

Correct

9. In Greenfoot, which method is used to end a game? Mark for Review

(1) Points

Duke.stop( );
Game.stop(1);
Greenfoot.stop( ); (*)
Class.stop( );

Correct
10. In Greenfoot, you can cast an Actor class to a World Mark for Review
class?
(1) Points

True
False (*)

Incorrect. Refer to Section 3


Lesson 9.
11.From your Mark for Review
Greenfoot
lessons, (1) Points
which one
of the
following
is an
example of
when an
abstraction
technique
is used?

Adding a property to an instance


Initialising a variable
Passing a paramater in a constructor to set an initial
speed. (*)
Adding a property to a Class

Incorrect. Refer to Section 3


Lesson 9.

12. In Greenfoot modifying an actors constructor to accept Mark for Review


an initial speed is a form of abstraction?
(1) Points

True (*)
False

Correct

13. From your Greenfoot lessons, when do infinite loops Mark for Review
occur?
(1) Points

When the end to the code isn't established. (*)


Only in while loops.
When the loop is executed.
When the end to the act method isn't established.

Incorrect. Refer to Section 3


Lesson 10.

14. In Greenfoot, when is a local variable most often used? Mark for Review

(1) Points

Within the world constructor


Within the act method
Within the scenario
Within loop constructs (*)

Incorrect. Refer to Section 3


Lesson 10.

15. In Greenfoot, what type of symbol is used to connect Mark for Review
boolean expressions?
(1) Points

Logic operators (*)


Keyboard key names
Integers
String concatenation

1. Use your Mark for Review


Greenfoo
t
knowledg (1) Points
e to
answer
the
question.
One
reason to
write a
defined
method
in a class
is to
make it
easier to
read.
True or
false?

True (*)

False

Correct
2. Which one of the following can be used to detect when 2 actors Mark for
collide?

Review
(1) Points

isCollision()

isTouching() (*)

hasCollided()

isContact()

Incorrect. Refer to Section 3 Lesson 6.

3. From your Greenfoot lessons, to save space in the act method, Mark for
you can write an entirely new method below it, called a
_____________.
Review
(1) Points

Instance method

Defined method (*)

Class method

World method

Code method

Incorrect. Refer to Section 3 Lesson 6.

4. In Greenfoot you can interact with the scenario using a mouse. Mark for

Review
(1) Points

True (*)

False

Correct

5. You cannot record unique sounds in Greenfoot. You can only use Mark for
the sounds that are stored in the Greenfoot library. True or false?

Review
(1) Points

True

False (*)

Correct
6. In Mark for Review
Greenfoot
, what
type of (1) Points
paramete
r does the
isKeyDow
n method
expect?

String (*)

Boolean

Method

Integer

Correct

7. Which of the following answers have the correct syntax for Mark for
declaring a class variable in Greenfoot?

Review
(1) Points

(Choose all correct answers)

public variable-name variable type;

public variable-type variable-name; (*)

private variable-type variable-name; (*)

private variable-name, variable-type;

Correct

8. In Greenfoot, which method body correctly adds an instance of Mark for


the World to a scenario, with size x = 300 y = 300 and a
resolution of 2 pixels per cell?
Review
(1) Points

world(300, 300, 2);

super(2,300,300);

super(300,300,2); (*)

Super(300,300,2);

Incorrect. Refer to Section 3 Lesson 8.

9. In Greenfoot, a constructor has a void return type. True or false? Mark for

Review
(1) Points

True

False (*)

Incorrect. Refer to Section 3 Lesson 8.


10. From your Greenfoot lessons, which one of the following is an Mark for
example of when an abstraction technique is used?

Review
(1) Points

Adding a property to an instance

Initialising a variable

Adding a property to a Class

Passing a paramater in a constructor to set an initial speed.


(*)

Incorrect. Refer to Section 3 Lesson 9.

11. In Java Mark for Review


what is
casting
? (1) Points

Casting is when we remove an object from the world

Casting is when we want to tell the java compiler that a class


we are accessing is really another type of class (*)
Casting is when we reset the state of an instance.

Casting is when we change the coordinates of an actor

Correct

12. From your Greenfoot lessons, abstraction techniques can only be Mark for
used once in a class's source code. True or false?

Review
(1) Points

True

False (*)

Correct

13. If an end to a while loop is not established, what happens? Mark for

Review
(1) Points

The condition becomes false after one minute of executions.

The code executes and does not stop. (*)

The code stops after 10 executions.

The code stops after 20 executions.

Correct

14. In Greenfoot, what is a common letter used for the loop variable? Mark for
Review
(1) Points

I (*)

Incorrect. Refer to Section 3 Lesson 10.

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

Correct
1. In Mark for Review
Greenfoo
t, a way
to have (1) Points
all
subclasse
s of a
superclas
s inherit
a method
is by
adding
the
method
to the
superclas
s. True or
false?

True (*)

False

Correct

2. Which actor method is used to detect a simple collision? Mark for

Review
(1) Points
hasTouched()

isInContactWith()

isTouching() (*)

isCollision()

hasCollided()

Correct

3. To execute a method in your Greenfoot game, where is it called Mark for


from?

Review
(1) Points

The act method (*)

The gallery

The actor class

The world

Correct

4. In Greenfoot, what type of parameter does the isKeyDown method Mark for
expect?

Review
(1) Points

Boolean

Integer

Method

String (*)

Correct

5. Which method is used to play sound in your Greenfoot game? Mark for

Review
(1) Points

importSound method

playSound method (*)

getSound method

findSound method

Correct
6. From Mark for Review
your
Greenfoo
t lessons, (1) Points
the
isKeyDow
n method
is located
in which
class?

World

Actor

Greenfoot (*)

GreenfootImage

Correct

7. Using the Greenfoot IDE, when is a constructor automatically Mark for


executed?

Review
(1) Points

When a new image is added to the class.

When the act method is executed.

When source code is written.

When a new instance of the class is created. (*)

Correct

8. In Greenfoot, actor constructors can be used to create images or Mark for


values and assign them to the variables. True or false?

Review
(1) Points

True (*)

False

Correct

9. In Greenfoot, constructors can be used to create new instances of Mark for


objects. True or false?

Review
(1) Points

True (*)

False

Correct

You might also like