0% found this document useful (0 votes)
656 views17 pages

Alice and Greenfoot Programming Quiz

The document contains 20 multiple choice questions about programming concepts in Alice. It tests knowledge of functions like getDistance, control structures like Do In Order and Do Together, procedural abstraction techniques, variables, expressions, and programming statements related to object movement and event handling. It also covers testing animations and using random numbers, variables, and if/else control structures.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
656 views17 pages

Alice and Greenfoot Programming Quiz

The document contains 20 multiple choice questions about programming concepts in Alice. It tests knowledge of functions like getDistance, control structures like Do In Order and Do Together, procedural abstraction techniques, variables, expressions, and programming statements related to object movement and event handling. It also covers testing animations and using random numbers, variables, and if/else control structures.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

(Answer all questions in this section)

1. In Alice, which function is used to move an object directly to the center Mark for
point of another object?

Review
(1) Points

getObject

getDuration

getDepth

getDistance (*)

Correct

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

Incorrect. Refer to Section 2 Lesson 6.

3. In Alice, the procedures' arguments allow the programmer to adjust the Mark for
object, motion, distance amount, and time duration. True or false?

Review
(1) Points

True (*)

False

Correct

4. In Alice, the setVehicle procedure will associate one object to another. Mark for
True or false?

Review
(1) Points

True (*)

False

Correct

5. In Alice, declaring a new procedure to shorten code and make it easier to Mark for
read is a procedural abstraction technique. True or false?
Review
(1) Points

True (*)

False

Correct

(Answer all questions in this section)

6. In Alice, which of the following are benefits of separating out motions Mark for
into their own procedures?

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

7. In Alice, procedural abstraction is the concept of making code easier to Mark for
understand and reuse. True or false?

Review
(1) Points

True (*)

False

Correct

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

Incorrect. Refer to Section 2 Lesson 13.


9. In Java, which symbol is used to assign one value to another? Mark for

Review
(1) Points

<

>

= (*)

//

Correct

10. An Alice event is considered what? Mark for

Review
(1) Points

A party with at least 20 people.

An object's orientation.

Error handling.

A keystroke or mouse click. (*)

Correct

11From Mark for Review


. your
Alice
lessons (1) Points
, which
of the
followi
ng are
reason
s why
rando
m
numbe
rs
would
be
used
by a
compu
ter?

(Choose all correct answers)

For opening a project.

For security. (*)

For simulation. (*)

For creating procedures.


Incorrect. Refer to Section 2 Lesson 4.

12. Identify an example of an Alice expression. Mark for

Review
(1) Points

"I feel happy."

If or Where

3x3=9 (*)

None of the above

Correct

13. In Alice, which of the following programming statements moves the Mark for
butterfly forward, double the distance to the tree?

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

14. Which of the following IF control structures command the blue tang fish Mark for
to roll and simultaneously move down if it collides with a shark, or move
forward if it does not collide with a shark?
Review
(1) Points

(*)
Correct

15. Which of the following is a reason why you might disable programming Mark for
statements in your Alice code?

Review
(1) Points

To help isolate portions of code during testing. (*)

To make an object move forward.

To make an object turn and move simultaneously.

To disable the entire program.

Correct
1All Mark for Review
6. objects
in Alice
have (1) Points
three
dimens
ional
coordi
nates
on
which
axes?
(Choose all correct answers)

x (*)

y (*)

z (*)

All of the above

Correct

17. From your Alice lessons, animations should be tested by the programmer Mark for
before they are considered complete. True or false?

Review
(1) Points

True (*)

False

Incorrect. Refer to Section 2 Lesson 12.

18. Which of the following are examples of elements you would test in your Mark for
Alice animation?

Review
(1) Points

(Choose all correct answers)

All of the procedures display in alphabetical order in the Procedures


tab.
Math expressions calculate as expected. (*)

Objects move with smooth timing. (*)

Event listeners trigger the correct responses. (*)

Incorrect. Refer to Section 2 Lesson 12.

19. Which of the following programming instructions commands the fish to Mark for
continuously move forward a random speed between 0.5 and 1.0 meters,
minus 0.25 meters, until it collides with the shark?
Review
(1) Points
(*)

Incorrect. Refer to Section 2 Lesson 10.

20. A variable is a named location inside the computer's memory; once there, Mark for
the information can be retrieved and changed. True or false?

Review
(1) Points

True (*)

False

Correct

2When Mark for Review


1. you
want
speci (1) Points
fic
code
to be
execu
ted
only
if
certai
n
condi
tions
are
met,
what
type
of
Java
const
ruct
would
you
use?

while loop

if (*)

array

boolean

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.

Correct

Section 3
(Answer all questions in this section)

23. From your Greenfoot lessons, where do you review a class's inherited Mark for
methods?

