Вы находитесь на странице: 1из 57

Complete this sentence: Values are stored in the computer by their _____________

_______.
Mark for Review
Points
Number type
Programming type
Variable type (*)
Value type

Which is an example of the Boolean variable type?


Points

Mark for Review

Hello World
True or False (*)
An object
3.
The initializer of a variable with a TextString value t
ype could be (select all that apply):
Mark for Review
(1) Points
(Choose all correct answers)
"Greetings" (*)
"Howdy" (*)
"4" (*)
None of the above.

Incorrect. Refer to Section 2 Lesson 8.


4.
Define the value of the variable NumBarks based on the
following math calculation: NumBarks * 5 = 25
Mark for Review
(1) Points
6

1
25
5 (*)

Correct
5.

In Alice, an event is considered:

Mark for Review

(1) Points
A party with at least 20 people.
An object's orientation.
Error handling
A keystroke or mouse click. (*)

Correct
6.
In Alice, when coding for keyboard control, the program
mer's job is to consider at least 70% of every key stroke the user could take. T
rue or false?
Mark for Review
(1) Points
True
False (*)

Incorrect. Refer to Section 2 Lesson 8.


7.
What can be used as a guideline to ensure your animatio
n fulfills animation principles?
Mark for Review
(1) Points
The Internet

An animation checklist (*)


A close friend
Other programmers

Correct
8.
The animation checklist helps you confirm that all elem
ents of the animation are operating as expected. True or false? Mark for Review
(1) Points
True (*)
False

Correct
9.
Which of the following elements of the animation should
be tested before the animation is considered complete? Mark for Review
(1) Points
Math calculations operate as expected.
Objects move with smooth timing.
Comments are added to each sequence of instructions.
Control statements are operating as expected.
All of the above. (*)

Correct
10.
The animation should be tested throughout development,
not just at the end of the animation's development. True or false?
Mark fo
r Review
(1) Points
True (*)

False

Correct
Page 1 of 1

Summary

Section 1
(Answer all questions in this section)
ept which one?
(1) Points

1.
The list below describes variables. All are correct exc
Mark for Review

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
2.
Mark for Review
(1) Points
args
n
i

Examine the following code. What are the variables?

t
All of the above are variables. (*)

Correct
3.
The following are examples of what in Java?
boolean
byte
char
short
int
long
float
double Mark for Review
(1) Points
Types (*)
Expressions
Variables
Specifications

Correct
4.
except which one?
(1) Points
boolean
String (*)
long
int
double

The list below displays valid primitive types in Java,


Mark for Review

Incorrect. Refer to Section 2 Lesson 9.


5.
ava, except which one?
(1) Points

The list below displays valid arithmetic operators in J


Mark for Review

+
/
*
%
$ (*)

Correct
6.
Results of arithmetic operations cannot be stored in a
variable. True or false?
Mark for Review
(1) Points
True
False (*)

Correct
7.
Expressions with relational operators produce true and
false values. True or false?
Mark for Review
(1) Points
True (*)
False

Correct

8.

What is the result of the following code?

Mark for Review


(1) Points
x > y : x > y
x < y : x < y
x > y : 1
x < y : 0
x > y : 0
x < y : 1
x > y : true
x < y : false (*)
x > y : false
x < y : true

Correct
9.
If a value has been assigned to (is stored in) a variab
le, that value will be overwritten when another value is assigned to the variabl
e using the assignment "=" operator. True or false?
Mark for Review
(1) Points
True (*)
False

Correct
10.
Mark for Review
(1) Points
j is 5
k is 5 (*)
j is 10
j is 5
k is 5

What is the output produced by the following code?

j is 10
k is 10
j is 15
k is 15

Correct

