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

Which of the following can be used as a parameter?

(1) Points

Mark for Review

(Choose all correct answers)


Integers (*)
Strings (*)
Constructors
Arrays (*)
Objects (*)

[Correct]

Correct

47.
The following code is a good example of using the this r
eference. True or false?
Mark for Review
(1) Points
True
False (*)

[Correct]

Correct

48.
The basic unit of encapsulation in Java is the primitive
data type. True or false?
Mark for Review
(1) Points
True
False (*)

[Incorrect]

Incorrect. Refer to Section 7 Lesson 1.


49.

Mark for Review

A class can only have one constructor. True or false?

(1) Points
True
False (*)

[Correct]

Correct

50.
Static methods can return any object type. True or false
?
Mark for Review
(1) Points
True (*)
False
If an abstract class does not have implemented constructors or methods,
it should be implemented as an interface instead. True or false?
Mark for
Review
(1) Points
True (*)
False

[Incorrect]

Incorrect. Refer to Section 7 Lesson 5.


42.

What is Polymorphism?

Mark for Review

(1) Points
A way of redefining methods with the same return type and parameters.
A way to create multiple methods with the same name but different parame
ters.
A class that cannot be initiated.
The concept that a variable or reference can hold multiple types of obje
cts. (*)

[Incorrect]

Incorrect. Refer to Section 7 Lesson 5.

43.
Which of the following is the correct way to call an ove
rriden method needOil() of a super class Robot in a subclass SqueakyRobot?
Mark for Review
(1) Points
Robot.needOil(SqueakyRobot);
SqueakyRobot.needOil();
super.needOil(); (*)
needOil(Robot);

[Correct]

Correct

44.
According to the following class declaration, runSpeed c
an be modified in class Cat. True or false?
public class Tiger extends Cat{
public int runSpeed;
}
Mark for Review
(1) Points
True
False (*)

[Incorrect]

Incorrect. Refer to Section 7 Lesson 4.

45.
uctor. True or False?
(1) Points

It is possible to overload a method that is not a constr


Mark for Review