Review
(1) Points

Act method
Documentation (*)

Inspector

If-statement

Incorrect. Refer to Section 3 Lesson 3.

24. From your Greenfoot lessons, in an if-statement, the programming Mark for
statements written in curly brackets are executed simultaneously. True or
false?
Review
(1) Points

True

False (*)

Correct

25. In Greenfoot, the image below is an example of what construct? Mark for

Review
(1) Points

Method

Comment

Constructor (*)

Class

Correct

26. In Mark for Review


Greenfoo
t, objects
are (1) Points
created
from:

Methods

Classes (*)

Signatures

Parameters

Correct
27. From your Greenfoot lessons, what is incorrect in this code Mark for
example:

setLocation(getX(), (int) (altitude); Review


(1) Points

Spacing

Capitalization

Parenthesis (*)

Comma

Correct

28. Use your Greenfoot knowldege: Abstraction occurs in many Mark for
different ways in programming. True or false?

Review
(1) Points

True (*)

False

Correct

29. In the Greenfoot IDE, which of the following is not a property of an Mark for
instance?

Review
(1) Points

Position

Inherited methods

Scenario name (*)

Defined methods

Correct

30. From your Greenfoot lessons, when a method needs additional Mark for
data to perform a task, this data comes from parameters. True or
false?
Review
(1) Points

True (*)

False

Correct

31. In the Mark for Review


Greenfoot
IDE, which
of the (1) Points
following
are
componen
ts of a
parameter
?

(Choose all correct answers)

Parameter type (*)

Parameter return

Parameter name (*)

Parameter method

Parameter void

Correct

32. In the following Greenfoot method signature, which is the Mark for
method name?

void turnLeft() Review


(1) Points

()

void

turnLeft (*)

Left

Correct

33. From your Greenfoot lessons, the reset button resets the Mark for
scenario back to its initial position. True or false?

Review
(1) Points

True (*)

False

Correct

34. From your Greenfoot lessons, to create a new instance of the Mark for
Duke class, you right-click on the class, then select which of the
following commands in the class menu?
Review
(1) Points

New subclass...

Set image...

new Duke() (*)

Inspect
Remove

Correct

35. Using the Greenfoot IDE, which of the following programming Mark for
statements tells the object to turn 38 degrees?

Review
(1) Points

move():

move(2);

turn(38); (*)

turn(38):

Correct

36. Which of Mark for Review


the
followin
g type (1) Points
of
audienc
e should
you ask
to play
your
Greenfo
ot game
during
the
testing
phase?

Testing

Target (*)

Primary

Programmer

Correct

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


concatenation?

Review
(1) Points

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");
Correct

38. How would the following sentence be written in Greenfoot source Mark for
code? If Duke's leg is down, and the keyboard key "d" is down...

Review
(1) Points

if (&&isDown ! Greenfoot.isKeyDown("d") )

if (!isDown && Greenfoot.isKeyDown("d") )

if (isDown && Greenfoot.isKeyDown("d") ) (*)

if (!Greenfoot.isKeyDown && isDown("d") )

Correct

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

Correct

40. From your Greenfoot lessons, what types of values cannot be Mark for
stored in a local variable?

Review
(1) Points

(Choose all correct answers)

Class name

Objects

Integers

World name

method (*)

Correct

41. In Mark for Review


Greenfoot,
defined
methods (1) Points
must be
used
immediate
ly. True or
false?

True

False (*)

Correct

42. From your Greenfoot lessons, how do you call a defined Mark for
method?

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

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

Review
(1) Points

getSound method

findSound method

playSound method (*)

importSound method

Correct

44. From your Greenfoot lessons, dot notation allows you to use a Mark for
method from a different class, if the class you are programming
does not possess the method. True or false?
Review
(1) Points

True (*)

False

Correct

45. From your Greenfoot lessons, what can methods belong to? Mark for

Review
(1) Points

(Choose all correct answers)


Galleries

Classes (*)

Scenarios

Objects (*)

All of the above

Incorrect. Refer to Section 3 Lesson 5.

46. In a Mark for Review


Greenfoo
t if-else
stateme (1) Points
nt, if the
condition
is true,
the if-
stateme
nt is
executed
, and
then the
else-
stateme
nt is
executed
. True or
false?

True

False (*)

Correct

47. From your Greenfoot lessons, a comparison operator returns what Mark for
value when a number meets its requirement?

Review
(1) Points

VOID

1 (*)

NULL

Correct

48. Using Greenfoot, how do we change the size and resolution of the Mark for
World instance?

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

49. Using the Greenfoot IDE, when is a constructor automatically Mark for
executed?

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

50. In Greenfoot, an if-statement is used to alternate between Mark for


displaying two images in an instance. True or false?

Review
(1) Points

True

False (*)

Correct

You might also like