Test: Correlating Java Methods, Classes, and Other Structures with Alice 3 Tools
: Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indica
tes a correct answer.
Section 1
(Answer all questions in this section)
1.
The list below contains method descriptions. All are cor
rect except which one? Mark for Review
(1) Points
(Choose all correct answers)
A subprogram that acts on data and often returns a value. (*)
A set of code that is referred to by name. (*)
Can be called at any point in a program simply by utilizing its name.
Is associated with an instance variable.

Correct
2.

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. Refer to Section 2 Lesson 10.


3.
You have a Class representing Cat. A cat can meow, purr
, catch mice, and so on. When you create a new cat, what is it called? Mark fo
r Review
(1) Points
A submethod
A subprogram
An instance (*)
A subclass
A variable class

Correct
4.
You want a block of code to be executed only once if ce
rtain conditions are met. What type of Java construct would you use?
Mark fo
r Review
(1) Points
while loop
if (*)
array
boolean

Correct

5.
If you want one message to display if a user is below t
he age of 18 and a different message to display if the user is 18 or older, what
type of construct would you use?
Mark for Review
(1) Points
for all loop
do loop
while loop
if (*)

Correct
6.
If you need to repeat a group of Java statements many t
imes, which Java construct should you use?
Mark for Review
(1) Points
(Choose all correct answers)
repeat...until
do while loop (*)
while loop (*)
if

Correct
7.

Review the code below.

Select the result from the following statements about what happens when the loop
Val >= 5 .
Mark for Review
(1) Points
The message "Printing Some Text" will be printed until loopVal is no lon
ger 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.

Incorrect. Refer to Section 2 Lesson 10.


8.
Which of the following statements about methods is fals
e?
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 s
tatement 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
9.
e. True or false?
(1) Points

In Java, a function is a method that must return a valu


Mark for Review

True
False (*)

Incorrect. Refer to Section 2 Lesson 10.


10.

What do lines 7, 10 and 13 do in the following code?

Mark for Review


(1) Points
Export files called A, B, and num3.

Create a single file containing A, B, and the value of num3.


Print "A", "B" and the value of num3 on the screen. (*)
None of the above.

Correct
11.
Consider the following: You want to use the BufferedRea
der and InputStreamReader classes to get user input from the command line. Which
one of the following import statements must you use?
Mark for Review
(1) Points
import java.awt.*;
import java.buffer.*;
import java.io.*; (*)
import java.io.input.*;

Correct

Test: Getting Started with Greenfoot: Quiz


Review your answers, feedback, and question scores below. An asterisk (*) indica
tes a correct answer.
Section 1
1.
In Greenfoot, what happens to an instance when the Act
button is clicked in the environment?
Mark for Review
(1) Points
Only one instance moves until the pause button is clicked.
The instance executes all of the programming statements in their class's
act method once. (*)
The instance executes all of the programming statements in their class's
act method repeatedly until the scenario is stopped.
The instance executes all of the programming statements in their class's
act method two times until the scenario is stopped.
The class executes all of the programming statements in their instance's
act method two times until the scenario is stopped.

Correct
2.
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 false?
Mark for Review
(1) Points
True (*)
False

Correct
3.
Mark for Review
(1) Points
True (*)
False

An object is an instance of a class. True or false?

Correct
4.
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
5.
A subclass has what kind of relationship to a superclas
s?
Mark for Review
(1) Points
"for-what"
"a-is"
"is-a" (*)
"is-by"

Correct
6.

What does an instance of the World class do?

r Review
(1) Points
Provide the acting objects for the scenario.
Provide the background scenery for the scenario. (*)
Provide the superclass for acting objects.
Provide the source code for instances.

Mark fo

Correct
7.
In Greenfoot, after a subclass is created, what has to
occur before instances can be added to the scenario?
Mark for Review
(1) Points
Creation of an instance
Compilation (*)
Creation of source code
Editing of source code

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

Test: Using Methods, Variables and Parameters: Quiz


