1. In Greenfoot, constructors can be used to create new instances of objects. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
2. Which Greenfoot control operator is used to test if two values are equal? Mark for Review
(1) Points
!= operator
== operator (*)
>= operator
= operator
[Incorrect] Incorrect. Refer to Section 3 Lesson 8.
3. From your Greenfoot lessons, what is the parameter of the following constructor that creates a new image, and designates it to the Actor class?
setImage (new GreenfootImage("Bee01.png")); Mark for Review
(1) Points
GreenfootImage
setImage
new
Bee01.png (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 8.
4. In Greenfoot, the sound file must be saved in the scenario and written in the source code for it to play. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
5. In Greenfoot, which class has methods that allow you to get the status of the mouse? Mark for Review
(1) Points
Actor
World
Scenario
Greenfoot (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 7.
6. Greenfoot has tools to record sound. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
7. From your Greenfoot lessons, what types of values cannot be stored in a local variable? Mark for Review
(1) Points
(Choose all correct answers)
World name
Objects
Class name
method (*)
Integers
[Incorrect] Incorrect. 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 variables or expressions and returns a result that is true if either 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 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.
[Incorrect] Incorrect. Refer to Section 3 Lesson 10.
9. Which of the following Greenfoot logic operators represents "not"? Mark for Review
(1) Points
=
! (*)
&&
&
[Incorrect] Incorrect. Refer to Section 3 Lesson 10.
10. 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 (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 9.
11. Writing more generic statements to handle the creation and positioning of many objects is one Abstraction technique? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
12. In Java what is casting? Mark for Review
(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
[Incorrect] Incorrect. Refer to Section 3 Lesson 9.
13. Defined methods are methods that are only created by the Greenfoot development team? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 6.
14. In Greenfoot, which of the following statement is true about Defined Methods? Mark for Review
(1) Points
A defined method is automatically executed once created.
A defined method is only relevant to the Greenfoot Development team.
A defined method must be called by your source code, normally in the Act method. (*)
A defined method only relates to the World class.
[Incorrect] Incorrect. Refer to Section 3 Lesson 6.
15. In reference to Greenfoot, if the following method was defined in a superclass,
public void turnAtEdge(){
...
}
all subclasses of the superclass will inherit the method.
True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
1. From your Greenfoot lessons, a problem statement defines the purpose for your game. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
2. From your Greenfoot lessons, what are the ways that you can view a class's methods? Mark for Review
(1) Points
(Choose all correct answers)
In the Greenfoot gallery
In the scenario
In the class's documentation (*)
By right-clicking on an instance (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 3.
3. From your Greenfoot lessons, where do you review a class's inherited methods? Mark for Review
(1) Points
Act method
Documentation (*)
Inspector
If-statement
[Incorrect] Incorrect. Refer to Section 3 Lesson 3.
4. In Greenfoot, which of the following is the correct notation for calling a method for an instance of a class? Mark for Review
(1) Points
Method-name.object-name(parameters);
object-name.method-name(parameters); (*)
Method-name.object-name;
class-name.method-name(parameters);
[Incorrect] Incorrect. Refer to Section 3 Lesson 5.
5. Which of the following comparison symbols represents equals? Mark for Review
(1) Points
<
= = (*)
>
! =
[Incorrect] Incorrect. Refer to Section 3 Lesson 5.
6. Read the following method signature. Using your Greenfoot experience, what does this method do?
public static int getRandomNumber (int limit) Mark for Review
(1) Points
Returns a random number less than 10.
Returns a random coordinate position in the world.
Returns a random number for instances in the animal class only.
Returns a random number between zero and the parameter limit. (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 5.
7. From your Greenfoot lessons, which type of constructor can be used to automate creation of Actor instances? Mark for Review
(1) Points
Animal
Vector
World (*)
Actor
[Incorrect] Incorrect. Refer to Section 3 Lesson 5.
8. In Greenfoot, a subclass is created by right-clicking on a superclass. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
9. Which of the following demonstrates a Greenfoot subclass/superclass relationship? Mark for Review
(1) Points
A computer is a subclass of a video game superclass.
A dog is a subclass of the cat superclass.
A rose is a subclass of the flower superclass. (*)
A single person is a superclass of the human subclass.
[Incorrect] Incorrect. Refer to Section 3 Lesson 1.
10. 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
False (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 1.
11. An object is an instance of a class. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
12. In Greenfoot, the move method expects what type of information in its parameters? Mark for Review
(1) Points
Integer of steps to move forward (*)
True or false response
Degrees to turn
String statement
[Correct] Correct
13. In the Greenfoot IDE, an instance's position is on the x and y coordinates. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
14. A variable is also known as a ____________. Mark for Review
(1) Points
Syntax
Field (*)
Class
Method
Instance
[Incorrect] Incorrect. Refer to Section 3 Lesson 2.
15. In Greenfoot, methods can be called in the act method. When the Act button is clicked in the environment, the methods in the method body of the act method are executed. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
1. In Greenfoot, you can cast an Actor class to a World class? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 9.
2. 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 (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 9.
3. In Greenfoot you can only access the methods of the current class? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 9.
4. Which method is used to play sound in your Greenfoot game? Mark for Review
(1) Points
playSound method (*)
getSound method
importSound method
findSound method
[Correct] Correct
5. From your Greenfoot lessons, the isKeyDown method is located in which class? Mark for Review
(1) Points
Greenfoot (*)
World
GreenfootImage
Actor
[Correct] Correct
6. In Greenfoot, what type of parameter does the isKeyDown method expect? Mark for Review
(1) Points
Boolean
String (*)
Integer
Method
[Incorrect] Incorrect. Refer to Section 3 Lesson 7.
7. From your Greenfoot lessons, to save space in the act method, you can write an entirely new method below it, called a _____________. Mark for Review
(1) Points
Class method
Code method
World method
Instance method
Defined method (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 6.
8. In Greenfoot, a way to have all subclasses of a superclass inherit a method is by adding the method to the superclass. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
9. To execute a method in your Greenfoot game, where is it called from? Mark for Review
(1) Points
The gallery
The actor class
The act method (*)
The world
[Incorrect] Incorrect. Refer to Section 3 Lesson 6.
10. In the Greenfoot IDE, what symbols indicate that the variable is an array? Mark for Review
(1) Points
Colon :
Semicolon ;
Square brackets [ ] (*)
Curly brackets { }
[Incorrect] Incorrect. Refer to Section 3 Lesson 10.
11. Which of the following is not a component of a while loop? Mark for Review
(1) Points
if statement (*)
Loop variable
Local variable
Control operator
while keyword
[Correct] Correct
12. In Greenfoot, what happens if the end to a while loop isn't established? Mark for Review
(1) Points
The code will keep executing and will never stop. (*)
The code will prompt you to enter a loop counter.
The code will execute once and then stop, due to controls in Greenfoot.
The code will not execute.
[Correct] Correct
13. From your Greenfoot lessons, what is the parameter of the following constructor that creates a new image, and designates it to the Actor class?
setImage (new GreenfootImage("Bee01.png")); Mark for Review
(1) Points
Bee01.png (*)
setImage
new
GreenfootImage
[Correct] Correct
14. Which operator is used to test if values are equal? Mark for Review
(1) Points
== (*)
!>
>
<
[Correct] Correct
15. In Greenfoot, we typically use the act method in the class to automatically create the Actor instances when the world is initialized. True or false? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 8.
1. In a Greenfoot if-else statement, if the condition is true, the if-statement is executed, and then the else-statement is executed. True or false? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 5.
2. 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 both. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
3. When a Greenfoot code segment is executed in an if-statement, each line of code is executed in sequential order. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
4. Which of the following comparison symbols represents equals? Mark for Review
(1) Points
= = (*)
>
<
! =
[Correct] Correct
5. 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] Correct
6. 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
False (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 1.
7. In Greenfoot, which of the following are execution controls? Mark for Review
(1) Points
(Choose all correct answers)
Move
Act (*)
Speed (*)
Turn
Run (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 1.
8. Which of the following are examples of default superclasses that are present in a new Greenfoot scenario? Mark for Review
(1) Points
(Choose all correct answers)
Cat
Dog
Parrot
World (*)
Actor (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 1.
9. Which of the following is an incorrectly written programming statement? Mark for Review
(1) Points
turn(25);
move(): (*)
move(2);
turn(2);
[Incorrect] Incorrect. Refer to Section 3 Lesson 4.
10. In Greenfoot, which of the following options are not possible when associating an image file with an instance? Mark for Review
(1) Points
Select an image from the Greenfoot library
Import an image
Add a video (*)
Draw an image
[Incorrect] Incorrect. Refer to Section 3 Lesson 2.
11. An instance variable can be saved and accessed later, even if the instance no longer exists. True or false? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 2.
12. A variable is also known as a ____________. Mark for Review
(1) Points
Syntax
Class
Method
Field (*)
Instance
[Incorrect] Incorrect. Refer to Section 3 Lesson 2.
13. Using the Greenfoot IDE, only five instances can be added to a scenario. True or false? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 2.
14. An if-statement requires which type of information returned from the condition? Mark for Review
(1) Points
True or false (*)
Method
Action
Integer
[Correct] Correct
15. From your Greenfoot lessons, source code is written in the Code editor. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
1. From your Greenfoot lessons, the isKeyDown method is located in which class? Mark for Review
(1) Points
Actor
Greenfoot (*)
GreenfootImage
World
[Incorrect] Incorrect. Refer to Section 3 Lesson 7.
2. In Greenfoot you can interact with the scenario using a mouse. Mark for Review
(1) Points
True (*)
False
[Correct] Correct
3. In Greenfoot, you can only interact with the scenario using a keyboard. Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 7.
4. Which keyword is used to add an actor to a Greenfoot world? Mark for Review
(1) Points
addObject (*)
new
add
super
[Correct] Correct
5. Using the Greenfoot IDE, when is a constructor automatically executed? Mark for Review
(1) Points
When a new instance of the class is created. (*)
When the act method is executed.
When source code is written.
When a new image is added to the class.
[Correct] Correct
6. Using Greenfoot, how do we change the size and resolution of the World instance? Mark for Review
(1) Points
Edit the methods in the class.
Edit the values in the constructor. (*)
Edit the values in the class's act method.
Delete the instance.
[Incorrect] Incorrect. Refer to Section 3 Lesson 8.
7. Use your Greenfoot knowldege: Abstraction occurs in many different ways in programming. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
8. In Java what is casting? Mark for Review
(1) Points
When you take an Object of one particular type and turn it into another Object type. (*)
When you reset an object instance.
When you remove an object instance.
Casting is not possible in Java.
[Correct] Correct
9. 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 (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 9.
10. In Greenfoot, a way to have all subclasses of a superclass inherit a method is by adding the method to the superclass. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
11. In the Greenfoot IDE, any new methods you create are written in the class's source code. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
12. A collision in Greenfoot is when two actors make contact? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
13. How would the following sentence be written in Greenfoot source code? If Bee is turning, and the keyboard key "d" is down... Mark for Review
(1) Points
if (!Greenfoot.isKeyDown && isTurning("d") )
if (isTurning && Greenfoot.isKeyDown("d") ) (*)
if (!isTurning && Greenfoot.isKeyDown("d") )
if (&&isTurning ! Greenfoot.isKeyDown("d") )
[Incorrect] Incorrect. Refer to Section 3 Lesson 10.
14. In Greenfoot, when is a local variable most often used? Mark for Review
(1) Points
Within loop constructs (*)
Within the act method
Within the scenario
Within the world constructor
[Correct] Correct
15. In Greenfoot, what happens if the end to a while loop isn't established? Mark for Review
(1) Points
The code will prompt you to enter a loop counter.
The code will execute once and then stop, due to controls in Greenfoot.
The code will not execute.
The code will keep executing and will never stop. (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 10.
1. In Alice, how is a one-shot procedure different from procedures in the Code editor? Mark for Review
(1) Points
One-shot procedures are only available for acting objects, while procedures are available for all objects.
One-shot procedures are available in the Code editor, while procedures are available in the Scene editor.
A one-shot procedure executes only one time to re-position the object, while procedures in the Code editor execute every time the Run button is clicked. (*)
All of the above
[Incorrect] Incorrect. Refer to Section 2 Lesson 2.
2. Alice objects move relative to the orientation of the person viewing the animation. True or false? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 2 Lesson 2.
3. In Alice, control statements are dragged into the Code editor. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
4. From your Alice lessons, what is the purpose of nesting? Mark for Review
(1) Points
To add text to your program that tells the viewer what the code does.
To add visual structure to your program. (*)
To add more procedures to your program.
To add random movements to your program.
[Incorrect] Incorrect. Refer to Section 2 Lesson 4.
5. After objects are positioned in the scene, it is wise to save multiple versions of the project, giving each version the same name. True or false? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 2 Lesson 1.
6. Which of the following would not be an argument in an Alice programming instruction that commands a person object to move forward 2 meters? Mark for Review
(1) Points
Person's height (*)
Number of seconds to execute the programming instruction
Distance to move forward
Direction to move
[Correct] Correct
7. The Procedures tab and the Functions tab are the two tabs available in the Alice methods panel. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
8. The say procedure in Alice plays an audio file. True or false? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 2 Lesson 3.
9. From your Alice lessons, a flowchart could be created in a software program, or documented in a journal. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
10. From your Alice lessons, what does inheritance mean? Mark for Review
(1) Points
Each superclass inherits the methods and properties of its subclass.
Each class has its own methods and properties that are non-transferable to any other class.
Each subclass inherits the methods and properties of its superclass. (*)
Each class inherits the methods and properties of all classes available in Alice.
[Incorrect] Incorrect. Refer to Section 2 Lesson 5.
11. A textual storyboard helps the reader understand the actions that will take place during the animation. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
12. In Alice, the procedures' arguments allow the programmer to adjust the object, motion, distance amount, and time duration. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
13. In Alice, which of the following is not a control statement? Mark for Review
(1) Points
Count
While
Do In Order
Move (*)
[Incorrect] Incorrect. Refer to Section 2 Lesson 6.
14. Functions answer questions about an object, such as its height, width, depth and even distance to another object. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
15. In Alice, what function would you use to get a wholenumber from the user? Mark for Review
(1) Points
getDoubleFromUser
getStringFromUser
getIntegerFromUser (*)
getBooleanFromUser
[Incorrect] Incorrect. Refer to Section 2 Lesson 7.
1. The following program prints "Equal". True or false?
Mark for Review
(1) Points
True (*)
False
[Correct] Correct
2. Consider the following code snippet.
What is printed? Mark for Review
(1) Points
1 (*)
12
2
0
11
[Correct] Correct
3. Declaring and instantiating a String is much like any other type of variable. However, once instantiated, they are final and cannot be changed. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
4. Which line of Java code properly calculates the area of a triangle using A=1/2(b)(h) where b and h are Java primitive integers? Mark for Review
(1) Points
double A=1/2*b*h;
double A=(double)1/(double)2*b*h; (*)
double A=1/2bh;
double A=(double)(1/2)*b*h;
[Incorrect] Incorrect. Refer to Section 4 Lesson 3.
5. Which line of Java code will assign the value of the square root of 11 to a variable named a? Mark for Review
(1) Points
double a=Math.sqrt*11;
double a=sqrt(11);
double a=Math.sqrt(11); (*)
double a=11^(1/2);
int a=Math.sqrt(11);
[Incorrect] Incorrect. Refer to Section 4 Lesson 3.
6. Consider the following:
You are writing a class and are using a global variable. Inside a method you declare a local variable with the same name as the global variable.
This programming style is poor because inside the method the global variable will have precedence over the local variable with the same name.
True or false? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 4 Lesson 3.
7. Given the following declaration:
int z=5,m=6;
Which line of Java code properly casts one type into another without data loss? Mark for Review
(1) Points
double x=(double)z/m; (*)
double x= double z/m;
double x=(double)(z/m);
double x=z/m;
[Correct] Correct
8. Select the statement that declares a number of type double and initializes it to 6 times 10 to the 5th power. Mark for Review
(1) Points
double number=6(e5);
double number=6*10e5;
double number=6*10^5;
double number=6e5; (*)
[Incorrect] Incorrect. Refer to Section 4 Lesson 3.
9. Which of the following defines a driver class? Mark for Review
(1) Points
Contains a main method and other static methods. (*)
Contains classes that define objects.
Contains a main method, a package, static methods, and classes that define objects.
None of the above.
[Correct] Correct
10. When importing another package into a class you must import the entire package as well as the package classes that will be called. True or False? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 4 Lesson 2.
11. Which of the two diagrams below illustrate the general form of a Java program?
Mark for Review
(1) Points
Example A
Example B (*)
[Incorrect] Incorrect. Refer to Section 4 Lesson 2.
12. When importing another package into a class you must import only the package classes that will be called and not the entire package. True or false? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 4 Lesson 2.
13. Four variables are required to support a conversion of one unit of measure to another unit of measure. True or False? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 4 Lesson 1.
14. When converting gallons to liters its best to put the calculation result into a variable with a _______________ data type. Mark for Review
(1) Points
int
double (*)
boolean
None of the above
[Incorrect] Incorrect. Refer to Section 4 Lesson 1.
15. What symbols are required for a compiler to ignore a comment? Mark for Review
(1) Points
/*/
*/
/*
// (*)
[Incorrect] Incorrect. Refer to Section 4 Lesson 1.
1. For both the if-else construct and the for loop, it is true to say that when the condition statement is met, the construct is exited. True or False? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 5 Lesson 2.
2. 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 program.
None of the above.
[Incorrect] Incorrect. Refer to Section 5 Lesson 2.
3. A counter used in a for loop cannot be initialized within the For loop header. True or false? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 5 Lesson 2.
4. What should replace the comment "//your answer here" in the code below if the code is meant to take no action when i % 2 is 0 (in other words when i is even)?
for(int i = 0; i < 10; i++){
if(i%2 == 0)
//your answer here
else
k+=3;
} Mark for Review
(1) Points
return;
break;
k+=1;
continue; (*)
[Incorrect] Incorrect. Refer to Section 5 Lesson 2.
5. Which of the following is true about a do-while loop? Mark for Review
(1) Points
It is a post-test loop.
It is a modified while loop that allows the program to run through the loop once before testing the boolean condition.
It continues looping until the condition becomes false.
All of the above. (*)
[Incorrect] Incorrect. Refer to Section 5 Lesson 2.
6. Why are loops useful? Mark for Review
(1) Points
They save programmers from having to rewrite code.
They allow for repeating code a variable number of times.
They allow for repeating code until a certain argument is met.
All of the above. (*)
[Incorrect] Incorrect. Refer to Section 5 Lesson 2.
7. Which of the following are types of loops in Java? Mark for Review
(1) Points
(Choose all correct answers)
do-while (*)
for (*)
if/else
while (*)
[Incorrect] Incorrect. Refer to Section 5 Lesson 2.
8. This keyword is used to instruct specific code when the input for a switch statement that does not match any of the cases. Mark for Review
(1) Points
switch
case
break
default (*)
None of the above
[Incorrect] Incorrect. Refer to Section 5 Lesson 1.
9. switch statements work on all input types including, but not limited to, int, char, and String. True or false? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 5 Lesson 1.
10. Which of the following correctly matches the switch statement keyword to its function? Mark for Review
(1) Points
(Choose all correct answers)
case: signals what code is executed if the user input matches the specified element (*)
switch: tells the compiler the value to compare the input against
if: records the user's input and sends it to the case statements to find a possible match
default: signals what code to execute if the input does not match any of the cases (*)
switch: identifies what element will be compared to the element of the case statements to find a possible match (*)
[Incorrect] Incorrect. Refer to Section 5 Lesson 1.
11. Determine whether this boolean expression evaluates to true or false:
!(3 < 4 && 6 > 6 || 6 <= 6 && 7 - 2 == 6) Mark for Review
(1) Points
True (*)
False
[Correct] Correct
12. Which of the following correctly initializes an instance of Scanner, called "in", that reads input from the console screen? Mark for Review
(1) Points
Scanner in = Scanner(System.in);
System.in in = new Scanner();
Scanner in = new Scanner("System.in");
Scanner in = new Scanner(System.in); (*)
[Incorrect] Incorrect. Refer to Section 5 Lesson 1.
13. The six relational operators in Java are: Mark for Review
(1) Points
>, <, =, !=, =<, =>
>, <, =, !, <=, >=
>, <, =, !=, <=, >=
>, <, ==, !=, <=, >= (*)
[Incorrect] Incorrect. Refer to Section 5 Lesson 1.
14. Which of the following could be a reason to use a switch statement in a Java program? Mark for Review
(1) Points
Because it terminates the current loop.
Because it allows the code to be run through until a certain conditional statement is true.
Because it allows the user to enter an input in the console screen and prints out a message that the user input was successfully read in.
Because it allows the program to run certain segments of code and neglect to run others based on the input given. (*)
[Incorrect] Incorrect. Refer to Section 5 Lesson 1.
15. How would you use the ternary operator to rewrite this if statement?
if (balance < 500)
fee = 10;
else
fee = 0; Mark for Review
(1) Points
fee = ( balance >= 500) ? 10 : 0;
fee= ( balance < 500) ? 10 : 0; (*)
fee = ( balance > 5) ? 10 : 0;
fee = ( balance < 500) ? 0 : 10;
fee = ( balance >= 5) ? 0 : 10;
[Incorrect] Incorrect. Refer to Section 5 Lesson 1.
1. In a project, 1 of the classes must contain a main method. True or False? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
2. When converting gallons to liters its best to put the calculation result into a variable with a _______________ data type. Mark for Review
(1) Points
int
double (*)
boolean
None of the above
[Incorrect] Incorrect. Refer to Section 4 Lesson 1.
3. When converting gallons to liters its best to put the calculation result into a variable with a _______________ data type. Mark for Review
(1) Points
int
double (*)
boolean
None of the above
[Incorrect] Incorrect. Refer to Section 4 Lesson 1.
4. Which of the following is the name of a Java primitive data type? Mark for Review
(1) Points
Object
String
Rectangle
double (*)
[Incorrect] Incorrect. Refer to Section 4 Lesson 3.
5. What is the output of the following lines of code?
int j=7,k=5,m=8,result;
result=j/m*k;
System.out.println(result); Mark for Review
(1) Points
280
4.375
0.175
0 (*)
[Incorrect] Incorrect. Refer to Section 4 Lesson 3.
6. A local variable has precedence over a global variable in a Java method. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
7. Which line of Java code properly calculates the area of a triangle using A=1/2(b)(h) where b and h are Java primitive integers? Mark for Review
(1) Points
double A=(double)(1/2)*b*h;
double A=(double)1/(double)2*b*h; (*)
double A=1/2*b*h;
double A=1/2bh;
[Incorrect] Incorrect. Refer to Section 4 Lesson 3.
8. Given the following declaration, which line of Java code properly casts one type into another without data loss?
int i=3,j=4; double y=2.54; Mark for Review
(1) Points
double x=(double)(i/j);
int x=(double)2.54;
double x= double i/j;
double x=(double)i/j; (*)
double x=i/j;
[Incorrect] Incorrect. Refer to Section 4 Lesson 3.
9. When importing another package into a class you must import the entire package as well as the package classes that will be called. True or False? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 4 Lesson 2.
10. The following defines a package keyword: Mark for Review
(1) Points
Provides the compiler information that identifies outside classes used within the current class.
Defines where this class lives relative to other classes, and provides a level of access control. (*)
Precedes the name of the class.
[Incorrect] Incorrect. Refer to Section 4 Lesson 2.
11. Which of the two diagrams below illustrate the general form of a Java program?
Mark for Review
(1) Points
Example A
Example B (*)
[Incorrect] Incorrect. Refer to Section 4 Lesson 2.
12. The following defines a class keyword: Mark for Review
(1) Points
Defines where this class lives relative to other classes, and provides a level of access control.
Provides the compiler information that identifies outside classes used within the current class.
Precedes the name of the class. (*)
[Incorrect] Incorrect. Refer to Section 4 Lesson 2.
13. What is printed by the following code segment?
Mark for Review
(1) Points
albatross
alligator (*)
a1
albatross alligator
[Incorrect] Incorrect. Refer to Section 4 Lesson 4.
14. Which of the following creates a String reference named str and instantiates it? Mark for Review
(1) Points
String s="str";
String str=new String("str"); (*)
str="str";
String str;
[Incorrect] Incorrect. Refer to Section 4 Lesson 4.
15. Consider the following code snippet.
What is printed? Mark for Review
(1) Points
ArrayIndexOutofBoundsException is thrown
88888888
1010778
88888 (*)
101077810109
(1) Points
True (*)
False
[Correct] Correct
2. Which Greenfoot control operator is used to test if two values are equal? Mark for Review
(1) Points
!= operator
== operator (*)
>= operator
= operator
[Incorrect] Incorrect. Refer to Section 3 Lesson 8.
3. From your Greenfoot lessons, what is the parameter of the following constructor that creates a new image, and designates it to the Actor class?
setImage (new GreenfootImage("Bee01.png")); Mark for Review
(1) Points
GreenfootImage
setImage
new
Bee01.png (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 8.
4. In Greenfoot, the sound file must be saved in the scenario and written in the source code for it to play. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
5. In Greenfoot, which class has methods that allow you to get the status of the mouse? Mark for Review
(1) Points
Actor
World
Scenario
Greenfoot (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 7.
6. Greenfoot has tools to record sound. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
7. From your Greenfoot lessons, what types of values cannot be stored in a local variable? Mark for Review
(1) Points
(Choose all correct answers)
World name
Objects
Class name
method (*)
Integers
[Incorrect] Incorrect. 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 variables or expressions and returns a result that is true if either 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 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.
[Incorrect] Incorrect. Refer to Section 3 Lesson 10.
9. Which of the following Greenfoot logic operators represents "not"? Mark for Review
(1) Points
=
! (*)
&&
&
[Incorrect] Incorrect. Refer to Section 3 Lesson 10.
10. 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 (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 9.
11. Writing more generic statements to handle the creation and positioning of many objects is one Abstraction technique? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
12. In Java what is casting? Mark for Review
(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
[Incorrect] Incorrect. Refer to Section 3 Lesson 9.
13. Defined methods are methods that are only created by the Greenfoot development team? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 6.
14. In Greenfoot, which of the following statement is true about Defined Methods? Mark for Review
(1) Points
A defined method is automatically executed once created.
A defined method is only relevant to the Greenfoot Development team.
A defined method must be called by your source code, normally in the Act method. (*)
A defined method only relates to the World class.
[Incorrect] Incorrect. Refer to Section 3 Lesson 6.
15. In reference to Greenfoot, if the following method was defined in a superclass,
public void turnAtEdge(){
...
}
all subclasses of the superclass will inherit the method.
True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
1. From your Greenfoot lessons, a problem statement defines the purpose for your game. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
2. From your Greenfoot lessons, what are the ways that you can view a class's methods? Mark for Review
(1) Points
(Choose all correct answers)
In the Greenfoot gallery
In the scenario
In the class's documentation (*)
By right-clicking on an instance (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 3.
3. From your Greenfoot lessons, where do you review a class's inherited methods? Mark for Review
(1) Points
Act method
Documentation (*)
Inspector
If-statement
[Incorrect] Incorrect. Refer to Section 3 Lesson 3.
4. In Greenfoot, which of the following is the correct notation for calling a method for an instance of a class? Mark for Review
(1) Points
Method-name.object-name(parameters);
object-name.method-name(parameters); (*)
Method-name.object-name;
class-name.method-name(parameters);
[Incorrect] Incorrect. Refer to Section 3 Lesson 5.
5. Which of the following comparison symbols represents equals? Mark for Review
(1) Points
<
= = (*)
>
! =
[Incorrect] Incorrect. Refer to Section 3 Lesson 5.
6. Read the following method signature. Using your Greenfoot experience, what does this method do?
public static int getRandomNumber (int limit) Mark for Review
(1) Points
Returns a random number less than 10.
Returns a random coordinate position in the world.
Returns a random number for instances in the animal class only.
Returns a random number between zero and the parameter limit. (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 5.
7. From your Greenfoot lessons, which type of constructor can be used to automate creation of Actor instances? Mark for Review
(1) Points
Animal
Vector
World (*)
Actor
[Incorrect] Incorrect. Refer to Section 3 Lesson 5.
8. In Greenfoot, a subclass is created by right-clicking on a superclass. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
9. Which of the following demonstrates a Greenfoot subclass/superclass relationship? Mark for Review
(1) Points
A computer is a subclass of a video game superclass.
A dog is a subclass of the cat superclass.
A rose is a subclass of the flower superclass. (*)
A single person is a superclass of the human subclass.
[Incorrect] Incorrect. Refer to Section 3 Lesson 1.
10. 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
False (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 1.
11. An object is an instance of a class. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
12. In Greenfoot, the move method expects what type of information in its parameters? Mark for Review
(1) Points
Integer of steps to move forward (*)
True or false response
Degrees to turn
String statement
[Correct] Correct
13. In the Greenfoot IDE, an instance's position is on the x and y coordinates. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
14. A variable is also known as a ____________. Mark for Review
(1) Points
Syntax
Field (*)
Class
Method
Instance
[Incorrect] Incorrect. Refer to Section 3 Lesson 2.
15. In Greenfoot, methods can be called in the act method. When the Act button is clicked in the environment, the methods in the method body of the act method are executed. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
1. In Greenfoot, you can cast an Actor class to a World class? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 9.
2. 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 (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 9.
3. In Greenfoot you can only access the methods of the current class? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 9.
4. Which method is used to play sound in your Greenfoot game? Mark for Review
(1) Points
playSound method (*)
getSound method
importSound method
findSound method
[Correct] Correct
5. From your Greenfoot lessons, the isKeyDown method is located in which class? Mark for Review
(1) Points
Greenfoot (*)
World
GreenfootImage
Actor
[Correct] Correct
6. In Greenfoot, what type of parameter does the isKeyDown method expect? Mark for Review
(1) Points
Boolean
String (*)
Integer
Method
[Incorrect] Incorrect. Refer to Section 3 Lesson 7.
7. From your Greenfoot lessons, to save space in the act method, you can write an entirely new method below it, called a _____________. Mark for Review
(1) Points
Class method
Code method
World method
Instance method
Defined method (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 6.
8. In Greenfoot, a way to have all subclasses of a superclass inherit a method is by adding the method to the superclass. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
9. To execute a method in your Greenfoot game, where is it called from? Mark for Review
(1) Points
The gallery
The actor class
The act method (*)
The world
[Incorrect] Incorrect. Refer to Section 3 Lesson 6.
10. In the Greenfoot IDE, what symbols indicate that the variable is an array? Mark for Review
(1) Points
Colon :
Semicolon ;
Square brackets [ ] (*)
Curly brackets { }
[Incorrect] Incorrect. Refer to Section 3 Lesson 10.
11. Which of the following is not a component of a while loop? Mark for Review
(1) Points
if statement (*)
Loop variable
Local variable
Control operator
while keyword
[Correct] Correct
12. In Greenfoot, what happens if the end to a while loop isn't established? Mark for Review
(1) Points
The code will keep executing and will never stop. (*)
The code will prompt you to enter a loop counter.
The code will execute once and then stop, due to controls in Greenfoot.
The code will not execute.
[Correct] Correct
13. From your Greenfoot lessons, what is the parameter of the following constructor that creates a new image, and designates it to the Actor class?
setImage (new GreenfootImage("Bee01.png")); Mark for Review
(1) Points
Bee01.png (*)
setImage
new
GreenfootImage
[Correct] Correct
14. Which operator is used to test if values are equal? Mark for Review
(1) Points
== (*)
!>
>
<
[Correct] Correct
15. In Greenfoot, we typically use the act method in the class to automatically create the Actor instances when the world is initialized. True or false? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 8.
1. In a Greenfoot if-else statement, if the condition is true, the if-statement is executed, and then the else-statement is executed. True or false? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 5.
2. 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 both. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
3. When a Greenfoot code segment is executed in an if-statement, each line of code is executed in sequential order. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
4. Which of the following comparison symbols represents equals? Mark for Review
(1) Points
= = (*)
>
<
! =
[Correct] Correct
5. 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] Correct
6. 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
False (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 1.
7. In Greenfoot, which of the following are execution controls? Mark for Review
(1) Points
(Choose all correct answers)
Move
Act (*)
Speed (*)
Turn
Run (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 1.
8. Which of the following are examples of default superclasses that are present in a new Greenfoot scenario? Mark for Review
(1) Points
(Choose all correct answers)
Cat
Dog
Parrot
World (*)
Actor (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 1.
9. Which of the following is an incorrectly written programming statement? Mark for Review
(1) Points
turn(25);
move(): (*)
move(2);
turn(2);
[Incorrect] Incorrect. Refer to Section 3 Lesson 4.
10. In Greenfoot, which of the following options are not possible when associating an image file with an instance? Mark for Review
(1) Points
Select an image from the Greenfoot library
Import an image
Add a video (*)
Draw an image
[Incorrect] Incorrect. Refer to Section 3 Lesson 2.
11. An instance variable can be saved and accessed later, even if the instance no longer exists. True or false? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 2.
12. A variable is also known as a ____________. Mark for Review
(1) Points
Syntax
Class
Method
Field (*)
Instance
[Incorrect] Incorrect. Refer to Section 3 Lesson 2.
13. Using the Greenfoot IDE, only five instances can be added to a scenario. True or false? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 2.
14. An if-statement requires which type of information returned from the condition? Mark for Review
(1) Points
True or false (*)
Method
Action
Integer
[Correct] Correct
15. From your Greenfoot lessons, source code is written in the Code editor. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
1. From your Greenfoot lessons, the isKeyDown method is located in which class? Mark for Review
(1) Points
Actor
Greenfoot (*)
GreenfootImage
World
[Incorrect] Incorrect. Refer to Section 3 Lesson 7.
2. In Greenfoot you can interact with the scenario using a mouse. Mark for Review
(1) Points
True (*)
False
[Correct] Correct
3. In Greenfoot, you can only interact with the scenario using a keyboard. Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 7.
4. Which keyword is used to add an actor to a Greenfoot world? Mark for Review
(1) Points
addObject (*)
new
add
super
[Correct] Correct
5. Using the Greenfoot IDE, when is a constructor automatically executed? Mark for Review
(1) Points
When a new instance of the class is created. (*)
When the act method is executed.
When source code is written.
When a new image is added to the class.
[Correct] Correct
6. Using Greenfoot, how do we change the size and resolution of the World instance? Mark for Review
(1) Points
Edit the methods in the class.
Edit the values in the constructor. (*)
Edit the values in the class's act method.
Delete the instance.
[Incorrect] Incorrect. Refer to Section 3 Lesson 8.
7. Use your Greenfoot knowldege: Abstraction occurs in many different ways in programming. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
8. In Java what is casting? Mark for Review
(1) Points
When you take an Object of one particular type and turn it into another Object type. (*)
When you reset an object instance.
When you remove an object instance.
Casting is not possible in Java.
[Correct] Correct
9. 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 (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 9.
10. In Greenfoot, a way to have all subclasses of a superclass inherit a method is by adding the method to the superclass. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
11. In the Greenfoot IDE, any new methods you create are written in the class's source code. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
12. A collision in Greenfoot is when two actors make contact? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
13. How would the following sentence be written in Greenfoot source code? If Bee is turning, and the keyboard key "d" is down... Mark for Review
(1) Points
if (!Greenfoot.isKeyDown && isTurning("d") )
if (isTurning && Greenfoot.isKeyDown("d") ) (*)
if (!isTurning && Greenfoot.isKeyDown("d") )
if (&&isTurning ! Greenfoot.isKeyDown("d") )
[Incorrect] Incorrect. Refer to Section 3 Lesson 10.
14. In Greenfoot, when is a local variable most often used? Mark for Review
(1) Points
Within loop constructs (*)
Within the act method
Within the scenario
Within the world constructor
[Correct] Correct
15. In Greenfoot, what happens if the end to a while loop isn't established? Mark for Review
(1) Points
The code will prompt you to enter a loop counter.
The code will execute once and then stop, due to controls in Greenfoot.
The code will not execute.
The code will keep executing and will never stop. (*)
[Incorrect] Incorrect. Refer to Section 3 Lesson 10.
1. In Alice, how is a one-shot procedure different from procedures in the Code editor? Mark for Review
(1) Points
One-shot procedures are only available for acting objects, while procedures are available for all objects.
One-shot procedures are available in the Code editor, while procedures are available in the Scene editor.
A one-shot procedure executes only one time to re-position the object, while procedures in the Code editor execute every time the Run button is clicked. (*)
All of the above
[Incorrect] Incorrect. Refer to Section 2 Lesson 2.
2. Alice objects move relative to the orientation of the person viewing the animation. True or false? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 2 Lesson 2.
3. In Alice, control statements are dragged into the Code editor. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
4. From your Alice lessons, what is the purpose of nesting? Mark for Review
(1) Points
To add text to your program that tells the viewer what the code does.
To add visual structure to your program. (*)
To add more procedures to your program.
To add random movements to your program.
[Incorrect] Incorrect. Refer to Section 2 Lesson 4.
5. After objects are positioned in the scene, it is wise to save multiple versions of the project, giving each version the same name. True or false? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 2 Lesson 1.
6. Which of the following would not be an argument in an Alice programming instruction that commands a person object to move forward 2 meters? Mark for Review
(1) Points
Person's height (*)
Number of seconds to execute the programming instruction
Distance to move forward
Direction to move
[Correct] Correct
7. The Procedures tab and the Functions tab are the two tabs available in the Alice methods panel. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
8. The say procedure in Alice plays an audio file. True or false? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 2 Lesson 3.
9. From your Alice lessons, a flowchart could be created in a software program, or documented in a journal. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
10. From your Alice lessons, what does inheritance mean? Mark for Review
(1) Points
Each superclass inherits the methods and properties of its subclass.
Each class has its own methods and properties that are non-transferable to any other class.
Each subclass inherits the methods and properties of its superclass. (*)
Each class inherits the methods and properties of all classes available in Alice.
[Incorrect] Incorrect. Refer to Section 2 Lesson 5.
11. A textual storyboard helps the reader understand the actions that will take place during the animation. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
12. In Alice, the procedures' arguments allow the programmer to adjust the object, motion, distance amount, and time duration. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
13. In Alice, which of the following is not a control statement? Mark for Review
(1) Points
Count
While
Do In Order
Move (*)
[Incorrect] Incorrect. Refer to Section 2 Lesson 6.
14. Functions answer questions about an object, such as its height, width, depth and even distance to another object. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
15. In Alice, what function would you use to get a wholenumber from the user? Mark for Review
(1) Points
getDoubleFromUser
getStringFromUser
getIntegerFromUser (*)
getBooleanFromUser
[Incorrect] Incorrect. Refer to Section 2 Lesson 7.
1. The following program prints "Equal". True or false?
Mark for Review
(1) Points
True (*)
False
[Correct] Correct
2. Consider the following code snippet.
What is printed? Mark for Review
(1) Points
1 (*)
12
2
0
11
[Correct] Correct
3. Declaring and instantiating a String is much like any other type of variable. However, once instantiated, they are final and cannot be changed. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
4. Which line of Java code properly calculates the area of a triangle using A=1/2(b)(h) where b and h are Java primitive integers? Mark for Review
(1) Points
double A=1/2*b*h;
double A=(double)1/(double)2*b*h; (*)
double A=1/2bh;
double A=(double)(1/2)*b*h;
[Incorrect] Incorrect. Refer to Section 4 Lesson 3.
5. Which line of Java code will assign the value of the square root of 11 to a variable named a? Mark for Review
(1) Points
double a=Math.sqrt*11;
double a=sqrt(11);
double a=Math.sqrt(11); (*)
double a=11^(1/2);
int a=Math.sqrt(11);
[Incorrect] Incorrect. Refer to Section 4 Lesson 3.
6. Consider the following:
You are writing a class and are using a global variable. Inside a method you declare a local variable with the same name as the global variable.
This programming style is poor because inside the method the global variable will have precedence over the local variable with the same name.
True or false? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 4 Lesson 3.
7. Given the following declaration:
int z=5,m=6;
Which line of Java code properly casts one type into another without data loss? Mark for Review
(1) Points
double x=(double)z/m; (*)
double x= double z/m;
double x=(double)(z/m);
double x=z/m;
[Correct] Correct
8. Select the statement that declares a number of type double and initializes it to 6 times 10 to the 5th power. Mark for Review
(1) Points
double number=6(e5);
double number=6*10e5;
double number=6*10^5;
double number=6e5; (*)
[Incorrect] Incorrect. Refer to Section 4 Lesson 3.
9. Which of the following defines a driver class? Mark for Review
(1) Points
Contains a main method and other static methods. (*)
Contains classes that define objects.
Contains a main method, a package, static methods, and classes that define objects.
None of the above.
[Correct] Correct
10. When importing another package into a class you must import the entire package as well as the package classes that will be called. True or False? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 4 Lesson 2.
11. Which of the two diagrams below illustrate the general form of a Java program?
Mark for Review
(1) Points
Example A
Example B (*)
[Incorrect] Incorrect. Refer to Section 4 Lesson 2.
12. When importing another package into a class you must import only the package classes that will be called and not the entire package. True or false? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 4 Lesson 2.
13. Four variables are required to support a conversion of one unit of measure to another unit of measure. True or False? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 4 Lesson 1.
14. When converting gallons to liters its best to put the calculation result into a variable with a _______________ data type. Mark for Review
(1) Points
int
double (*)
boolean
None of the above
[Incorrect] Incorrect. Refer to Section 4 Lesson 1.
15. What symbols are required for a compiler to ignore a comment? Mark for Review
(1) Points
/*/
*/
/*
// (*)
[Incorrect] Incorrect. Refer to Section 4 Lesson 1.
1. For both the if-else construct and the for loop, it is true to say that when the condition statement is met, the construct is exited. True or False? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 5 Lesson 2.
2. 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 program.
None of the above.
[Incorrect] Incorrect. Refer to Section 5 Lesson 2.
3. A counter used in a for loop cannot be initialized within the For loop header. True or false? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 5 Lesson 2.
4. What should replace the comment "//your answer here" in the code below if the code is meant to take no action when i % 2 is 0 (in other words when i is even)?
for(int i = 0; i < 10; i++){
if(i%2 == 0)
//your answer here
else
k+=3;
} Mark for Review
(1) Points
return;
break;
k+=1;
continue; (*)
[Incorrect] Incorrect. Refer to Section 5 Lesson 2.
5. Which of the following is true about a do-while loop? Mark for Review
(1) Points
It is a post-test loop.
It is a modified while loop that allows the program to run through the loop once before testing the boolean condition.
It continues looping until the condition becomes false.
All of the above. (*)
[Incorrect] Incorrect. Refer to Section 5 Lesson 2.
6. Why are loops useful? Mark for Review
(1) Points
They save programmers from having to rewrite code.
They allow for repeating code a variable number of times.
They allow for repeating code until a certain argument is met.
All of the above. (*)
[Incorrect] Incorrect. Refer to Section 5 Lesson 2.
7. Which of the following are types of loops in Java? Mark for Review
(1) Points
(Choose all correct answers)
do-while (*)
for (*)
if/else
while (*)
[Incorrect] Incorrect. Refer to Section 5 Lesson 2.
8. This keyword is used to instruct specific code when the input for a switch statement that does not match any of the cases. Mark for Review
(1) Points
switch
case
break
default (*)
None of the above
[Incorrect] Incorrect. Refer to Section 5 Lesson 1.
9. switch statements work on all input types including, but not limited to, int, char, and String. True or false? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 5 Lesson 1.
10. Which of the following correctly matches the switch statement keyword to its function? Mark for Review
(1) Points
(Choose all correct answers)
case: signals what code is executed if the user input matches the specified element (*)
switch: tells the compiler the value to compare the input against
if: records the user's input and sends it to the case statements to find a possible match
default: signals what code to execute if the input does not match any of the cases (*)
switch: identifies what element will be compared to the element of the case statements to find a possible match (*)
[Incorrect] Incorrect. Refer to Section 5 Lesson 1.
11. Determine whether this boolean expression evaluates to true or false:
!(3 < 4 && 6 > 6 || 6 <= 6 && 7 - 2 == 6) Mark for Review
(1) Points
True (*)
False
[Correct] Correct
12. Which of the following correctly initializes an instance of Scanner, called "in", that reads input from the console screen? Mark for Review
(1) Points
Scanner in = Scanner(System.in);
System.in in = new Scanner();
Scanner in = new Scanner("System.in");
Scanner in = new Scanner(System.in); (*)
[Incorrect] Incorrect. Refer to Section 5 Lesson 1.
13. The six relational operators in Java are: Mark for Review
(1) Points
>, <, =, !=, =<, =>
>, <, =, !, <=, >=
>, <, =, !=, <=, >=
>, <, ==, !=, <=, >= (*)
[Incorrect] Incorrect. Refer to Section 5 Lesson 1.
14. Which of the following could be a reason to use a switch statement in a Java program? Mark for Review
(1) Points
Because it terminates the current loop.
Because it allows the code to be run through until a certain conditional statement is true.
Because it allows the user to enter an input in the console screen and prints out a message that the user input was successfully read in.
Because it allows the program to run certain segments of code and neglect to run others based on the input given. (*)
[Incorrect] Incorrect. Refer to Section 5 Lesson 1.
15. How would you use the ternary operator to rewrite this if statement?
if (balance < 500)
fee = 10;
else
fee = 0; Mark for Review
(1) Points
fee = ( balance >= 500) ? 10 : 0;
fee= ( balance < 500) ? 10 : 0; (*)
fee = ( balance > 5) ? 10 : 0;
fee = ( balance < 500) ? 0 : 10;
fee = ( balance >= 5) ? 0 : 10;
[Incorrect] Incorrect. Refer to Section 5 Lesson 1.
1. In a project, 1 of the classes must contain a main method. True or False? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
2. When converting gallons to liters its best to put the calculation result into a variable with a _______________ data type. Mark for Review
(1) Points
int
double (*)
boolean
None of the above
[Incorrect] Incorrect. Refer to Section 4 Lesson 1.
3. When converting gallons to liters its best to put the calculation result into a variable with a _______________ data type. Mark for Review
(1) Points
int
double (*)
boolean
None of the above
[Incorrect] Incorrect. Refer to Section 4 Lesson 1.
4. Which of the following is the name of a Java primitive data type? Mark for Review
(1) Points
Object
String
Rectangle
double (*)
[Incorrect] Incorrect. Refer to Section 4 Lesson 3.
5. What is the output of the following lines of code?
int j=7,k=5,m=8,result;
result=j/m*k;
System.out.println(result); Mark for Review
(1) Points
280
4.375
0.175
0 (*)
[Incorrect] Incorrect. Refer to Section 4 Lesson 3.
6. A local variable has precedence over a global variable in a Java method. True or false? Mark for Review
(1) Points
True (*)
False
[Correct] Correct
7. Which line of Java code properly calculates the area of a triangle using A=1/2(b)(h) where b and h are Java primitive integers? Mark for Review
(1) Points
double A=(double)(1/2)*b*h;
double A=(double)1/(double)2*b*h; (*)
double A=1/2*b*h;
double A=1/2bh;
[Incorrect] Incorrect. Refer to Section 4 Lesson 3.
8. Given the following declaration, which line of Java code properly casts one type into another without data loss?
int i=3,j=4; double y=2.54; Mark for Review
(1) Points
double x=(double)(i/j);
int x=(double)2.54;
double x= double i/j;
double x=(double)i/j; (*)
double x=i/j;
[Incorrect] Incorrect. Refer to Section 4 Lesson 3.
9. When importing another package into a class you must import the entire package as well as the package classes that will be called. True or False? Mark for Review
(1) Points
True
False (*)
[Incorrect] Incorrect. Refer to Section 4 Lesson 2.
10. The following defines a package keyword: Mark for Review
(1) Points
Provides the compiler information that identifies outside classes used within the current class.
Defines where this class lives relative to other classes, and provides a level of access control. (*)
Precedes the name of the class.
[Incorrect] Incorrect. Refer to Section 4 Lesson 2.
11. Which of the two diagrams below illustrate the general form of a Java program?
Mark for Review
(1) Points
Example A
Example B (*)
[Incorrect] Incorrect. Refer to Section 4 Lesson 2.
12. The following defines a class keyword: Mark for Review
(1) Points
Defines where this class lives relative to other classes, and provides a level of access control.
Provides the compiler information that identifies outside classes used within the current class.
Precedes the name of the class. (*)
[Incorrect] Incorrect. Refer to Section 4 Lesson 2.
13. What is printed by the following code segment?
Mark for Review
(1) Points
albatross
alligator (*)
a1
albatross alligator
[Incorrect] Incorrect. Refer to Section 4 Lesson 4.
14. Which of the following creates a String reference named str and instantiates it? Mark for Review
(1) Points
String s="str";
String str=new String("str"); (*)
str="str";
String str;
[Incorrect] Incorrect. Refer to Section 4 Lesson 4.
15. Consider the following code snippet.
What is printed? Mark for Review
(1) Points
ArrayIndexOutofBoundsException is thrown
88888888
1010778
88888 (*)
101077810109
1 komentar so far
Learned a lot of new things from your post!Good creation ,It's amazing blog
Core Java Online Training Hyderabad
Java Online Course
Java Online Training Bangalore
EmoticonEmoticon