True (*)
False
Which of the following statements add all of the elements of the one dimensional
array prices, and then prints the sum to the screen? Mark for Review
(1) Points
int total = 0;
for(int i = 0; i total+=prices[i];

int total = 0;
for(int i = 0; i total+=prices[i];
System.out.println(total); (*)
int total = 0;
for(int i = 1; i total = total+prices[i];
System.out.println(prices);
int total = 0;
for(int i = 0; i total+=prices[i];
System.out.println(prices);

[Incorrect]

Incorrect. Refer to Section 6 Lesson 1.

37.
What will be the content of the array variable table aft
er executing the following code?
Mark for Review
(1) Points
1 1 1
0 1 1
0 0 1
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

[Incorrect]

Incorrect. Refer to Section 6 Lesson 1.


38.

Mark for Review


(1) Points
n
n^2

Of the options below, what is the fastest run-time?

lg(n) (*)
n*lg(n)

[Correct]

Correct
39.

Why might a sequential search be inefficient?

Mark for

Review
(1) Points
It utilizes the "divide and conquer" method, which makes the algorithm m
ore error prone.
It requires incrementing through the entire array in the worst case, whi
ch is inefficient on large data sets. (*)
It involves looping through the array multiple times before finding the
value, which is inefficient on large data sets.
It is never inefficient.

[Incorrect]

eption?
(1) Points

Incorrect. Refer to Section 6 Lesson 2.


40.
Which of the following could be a reason to throw an exc
Mark for Review

To eliminate exceptions from disrupting your program. (*)


You have a fatal error in your program.
You have encountered a Stack Overflow Error.
To make the user interface harder to navigate.

[Correct]
Correct
Which of the following defines an object class?
(1) Points
Contains a main method and other static methods.

Mark for Review

Contains classes that define objects. (*)


Contains a main method, a package, static methods, and classes that defi
ne objects.
None of the above.

[Incorrect]

Incorrect. Refer to Section 4 Lesson 2.

32.
When converting gallons to liters its best to put the ca
lculation result into a variable with a _______________ data type.
Mark for
Review
(1) Points
int
double (*)
boolean
None of the above

[Correct]

Correct

33.
A _______________ is used to organize Java related files
.
Mark for Review
(1) Points
Project
Workspace
Package (*)
Collection

[Correct]

Correct

Section 5
(Answer all questions in this section)
34.
In an if-else construct the condition to be evaluated mu
st end with a semi-colon. True or false?
Mark for Review
(1) Points
True
False (*)

[Incorrect]

Incorrect. Refer to Section 5 Lesson 1.


35.

What is the output of the following code segment?

int num = 7;
while(num >= 0)
{
num -= 3;
}
System.out.println(num);
(1) Points

Mark for Review

-2 (*)
1
0
2
In Greenfoot, the image below is an example of what construct?
Mark for Review
(1) Points
Method
Conditional (*)
Variable Assignment
Class

[Correct]

Correct

27.
Use your Greenfoot knowledge to answer the question: Whe
re 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]

Correct

Section 4
(Answer all questions in this section)
28.
What will the following code segment output? String s="\
\\\\\\\"; System.out.println(s);
Mark for Review
(1) Points
"\\\\\"
\\\\\\\\
\\
\\\\ (*)

[Correct]

Correct
29.

Mark for Review


(1) Points
True

The following code prints 5 "a"'s to the screen:

False (*)

[Incorrect]

Incorrect. Refer to Section 4 Lesson 4.


30.

Which of the following statements displays 12345?

I. System.out.println( 123 * 100 + 45);


II. System.out.println("123" + 45);
III. System.out.println( 12 + "345"); Mark for Review
(1) Points
All of the above. (*)
I only.
I and II only.
II and III only.
None of the above.

In Greenfoot, a subclass is created by right-clicking on a superclass. T


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

[Correct]

Correct

22.
emory. True or false?
(1) Points

From your Greenfoot lessons, instances do not have any m


Mark for Review

True
False (*)

[Correct]

Correct

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

[Correct]

called from?
(1) Points

Correct
24.
To execute a method in your Greenfoot game, where is it
Mark for Review

The world
The act method (*)
The actor class
The gallery

[Correct]

Correct

25.
rd has been pressed?
(1) Points

In Greenfoot, which method checks if a key on the keyboa


Mark for Review

keyPress method
keyUp method
keyDown method (*)
keyClick method
In Greenfoot, only 10 methods can be written for each class in the Code
editor. True or false? Mark for Review
(1) Points
True

False (*)

[Correct]

Correct

17.
Which of the following type of audience should you ask t
o play your Greenfoot game during the testing phase?
Mark for Review
(1) Points
Testing
Target (*)
Primary
Programmer

[Incorrect]

Incorrect. Refer to Section 3 Lesson 4.

18.
Use you Greenfoot knowledge: What range of numbers does
the following method return?
Greenfoot.getRandomNumber(30)
(1) Points

Mark for Review

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.

[Correct]

Correct

19.
From your Greenfoot lessons, which of the following is n
ot a characteristic of a static method?
Mark for Review
(1) Points
Belongs to a class itself

Belongs to an instance itself (*)


Available for other classes to use with dot notation
Signature contains the word static
Is a method

[Incorrect]

Incorrect. Refer to Section 3 Lesson 5.

20.
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 (*)
11.
A conditional loop is a loop that will continue forever. True or false?
Mark for Review
(1) Points
True
False (*)

[Correct]

Correct

12.
In Alice, the setVehicle procedure will associate one ob
ject to another. True or false?
Mark for Review
(1) Points
True (*)
False

[Incorrect]

Incorrect. Refer to Section 2 Lesson 6.

13.
Which of the following programming instructions commands
the fish to continuously move forward a random speed between 0.5 and 1.0 meters
, minus 0.25 meters, until it collides with the shark?

A(*)
From your Greenfoot lessons, which of the following logic operators repr
esents "and"? Mark for Review
(1) Points
&
&& (*)
=
!

[Correct]

variable?
(1) Points

Correct
15.
In Greenfoot, what is a common letter used for the loop
Mark for Review

A
I (*)
X
Y

[Correct]

Correct

An Alice event is considered what?


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

Mark for Review

[Incorrect]

Incorrect. Refer to Section 2 Lesson 11.

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

8.
If you want one message to display if a user is below th
e 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]

Correct

9.
In Alice, when a new procedure is declared, all subclass
es of the superclass will inherit the procedure. True or false?
Mark for
Review
(1) Points
True (*)
False

[Correct]

Correct

10.
The comments you enter in Alice should describe the sequ
ence of actions that take place in the code segment. True or false?
Mark for
Review
(1) Points
True (*)
False
Examine the following code. What are the variables?
args
n (*)
i (*)
t
In Alice, functions are dragged into the control statement, not the proc
edure. True or false? Mark for Review
(1) Points
True
False (*)

[Correct]

Correct

3.
Which of the following are examples of elements you woul
d test in your Alice animation?
Mark for Review
(1) Points
(Choose all correct answers)
All of the procedures display in alphabetical order in the Procedures ta
b.
Math expressions calculate as expected. (*)
Objects move with smooth timing. (*)
Event listeners trigger the correct responses. (*)

[Incorrect]

Incorrect. Refer to Section 2 Lesson 12.

4.
From your Alice lessons, what is a one-shot procedural m
ethod? 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

5.
From your Alice lessons, what is the purpose of nesting?
Mark for Review
(1) Points
To add more procedures to your program.
To add visual structure to your program. (*)
To add text to your program that tells the viewer what the code does.
To add random movements to your program.

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