Review your answers, feedback, and question scores below. An asterisk (*) indica
tes a correct answer.
Section 1
(Answer all questions in this section)
1.
In Greenfoot, the move method expects what type of info
rmation in its parameters?
Mark for Review
(1) Points
Degrees to turn
True or false response
String statement
Integer of steps to move forward (*)

Correct
2.
In Greenfoot, the turn method expects what type of info
rmation in its parameters?
Mark for Review
(1) Points
Degrees to turn (*)
True or false response
String statement
Integer of steps to move forward
Parameter void

Correct
3.
Using the Greenfoot IDE, only five instances can be add
ed to a scenario. True or false?
Mark for Review
(1) Points
True
False (*)

Correct

ue or false?
(1) Points

4.
In Greenfoot, the instance has a source code editor. Tr
Mark for Review

True
False (*)

Correct
5.

In the Greenfoot IDE, an instance's position is on the

x and y coordinates. True or false?


(1) Points

Mark for Review

True (*)
False

Correct
6.
In Greenfoot, which of the following options are not po
ssible when associating an image file with an instance? Mark for Review
(1) Points
Add a video (*)
Draw an image
Import an image
Select an image from the Greenfoot library

Correct
7.
An instance variable can be saved and accessed later, e
ven if the instance no longer exists. True or false?
Mark for Review
(1) Points
True
False (*)

Correct
8.
r Review
(1) Points
Instance
Class

A variable is also known as a ____________.

Mark fo

Field (*)
Syntax
Method

Correct
9.
In Greenfoot, the body of the method is located in betw
een which of the following characters? Mark for Review
(1) Points
Parnetheses ( )
Curly brackets { } (*)
Square brackets [ ]
Asterisks **

Correct
10.
In Greenfoot, methods can be called in the act method.
When the Act button is clicked in the environment, the methods in the method bod
y of the act method are executed. True or false?
Mark for Review
(1) Points
True (*)
False

Correct
Page 1 of 1

Summary

False (*)

Correct
Page 1 of 1

Summary

Test: Working with Source Code and Documentation: Quiz


Review your answers, feedback, and question scores below. An asterisk (*) indica
tes a correct answer.
Section 1
(Answer all questions in this section)
1.
The list below provides actions you can perform in the
Greenfoot code editor except one. Which one should be removed? Mark for Review
(1) Points
Write source code to tell the class how to act in the scenario.
Review the class's inherited methods and properties. (*)
Write and edit source code.
Write and edit comments.

Correct
2.

The list below displays components of the Greenfoot sou

rce code editor except one. Which one should be removed?

Mark for Review

(1) Points
Documentation
Comments
Method body
Instance creator (*)
Class description

Correct
3.
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
4.
An if-statement requires which type of information retu
rned from the condition?
Mark for Review
(1) Points
Integer
Action
True or false (*)
Method

Correct

5.
object's orientation?
(1) Points

In Greenfoot, which of the following methods display an


Mark for Review
(Choose all correct answers)

void move()
int getRotation() (*)
int getX() (*)
void turn()

Correct
6.
In Greenfoot, which of the following methods return the
world that the instance lives in?
Mark for Review
(1) Points
World getClass()
World getWorld() (*)
getRotation()
getXY()

Correct
Page 1 of 1

Summary

Test: Developing and Testing an Application: Quiz


Review your answers, feedback, and question scores below. An asterisk (*) indica

tes a correct answer.


Section 1
(Answer all questions in this section)
1.
mming statement?
(1) Points

Which of the following is an incorrectly written progra


Mark for Review

move(): (*)
move(2);
turn(25);
turn(2);

Correct
2.
Which of the following features of Greenfoot will teach
you how to identify bugs in your program?
Mark for Review
(1) Points
Code editor
Compilation (*)
Instance creation
Documentation

Correct
3.
In object oriented programming, programmers analyze a p
roblem and create objects to solve the problem. True or false? Mark for Review
(1) Points
True (*)
False

Correct
4.
Mark for Review
(1) Points

Which of the following statements is most correct?

My program is complete when it compiles.


My program is complete when I add music to it.
My program is complete when it runs and I've tested the code. (*)
My program is complete when I add images to it.

Correct
Page 1 of 1

Summary

Section 1
(Answer all questions in this section)
1.
Which of the following Greenfoot methods returns a rand
om number between 0, up to and including 10,000?
Mark for Review
(1) Points
Greenfoot.getRandomNumber(10,000)
Greenfoot.getRandomNumber(10,001) (*)
Greenfoot.getRandomNumber(9,999)
Greenfoot.getRandomNumber(0-10,000)

Correct
2.
What does the following Greenfoot programming statement
tell the class to do?
if (Greenfoot.getRandomNumber(100) < 6) { turn(18); }
Mark for Review
(1) Points
If a random number is returned that is greater than 6, turn 18 degrees.
If a random number is returned that is less than 6, move 18 steps.
If a random number is returned that is less than 6, turn 18 degrees. (*)
Turn 6 degrees, then turn 18 degrees.

Correct
3.
Which of the following comparison operators represents
"greater than or equal"?
Mark for Review
(1) Points
>
>= (*)
= =
! =

Correct
4.
In Greenfoot you can use comparison operators to compar
e a variable to a random number. True or false? Mark for Review
(1) Points
True (*)
False

Incorrect. Refer to Section 3 Lesson 5.

5.
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 b
oth. True or false?
Mark for Review
(1) Points
True (*)
False

Incorrect. Refer to Section 3 Lesson 5.


6.
Use your Greenfoot experience to answer the question: T
he first step to executing an if-else statement is to:____________.
Mark fo
r Review
(1) Points
Execute the if statement
Execute the else statement
Evaluate the class
Evaluate the condition (*)

Correct
7.
The list below displays characteristics of a Greenfoot
world constructor, except for one. Which one should be removed? Mark for Review
(1) Points
Defines the instance's size and resolution.
Has a void return type. (*)
Has no return type.
Has the same name as the name of the class.
Executed automatically when a new instance of the class is created.

Incorrect. Refer to Section 3 Lesson 5.


8.
Mark for Review
(1) Points

In Greenfoot, which keyword calls the World superclass?

world
constructor
super (*)
addObject
new

Correct
9.
In Greenfoot, which of the following is the correct not
ation for calling a method for an instance of a class? Mark for Review
(1) Points
object-name.method-name(parameters); (*)
class-name.method-name(parameters);
Method-name.object-name(parameters);
Method-name.object-name;

Correct
10.
In Greenfoot, a semicolon is not necessary at the end o
f a method that uses dot notation. True or false?
Mark for Review
(1) Points
True
False (*)

Correct
11.
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
12.
Which keyword indicates that Greenfoot needs to create
Mark for Review

a new object?
(1) Points
new (*)

addObject
newObject
newClass

Correct
Test: Defining Methods: Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indica
tes a correct answer.
Section 1
(Answer all questions in this section)
1.
In the Greenfoot IDE, any new methods you create are wr
itten in the class's source code, below the act method. True or false? Mark fo
r Review

True (*)
False

Correct
2.
In reference to Greenfoot, if t
he following method was defined in a superclass,
public void lookForEdge(){
...
}
all subclasses of the superclass will inherit the method.
True or false? Mark for Review

True (*)
False

Correct

Test: Using Sound and Keyboard Control: Quiz


Review your answers, feedback, and question scores below. An asterisk (*) indica
tes a correct answer.
Section 1
(Answer all questions in this section)
1.
In Greenfoot, the sound file must be saved in the scena
rio and written in the source code for it to play. True or false?
Mark fo
r Review
(1) Points
True (*)
False

Correct
2.
You cannot record unique sounds in Greenfoot. You can o
nly use the sounds that are stored in the Greenfoot library. True or false?
Mark for Review
(1) Points
True
False (*)

Correct
3.
Mark for Review
(1) Points

What type of parameter does the keyDown method expect?

The password that will protect the class.


The name of the key to press on the keyboard. (*)
The name of the class that will use the key.
The name of the sound file to play when the key is pressed.

Correct
Page 1 of 1

Summary

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


Review your answers, feedback, and question scores below. An asterisk (*) indica
tes a correct answer.
Section 1
(Answer all questions in this section)
1.
In Greenfoot, which method body correctly adds an instan
ce of the World to a scenario, with size x = 300 y = 300 and a resolution of 2 p
ixels per cell? Mark for Review

(1) Points
world(300, 300, 2);
Super(300,300,2);
super(2,300,300);
super(300,300,2); (*)

Correct
2.
A constructor is executed once in the course of a Green
foot scenario. True or false?
Mark for Review
(1) Points
True
False (*)

Correct
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
?
Mark for Review
(1) Points
addObject(new( ), 140, 130);
addObject(new Duke( ), 140, 130); (*)
new(addObject(Duke ), 140, 130);
new(Duke( ) 140, 130);

Correct
4.
Which keyword is used to add an actor to a Greenfoot wo
rld?
Mark for Review
(1) Points

addObject
add
new (*)
super

Correct
5.
Which of the following is the correct syntax for declar
ing a variable in Greenfoot?
Mark for Review
(1) Points
(Choose all correct answers)
public variable-type variable-name; (*)
private variable-name, variable-type;
public variable-name variable type;
private variable-type variable-name; (*)

Correct
6.
Mark for Review
(1) Points

In Greenfoot, what is the purpose of the variable type?

Defines the access specifier used with the variable.


Defines what kind of data to store in the variable. (*)
Defines which class the variable is associated with.
Defines the instance that the variable is associated with.

Correct

7.
Mark for Review
(1) Points

Which operator is used to test if values are equal?

<
== (*)
>
!>

Correct
8.
In Greenfoot, the == operator is used to test if two va
lues are equal. True or false? Mark for Review
(1) Points
True (*)
False

Correct
9.
The GreenfootImage class enables Greenfoot actors to ma
intain their visible image by holding an object of type GreenfootImage. True or
false? Mark for Review
(1) Points
True (*)
False

Correct
10.

What does the following programming statement mean?

image1 = new GreenfootImage("duke12.png?);


(1) Points

Mark for Review

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

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

Correct
11.
Mark for Review
(1) Points

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

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

Correct
12.
Where can we review the available classes and methods i
n Greenfoot, including the stop method? Mark for Review
(1) Points
Class menu
Object menu
Class Application Programmers' Interface (API)
Greenfoot Application Programmers' Interface (API) (*)

Correct
Page 1 of 1

Summary

Test: Understanding Abstraction: Quiz


Review your answers, feedback, and question scores below. An asterisk (*) indica
tes a correct answer.
Section 1
(Answer all questions in this section)
1.
From your Greenfoot lessons, which of the following are
examples of when abstraction techniques are used?
Mark for Review
(1) Points
Assigning a sound file to an instance.
Assigning a keyboard key to an instance.
Assigning an image file to an instance.
All of the above. (*)

Correct
2.
g. True or false?
(1) Points
True (*)

Abstraction occurs in many different ways in programmin


Mark for Review

False

Correct
Page 1 of 1

Summary

Test: Using Loops, Variables, and Strings: Quiz


Review your answers, feedback, and question scores below. An asterisk (*) indica
tes a correct answer.
Section 1
(Answer all questions in this section)
1.
From your Greenfoot lessons, which of the following are
examples of actions that can be achieved using the while loop? Mark for Review
(1) Points
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. (*)

Correct
2.
Which of the following is not a component of a while lo
op?
Mark for Review
(1) Points

Local variable
Control operator
Loop variable
if statement (*)
while keyword

Correct
3.
If an end to a while loop is not established, what happ
ens?
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. (*)

Incorrect. Refer to Section 3 Lesson 10.


4.
ing. True or false?
(1) Points

Infinite loops are a common cause of errors in programm


Mark for Review

True (*)
False

Correct

or false?
(1) Points

5.
An array is an object that holds multiple methods. True
Mark for Review

True
False (*)

Correct
6.
In Greenfoot, arrays are a way to hold and access multi
ple 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

Correct

ents "not"?
(1) Points

7.
Which of the following Greenfoot logic operators repres
Mark for Review

&
&&
=
! (*)

Correct
8.
In the Greenfoot IDE, what does the AND operator (&&) d
o?
Mark for Review
(1) Points
Compares two boolean values, and returns a boolean value which is true i
f and only if both of its operands are true. (*)
Compares two boolean values, and returns a boolean value which is true i

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

Correct
9.
In Greenfoot, a local variable is declared at the begin
ning of a class. True or false? Mark for Review
(1) Points
True
False (*)

Correct
10.
a local variable?
(1) Points

In Greenfoot, what types of values cannot be stored in


Mark for Review

Class name
Objects
Integers
World name
Method (*)

Correct
11.
In Greenfoot, string concatenation reduces the number o
f redundant characters or phrases you need to type into each array. True or fals
e?
Mark for Review
(1) Points

True (*)
False

Correct
12.
Which of the following is an example of string concaten
ation? Mark for Review
(1) Points
Instead of entering ".png" after each image file name, add && ".png" aft
er the imageName value in the programming statement.
Instead of entering ".png" after each image file name, add = ".png" afte
r the imageName value in the programming statement.
Instead of entering ".png" after each image file name, add + ".png" afte
r 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
Page 1 of 1

Summary

Test: Creating an Inventory of Java Fundamentals: Quiz


Review your answers, feedback, and question scores below. An asterisk (*) indica

tes a correct answer.


Section 1
(Answer all questions in this section)
1.
From your Greenfoot lessons, the __________ control str
ucture is used to compare and make a decision. Mark for Review
(1) Points
Conditional (*)
Repetition
Obsolete
Rewind

Correct
2.
From your Greenfoot lessons, the __________ control str
ucture 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();
Mark for Review
(1) Points
Method
Comment
Variable Assignment (*)
Instruction

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

Correct
7.
In which step to create a Greenfoot game do you find an
d resolve errors in the game?
Mark for Review
(1) Points
Define the problem
Design the solution
Program the solution
Test the solution (*)

Correct

n implemented?
(1) Points

8.
In which step to create a Greenfoot game is the solutio
Mark for Review

Define the problem


Design the solution

Program the solution (*)


Test the solution

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

Correct
10.
The variations listed below are examples of changing wh
at part of Q/A testing?
Input numbers when characters are expected
Input characters when numbers are expected
Input symbols
Mark for Review
(1) Points
Change the environment
Change the execution
Change the data (*)
None of the above

Correct
Page 1 of 1
\

Summary

Test: Compiling with Eclipse: Quiz


Review your answers, feedback, and question scores below. An asterisk (*) indica
tes a correct answer.
Section 1
(Answer all questions in this section)
1.
When Eclipse launches, the Welcome page displays. Once
this page is closed you cannot return to the resources available on this page. T
rue or False?
Mark for Review
(1) Points
True
False (*)

Incorrect. Refer to Section 4 Lesson 1.


2.
Eclipse provides an edit area to help you navigate a hi
erarchy of information. True or False? Mark for Review
(1) Points
True
False (*)

Incorrect. Refer to Section 4 Lesson 1.


3.
Eclipse provides views to help you navigate a hierarchy
of information. True or False? Mark for Review
(1) Points
True (*)
False

Correct
4.
Tabs are used when more than one file is open in the ed
it area. True or False? Mark for Review
(1) Points

True (*)
False

Correct
5.

A perspective is described as: Mark for Review

(1) Points
A combination of views and editors (*)
A combination of views and windows
A combination of editor tabs
None of the above

Correct
6.
The ______________ is the location onto which you will
store and save your files.
Mark for Review
(1) Points
Perspective
Workspace (*)
Editor
None of the above

Correct
7.
A workspace can have one or more stored projects. True
Mark for Review

or false?
(1) Points
True (*)

False

Correct
8.

Identify the components in the image below.

Mark for Review


(1) Points
A-Main Method, B-Class, C-Package
A-Class, B-MainMethod, C-Package
A-Package, B-Main Method, C-Class (*)
None of the above

Correct
9.
In Eclipse, when you run a Java Application, the result
s may be displayed in the Console View. True or False? Mark for Review
(1) Points
True (*)
False

Correct

Test: Using Program Control Statements: Quiz


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

What is a loop?

Mark for Review

(1) Points
A keyword used to skip over the remaining code.
A set of logic that is repeatedly executed until a certain condition is

met. (*)
A segment of code that may only ever be executed once per call of the pr
ogram.
None of the above.

Correct
2.
It is necessary to end all loops at some point in your
Java program. True or false?
Mark for Review
(1) Points
True (*)
False

Incorrect. Refer to Section 5 Lesson 1.


3.
Mark for Review
(1) Points

Which of the following are types of loops in Java?

(Choose all correct answers)


While (*)
If/Else
Do-While (*)
For (*)

Correct
4.
Identify which situation could be an example of a WHILE
loop. Mark for Review
(1) Points
Taking coins out of a pile one at a time and adding their value to the t
otal until there are no more coins in the pile to add.

Attending class while school is not over for the day.


Petting each animal at the pet store one at a time until all the animals
have been petted.
All of the above. (*)

Correct
5.
Which of the following correctly initializes a For loop
that runs through 5 times?
Mark for Review
(1) Points
for(int i = 0; i == 6; i++)
for(int i = 1; i < 6; i++) (*)
for(int i = 0; i < 5; I++)
for(int i = 1; i < 5; I++)

Correct
6.
Mark for Review
(1) Points

What is the function of the word "break" in Java?

It exits the current loop or case statement. (*)


It continues onto the next line of code.
It stops the program from running.
It does not exist in Java.

Incorrect. Refer to Section 5 Lesson 1.


7.
The following code fragment properly implements the swit
ch statement. True or false?

default(input)
switch '+':
answer+=num;
break;
case '-':
answer-=num;
break;
!default
System.out.println("Invalid input");
(1) Points

Mark for Review

True
False (*)

Correct
8.
and a DO-WHILE loop?
(1) Points

What is one significant difference between a WHILE loop


Mark for Review

There is no difference between a DO-WHILE loop and a WHILE loop.


A DO-WHILE loop does not exist in Java and a WHILE loop does.
A DO-WHILE loop includes an int that serves as a counter and a WHILE loo
p does not.
A DO-WHILE loop will always execute the code at least once, even if the
conditional statement for the WHILE is never true. A WHILE loop is only executed
if the conditional statement is true. (*)

Correct
9.
Which of the following correctly initializes an instanc
e of Scanner, called "in", that reads input from the console screen?
Mark fo
r Review
(1) Points
Scanner in = new Scanner(System.in); (*)
Scanner in = new Scanner("System.in");
Scanner in = Scanner(System.in);

System.in in = new Scanner();

Correct
Test: Using Arrays: Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indica
tes a correct answer.
Section 1
(Answer all questions in this section)
1.
Which of the following statements is a valid array decl
Mark for Review

aration?
(1) Points

(Choose all correct answers)


int number();
float average[]; (*)
double[] marks; (*)
counter int[];

Correct
2.
int[] y = new int[5];
(1) Points

The following array declaration is valid:


Mark for Review

True (*)
False

Correct
3.
Which of the following declares a one dimensional array
named "score" of type int that can hold 9 values?
Mark for Review
(1) Points
int score;

int[] score;
int[] score=new int[9]; (*)
int score=new int[9];

Correct
4.
imensional array?
(1) Points

Which of the following declares and initializes a two d


Mark for Review

int[][] array={{1,1,1},{1,1,1},{1,1,1}}; (*)


int[] array={{1,1,1},{1,1,1},{1,1,1}};
int[][] array={1,1,1},{1,1,1},{1,1,1};
int[][] array={1,1,1,1,1,1,1,1,1};

Correct
5.
Which of the following declares and initializes a one di
mensional array named words of size 10 so that all entries can be Strings?
Mark for Review
(1) Points
String words=new String[10];
char words=new char[10];
char[] words=new char[10];
String[] words=new String[10]; (*)

Correct
6.
Mark for Review
(1) Points

What is the output of the following segment of code?

222220
0 (*)
220
2
This code does not compile.

Correct
7.

What is the output of the following segment of code?

Mark for Review


(1) Points
1286864
643432
262423242322
666666 (*)
This code does not compile.

Correct
8.
Which of the following declares and initializes a two d
imensional array named values with 2 rows and 3 columns where each element is a
reference to an Object? Mark for Review
(1) Points
String[][] values={"apples","oranges","pears"};
String[][] values=new String[3][2];
String[][] values=new String[2][3]; (*)

String[][] values;

Correct
9.
Which of the following declares and initializes a two di
mensional array where each element is a reference type? Mark for Review
(1) Points
String words=new String[10];
char[][] words;
char[][] words=new char[10][4];
String[][] words=new String[10][3]; (*)

Incorrect. Refer to Section 6 Lesson 1.


10.
Which of the following statements print every element o
f the one dimensional array prices to the screen?
Mark for Review
(1) Points
for(int i=0; i < prices.length; i++){System.out.println(prices[i]);} (*)
System.out.println(prices.length);
for(int i=1; i <= prices.length; i++){System.out.println(prices[i]);}
for(int i=0; i <= prices.length; i++){System.out.println(prices[i]);}

Correct
11.
Mark for Review
(1) Points
753
6

What is the output of the following segment of code?

7766554433221
7531 (*)
This code does not compile.

Correct
12.
The following creates a reference in memory named y that
can refer to five different integers via an index. True or false?
int[] y = new int[5];
(1) Points

Mark for Review

True (*)
False

Correct
13.
The following creates a reference in memory named z that
can refer to seven different doubles via an index. True or false?
double z[] = new double[7];
(1) Points

Mark for Review

True (*)
False

Correct
14.
What is the output of the following segment of code if t
he command line arguments are "apples oranges pears"?
Mark for Review
(1) Points
apples
pears (*)

oranges
args
This code doesn't compile.

Correct
15.
What is the output of the following segment of code if t
he command line arguments are "apples oranges pears"?
Mark for Review
(1) Points
0
1
2
3 (*)
This code does not compile.

Correct
16.
What will be the content of array variable table after e
xecuting the following code?
Mark for Review
(1) Points
0 0 0
0 0 0
0 0 0
1 0 0
0 1 0
0 0 1 (*)
1 0 0
1 1 0

1 1 1
0 0 1
0 1 0
1 0 0

Correct
17.

What is the output of the following segment of code?

Mark for Review


(1) Points
1286864 (*)
643432
262423242322
666666
This code does not compile.

Correct
18.
e following are true?

After execution of the following statement, which of th

int number[] = new int[5];


(1) Points

Mark for Review

number[0] is undefined
number[4] is null
number[2] is 0 (*)
number.length() is 6

Incorrect. Refer to Section 6 Lesson 1.

19.

The following array declaration is valid. True or false

?
int x[] = int[10];
(1) Points
True
False (*)

Correct
Page 1 of 1

Summary

Mark for Review

Вам также может понравиться