0% found this document useful (0 votes)
10 views98 pages

Java OOP Course Overview and Resources

These documents provide resources for learning object-oriented programming in Java for free, including books, courses, and links. Several online courses and free e-books on the fundamentals of OOP in Java are offered, as well as links to sites for freely downloading this type of teaching material.

Translated by

ScribdTranslations
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views98 pages

Java OOP Course Overview and Resources

These documents provide resources for learning object-oriented programming in Java for free, including books, courses, and links. Several online courses and free e-books on the fundamentals of OOP in Java are offered, as well as links to sites for freely downloading this type of teaching material.

Translated by

ScribdTranslations
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

[Link]

com/object-oriented-programming-1-java-mvc-spanish/

[Link]

[Link]

[Link]

[Link] link OOP

download free object-oriented programming book in Java

download free programming book


object-oriented in java

[Link]

[Link]

Unable to access external content.

[Link]

The provided text is a URL and does not contain translatable text.
prentice-hall

Unable to access or translate content from the provided URL.

Section 1 - Welcome and Introduction


Test
Review the answers, results, and scores of the questions shown below. The
Correct answers are marked with an asterisk (*).

Section 1
(Answer all the questions in this section)
What is the course goal?
Mark for Review
Points
Learn the basic elements of computer programming
Learn the basics of the Java programming language
Write programs
All of the above (*)

Correct
2. Throughout this course you will learn how to program in:
Mark for Review
Points
SQL
C++
Java (*)
All of the above

Correct
3. The Oracle Academy Java Fundamentals and Java Programming courses
Mark for Review
help you prepare for what exam?
Points
Microsoft certification exam
Oracle Certified Associate, Java SE7 (*)
IBM certification exam
None of the above

Correct
4. Which of the following courses are part of the Oracle Academy Java
Mark for Review
training?
Points
(Select all the correct answers)
Java Programming (*)
Java Application Development
Java Fundamentals (*)
Animating with Java

Correct
5. Which of the following instructional methods are included in this course?
Mark for Review
Points
Quizzes and exams
Journaling and blogging
Practice activities
Lectures
All of the above (*)

Correct
6. The teaching strategy for the Oracle Academy Java training includes lectures
Mark for Review
and practical exercises.
Points
True (*)
False

Correct
7. Oracle iLearning is used to access everything in the course except what?
Mark for Review
(1) Points
Quizzes
Slides
Exams
Java IDE (*)

Correct
8. What is the learning management system used in this course?
Mark for Review
Points
Alice 3
Greenfoot
iLearning (*)
BlueJ
Eclipse

Correct
9. What does IDE stand for in this course?
Mark for Review
Points
International development environment
Interactive design environment
Integrated development environment (*)

Correct
10. An IDE includes tools for which tasks?
Mark for Review
(1) Points
Writing code
Compiling code
Editing code
Debugging programs
All of the above (*)

Correct
11. Why is teamwork important?
Mark for Review
(1) Points
Individuals must work together effectively for companies to remain
competitive.
Goals can be reached faster and more efficiently.
Teamwork can result in new and innovative ideas.
All of the above (*)
2 and 3 only

Correct
Effective teamwork is essential for organizations to realize their full potential.
Mark for Review
potential and to meet certain goals.
Points
True (*)
False

Correct

Test: Introduction: Quiz


Review the answers, the results, and the scores of the questions shown below. The correct answers
are marked with an asterisk (*) .

Section 1
Answer all the questions in this section.
1. Why is it useful to learn Alice 3 and Greenfoot?
Mark for Review
Points
(Select all correct answers)
They both teach you how to code objects to move.
They both allow you to drag and drop objects.

They both allow you to learn the fundamental ideas in programming by creating objects in
a virtual world.
None of the above

Correct

2. Alice is a good introduction to learning how to program for which of the following reasons?
It uses the Alice+ programming language syntax. Mark for Review
It is easy to drag and drop objects on the screen rather than type. (1) Points
You learn fundamentals of computer programming by creating animations.
1 only

2 only

3 only

1, 2, and 3

2 and 3 only (*)

Correct

3. Which of the following steps is not needed to generate an animation in Alice or to create a game?
in Greenfoot? Mark for Review
Points
Test

Implement

Import graphical objects (*)

Create a scenario

Design a storyboard

Correct

4. When designing the scenario for a game or animation, what questions should you answer?
Mark for Review
Points
(Select all correct answers)
What programming constructs are needed?

What objects are needed? (*)

What actions should take place? (*)

What story is to be told?

Correct

5. The list below provides good characteristics of a team, except which one?
Mark for Review
Points
Shared responsibility

Clear roles
Clearly defined tasks
Regular participation

A single leader (*)

Correct

6. Which of the following components can help a team be successful?


A common goal Mark for Review
Shared responsibility Points
A project plan clearly defining roles and tasks
Equal participation and attendance at all meetings
1 only

1 and 2 only

1, 2, and 3 only

1, 2, 3, and 4 (*)

Correct

7. In a team assessment rubric, which of the following would earn a 4 (the highest score) in the
Collaboration category? Mark for Review
(1) Points
Rarely listens to, shares with, and supports the efforts of others. Often is not a good team player.
player.
Almost always listens to, shares with, and supports the efforts of others. Tries to keep
people working well together and mentors team members when appropriate.
Usually listens to, shares with, and supports the efforts of others. Does not cause "waves".
in the group.
Often listens to, shares with, and supports the efforts of others, but not always.

Correct

8. In a team assessment rubric, which of the following would earn a 1 (the lowest score) in the
attitude category? Mark for Review
Points
Is often publicly critical of the project or the work of other members of the group. Is often
negative about the task(s). (*)
Is rarely publicly critical of the project or the work of others. Often has a positive attitude.
about the task(s).
Is never publicly critical of the project or the work of others. Always has a positive attitude.
about the task(s).
Is occasionally publicly critical of the project or the work of other members of the group.
Usually has a positive attitude about the task(s).
Correct

9. The following provides examples of a team rubric, except which one?


Mark for Review
(1) Points
Ensures that there will be no errors in the project.

Set of rules and standards.

Helps the team meet its criteria for success.

Defined by the team.

Correct
10. Why might you create a journal for programming?
To document new concepts and techniques. Mark for Review
To track problems in your code and how you solved them. (1) Points
To serve as a review guide when preparing for an exam.
1 only

2 only

2 and 3 only

1, 2, and 3 (*)

Correct

11. What kind of information is useful in a programming journal?


Mark for Review
(1) Points
New programming concepts

Problems encountered and how you solved them

Both 1 and 2 (*)

Neither 1 nor 2

Correct

12. Which of the following is not a good tip for protecting information and systems (cyber security)?
Mark for Review
Points
Share strong passwords.

Keep anti-virus software up-to-date.

Only open emails from trusted sources.

Follow your organization's cybersecurity rules and report issues when they happen.

Correct

13. Which of the following is an example of behaving ethically online?


Mark for Review
(1) Points
Copying and pasting parts of someone else's work into your own without giving them credit.
credit.
Posting information about people at school that they would never want shared.

Pretending you are someone else in an online chat room.

Starting a cruel social network page about members of the community.

Refraining from using rude or bad language online.

Correct
Section 2 - Using Alice 3
Test: Get Started with Alice 3: Quiz
Review the answers, results, and scores of the questions shown below. The correct answers
are marked with an asterisk (*).

Section 1
Answer all the questions in this section
1. What do moving objects provide to your scene?
Mark for Review
Points
The sky and ground

The action (*)

The procedures

The non-moving scenery

Correct
In Alice, objects are added and positioned in the scene through the 'Scene Editor' or 'Object Tree' interface.
Mark for Review
Points
The Code editor
The gallery
The Scene editor (*)

The template

Correct

3. Which button is selected in the Alice file menu to save a version of an animation?
Mark for Review
(1) Points
File

New

Save As... (*)

Open

Correct

4. Alice 3 will periodically remind you to save your project. True or false?
Mark for Review
Points
True

False (*)

Correct

5. In Alice, once an instance is added to the scene, it cannot be deleted. True or false?
Mark for Review
Points
True

False (*)

Correct

6. When is an instance created in Alice?


Mark for Review
(1) Points
After the code is created.

After the scenario is saved.

After the folder is selected in the gallery.

After the class icon is dragged into the scene.

Correct

7. Creating multiple versions of your Alice project saves time. True or false?
Mark for Review
Points
True (*)

False

Correct
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
Points
True
False (*)

Correct

9. How do you create a programming instruction in Alice?


Mark for Review
(1) Points
Click and drag the desired programming instruction into the Procedures tab.

Click and drag the desired programming instruction into the myFirstMethod tab.

Click and drag the desired programming instruction into the Scene editor.

Click and drag the desired programming instruction into the Functions tab.

10. How do you view the results of procedures entered in the Alice code editor?
Mark for Review
(1) Points
Select the Play button.

Select the Run button.

View the procedures in the gallery.

Save the scene.

Correct

Copying programming instructions saves time when programming your Alice project.
True or false? Mark for Review
Points
True (*)

False

Correct

12. Which option copies a programming instruction to the clipboard?


Mark for Review
Points
Clipboard

Is Enabled

Copy to Clipboard (*)

Paste

Correct

13. When something is broken or doesn't work as intended in a software program, it is


referred to as a _________? Mark for Review
(1) Points
Bug (*)
Debug

Error

Code

Correct

14. Debugging is the process of finding bugs in a software program. True or false?
Mark for Review
(1) Points
True (*)

False

Correct

Test: Add and Position Objects: Quiz


Review the answers, results, and scores of the questions shown below. The correct answers
are marked with an asterisk (*).

Section 1
(Answer all the questions in this section)
True or false?
Mark for Review
Points
True (*)

False

Correct

2. Which of the following are ways to open an existing Alice project file after launching Alice?
Mark for Review
Points
(Select all the correct answers)
Click and drag the file from your computer into Alice 3.

Select the project from the My Projects tab.

Browse for the project using the File System tab.

Double-click on the project file name in the folder it is stored in on your computer.

Correct

3. In Alice, where are objects added and positioned in the scene?


Mark for Review
Points
The Code editor

The gallery

The Scene editor (*)


The template
Correct

4. In Alice, there is a limit of 10 objects per scene. True or false?


Mark for Review
Points
True

False (*)

Correct

5. In Alice, what does the resize handle style do?


Mark for Review
(1) Points
Simple rotation and movement

Rotate about the x, y, and z axes

Change size of the object and stretch it along the x, y, and z axes (*)

Move along the x, y, and z axes

Correct

6. Manually manipulating an Alice object with your cursor is a way to precisely position an object.
True or false? Mark for Review
Points
True

False (*)

Correct

7. Which of the following is not an example of a one-shot procedure?


Mark for Review
Points
Roll

Move

Turn
Spin (*)

Correct

8. Only acting objects have one-shot procedures. True or false?


Mark for Review
Points
True

False (*)

Correct

9. When you edit an object's properties in the Scene editor, the changes do not take effect until the
Run button is clicked. True or false? Mark for Review
(1) Points
True
False (*)

Correct
10. One type of object property is an object's position in the scene. True or false?
Mark for Review
Points
True (*)

False

Correct

11. Which of the following is not one of the positioning axes used in Alice 3?
Mark for Review
Points
x

w (*)

Correct

12. In Alice, where does an instance's axes intersect?


Mark for Review
(1) Points
At the instance's head.

At the instance's feet.

At the instance's center point.

At the world's center point.

Correct

13. Which handle style would be used to rotate an object's sub-part about the x, y, and z axes?
Mark for Review
(1) Points
Rotation (*)

Default

Translation

Resize

Correct
14. ¿Apuntarán los anillos alrededor de una subparte indicando cómo puedes recolocarla? Verdadero o falso?
Mark for Review
Points
True (*)

False

Correct
Test: Use Procedures and Arguments: Quiz
Review the answers, the results, and the scores of the questions shown below. The correct answers
are marked with an asterisk (*).

Section 1
Answer all the questions in this section
1. To access the Alice Code editor from the Scene editor, which button do you click?
Mark for Review
Points
Access Code Editor

Code Editor

Edit Code (*)

Code

Correct
The Alice Scene editor contains tools to rotate the camera view. True or false?
Mark for Review
Points
True (*)

False

Correct

3. In Alice, the Functions tab will display the pre-defined functions for the selected instance.
True or false? Mark for Review
Points
True (*)

False

Correct

4. 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
5. Which of the following instructions turns the clown fish left 5 meters?
Mark for Review
Points
[Link] turn Left 5.0 (*)
[Link] turn Left 0.5

[Link] turn Left 5

[Link] turn Left 5

Correct
6. Which of the following procedures turns an object to face another object?
Mark for Review
Points
turn

turnToFace

orient to upright

move toward

Correct
7. Which of the following is the default control statement in myFirstMethod?
Mark for Review
(1) Points
Count

Do Together

Do In Order (*)

Comment

Correct
8. To add a procedure to myFirstMethod, right-click on the procedure you wish to add and
Select the Add button. True or false? Mark for Review
Points
True

False (*)

Correct
9. What arguments does the Alice move procedure contain?
Mark for Review
Points
(Select all the correct answers)
Object

Direction (*)

Amount (*)
Text
10. An argument is a value that the procedure uses to complete its task. True or false?
Mark for Review
(1) Points
True (*)

False

Correct
11. Programming comments do not affect the functionality of your Alice animation. True or false?
false? Mark for Review
(1) Points
True (*)

False

Correct
12. What is the first step to entering comments in an Alice program?
Mark for Review
Points
Type comments that describe the sequence of actions in the code segment.

Drag and drop the comments tile above a code segment. (*)

Drag and drop the comments tile below a code segment.

Select the instance from the instance menu.

Correct
13. Which of the following ways can you alter a procedure in Alice?
Mark for Review
(1) Points
(Select all the correct answers)
Copy (*)

Count

Disable (*)

Reorder (*)

Correct

14. When you disable a programming instruction, it is still executed when you run the Alice
animation. True or false? Mark for Review
(1) Points
True

False (*)

Correct

15. After each execution of your Alice animation, what element or elements could be
adjusted in your code? Mark for Review
(1) Points
Control statements
Procedures

Arguments

All of the above (*)

Correct
16. It is important to save often while debugging your program. True or false?
Mark for Review
(1) Points
True (*)

False

Correct

Test: Add Rotation and Randomization: Quiz


Review the answers, results, and scores of the questions shown below. The
Correct answers are marked with an asterisk (*).

Section 1
Answer all the questions in this section
1. Which Alice control statement executes a set of procedures?
Mark for Review
simultaneously?
Points
Together
Do together (*)
Do in order
While

2. Which Alice execution task corresponds with the following storyboard


Mark for Review
statement?
Points
Cat rolls to the left.
roll Left 1
[Link] roll Left 1.0 (*)
Cat roll Left 1
Cat roll Right 1

3. In Alice, control statements are dragged into the Code editor. True or
Mark for Review
false?
(1) Points
True (*)
False

4. In Alice, the while control statement executes a set of procedures a


Mark for Review
specific number of times. True or false?
Points
True
False (*)

5. In Alice, the computer specifies the low and high range values for the
Mark for Review
range of numbers from which to pull a randomized number. True or
Points
false?
True
False (*)

6. In Alice, which of the following arguments could be replaced with a


Mark for Review
random number?
Points
(Select all the correct answers)
*
Object name
Duration (*)
Direction
Procedure name

Test: Declare Procedures: Quiz


Review the answers, results, and scores of the questions shown below. The
correct answers are marked with an asterisk (*).

Section 1
Answer all the questions in this section.
1. In Alice, what are the forms of a scenario?
Mark for Review
Points
(Select all correct answers)
A section of code to write.
A problem to solve.
A task to perform.
A person to help.
A system to start.

2. An animation gives the scenario a purpose. True or false?


Mark for Review
(1) Points
True
False (*)

Breaking down a problem or process into smaller parts makes it


Mark for Review
easier to manage. True or false?
Points
True (*)
False

4. A textual storyboard helps the reader understand the actions that will
Mark for Review
take place during the animation. True or false?
Points
True (*)
False

5. Which Alice tool is used to demonstrate the process flow of an


Mark for Review
animation?
Points
Visual storyboard
Textual storyboard
Flowchart (*)
World
Pie chart

6. A flowchart is a useful way to illustrate how your Alice animation's


Mark for Review
characters will look. True or false?
Points
True
False (*)

7. From your Alice lessons, what does inheritance mean?


Mark for Review
Points
Each class inherits the methods and properties of all classes.
available in Alice.
Each superclass inherits the methods and properties of its
subclass.
Each subclass inherits the methods and properties of its
superclass. (*)
Each class has its own methods and properties that are non-
transferable to any other class.

8. Which of the following would a clown fish object in Alice inherit


Mark for Review
from its class?
Points
Fins
Two eyes
Procedures
Functions
All of the above (*)

9. Procedural abstraction may need to be implemented if an object in


Mark for Review
Alice needs to perform an action, but there isn't an inherited
(1) Points
procedure that accomplishes that action. True or false?
True (*)
False

10. Which of the following is a reason why procedural abstraction may


Mark for Review
be used in programming an animation?
Points
(Select all the correct answers)
The code is too long.
The programmer wants to save the animation.
The code is difficult to read.
The programmer wants to reuse the code.

11. In Alice, new procedures are declared in the Scene editor. True or False
Mark for Review
false?
Points
True
False (*)

12. In Alice, you could identify when new procedures need to be


Mark for Review
declared by reviewing the textual storyboard for the animation. True
Points
or false?
True (*)
False
13. In Alice, which of the following situations could benefit from
Mark for Review
declaring a new procedure?
(1) Points
(Select all the correct answers)
An object needs to move forward, then move up 10 meters.
An object needs to say three statements.
An object does not have a default procedure for a motion, such
as swimming.
Multiple objects need to use a motion, such as bunnies hopping.
(*)
A single motion, such as walking, takes up a lot of room in
myFirstMethod. (*)

14. In Alice, if only objects that walk on four legs need to use a
Mark for Review
procedure, in which superclass would the procedure be declared?
Points
Quadruped (*)
Biped
Swimmer
Prop

Test: Use Control Statements: Quiz


Review the answers, results, and scores of the questions shown below. The
Correct answers are marked with an asterisk (*).

Section 1
Answer all the questions in this section.
1. In Alice, which of the following is not a control statement?
Mark for Review
Points
Do In Order
While
Count
Move (*)

2. In Alice, which control statement is used to invoke simultaneous


Mark for Review
movement?
(1) Points
Do Together (*)
Do In Order
While
Count
Variable

3. In Alice, a walking motion for a bipedal object can be achieved.


Mark for Review
without the Do Together control statement. True or false?
Points
True
False (*)

In Alice, different programming is not required for different objects.


Mark for Review
because all objects move the same way. True or false?
(1) Points
True
False (*)

5. In Alice, when two objects are synchronized and move together, this
Mark for Review
means that one object is:
Points
A vehicle of another (*)
A class of another
An object of another
An instance of another

6. In Alice, which procedure is used to assign one object as the vehicle of


Mark for Review
another?
Points
setClassVehicle
setObjectVehicle
setVehicle (*)
Vehicle

Test: Use Functions: Quiz


Review the answers, results, and scores of the
questions are shown below. The correct answers
are marked with an asterisk (*).

Section 1
Answer all the questions in this section
1. In Alice, where can you view the list?
Mark for Review
of functions available for an object?
(1) Points
Class description in the Scene
editor
Functions tab in the methods
panel. (*)
Instance pull-down menu.
Properties tab in the methods
panel.

2. In Alice, functions ask questions


Mark for Review
about an object. True or false?
Points
True
False (*)

Test: Use the IF and WHILE Control Structures:


Quiz
Review the answers, results, and scores of the questions shown below. The
correct answers are marked with an asterisk (*).

Section 1
Answer all the questions in this section.
In Alice, the If control structure can process one true and one false
Mark for Review
True or false?
(1) Points
True (*)
False

2. The Alice If control structure requires the false statement to be


Mark for Review
populated. True or false?
Points
True
False (*)

3. A conditional loop is a loop that will continue forever. True or false?


Mark for Review
Points
True
False (*)

4. In Alice, we use the While control statement to implement the


Mark for Review
conditional loop. True or false?
Points
True (*)
False

Test: Use Expressions: Quiz


Review the answers, results, and scores of the questions shown below. The
Correct answers are marked with an asterisk (*).

Section 1
(Answer all the questions in this section)
1. An example of an expression is:
Mark for Review
Points
I feel happy.
If or Where
3x3=9 (*)
Move forward 1 meter

2. Alice uses built-in math operators. They are:


Mark for Review
Points
Add
Subtract
Multiply
Divide
All of the above (*)

3. In Alice, which of the following programming statements moves the


Mark for Review
alien backward the distance to the asteroid, minus 2 meters?
Points
x [Link] move backward {[Link] getDistanceTo [Link]
-2} (*)
[Link] move backward {[Link] getDistanceTo [Link]
* 2}
[Link] move backward {[Link] getDistanceTo
[Link] / 2}
[Link] move forward {[Link] getDistanceTo [Link] /
2}

4. In Alice, which of the following programming statements moves the


Mark for Review
Can you tell me the distance to the bird?
Points
[Link] move forward {[Link] getDistanceTo [Link] / 2}
[Link] move {[Link] getDistanceTo [Link] / 2}
[Link] moves forward {[Link] getsDistanceTo [Link]}
[Link] moves forward {[Link] gets the distance to [Link]} (*)

Test: UseVariables: Quiz


Review the answers, results, and scores of the questions shown below. The
Correct answers are marked with an asterisk (*).

Section 1
Answer all the questions in this section
1. Which is an example of the Boolean variable type?
Mark for Review
(1) Points
3
Hello World
True or False (*)
An object

2. The initializer of a variable with a TextString value type could be


Mark for Review
(select all that apply):
Points
(Select all the correct answers)
Greetings
Howdy
4
None of the above.

Test: Use Keyboard Controls: Quiz


Review the answers, results, and scores of the questions shown below. The
Correct answers are marked with an asterisk (*).

Section 1
(Answer all the questions in this section)
1. With keyboard controls, you can create Alice animations where the user
Mark for Review
controls an object that interacts with other objects. True or false?
Points
True (*)
False
Event listeners look for and respond to the interactivity of the computer.
Mark for Review
True or false?
Points
True
False (*)

Test: Develop a Complete


Animation: Quiz
Review the answers, results, and scores of the questions.
which are shown below. The correct answers are marked
with an asterisk (*) .

Section 1
(Answer all questions in this section)
1. As the Alice programmer, you render the
Mark for Review
animation on your own. True or false?
Points
True
False (*)

2. In Alice, what are the forms of a


Mark for Review
scenario?
Points
(Select all answers
correct
A section of code to write.
A problem to solve.
A task to perform.
A person to help.
A system to start.

3. What can be used as a guideline to ensure


Mark for Review
your Alice animation fulfills animation
Points
principles?
The Internet
An animation checklist (*)
A close friend
Other programmers
The animation checklist helps you
Mark for Review
confirm that all elements of the Alice
Points
Animation are operating as expected.
True or false?
True (*)
False

5. Which of the following elements of the


Mark for Review
Alice animation should be tested before
Points
Is the animation considered complete?
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. (*)

6. The Alice animation should be tested


Mark for Review
throughout development, not just at the
(1) Points
end of the animation's development. True
or false?
True (*)
False

7. What type of Alice listener object is


Mark for Review
required to target a mouse-click on any
(1) Points
object in the scene, allowing the user to
drag that object around the scene when
Is the animation running?
addDefaultManipulation procedure
addMouseListener procedure
addDefaultModelManipulation
procedure (*)
addListener procedure

8. In which Alice class is the


Mark for Review
addDefaultModelManipulation procedure
(1) Points
located?
Object class
Scene class (*)
myFirstMethod class
Quadruped class

9. When presenting your Alice animation,


Mark for Review
ensure that your presentation is
Points
thoroughly tested and complete. True or
false?
True (*)
False

10. When presenting your Alice animation, it


Mark for Review
is not important to give the audience a
Points
reason to listen to the presentation. True
or false?
True
False (*)

Test: Correlating Java Variables, Data Types, and


Expressions with Alice 3 Tools: Quiz
Review the answers, results, and scores of the questions shown below. The
Correct answers are marked with an asterisk (*).

Section 1
(Answer all the questions in this section)
The list below describes variables. All are correct except which one?
Mark for
Review
(1) Points
A place in memory where data of a specific type can be stored for later.
retrieval and use.
Has a unique name.
Has a type associated with it.
Arranged in rows and columns. (*)

2. Examine the following code. What are the variables?


Mark for
Review
Points
args
n
i
t
All of the above are variables. (*)

3. What are the following examples of in Java?


Mark for
boolean
Review
byte
(1) Points
character
short
int
long
float
double
Types (*)
Expressions
Variables
Specifications

4. The list below displays valid primitive types in Java, except which one?
Mark for
Review
Points
boolean
String (*)
long
int
double

5. The list below displays valid arithmetic operators in Java, except which one?
Mark for
Review
Points
+
/
-
*
% (*)

6. Results of arithmetic operations cannot be stored in a variable. True or false?


Mark to
Review
Points
True
False (*)

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

8. What is the result of the following code?


Mark for
Review
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

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

What is the output produced by the following code?


Mark to
.
Review
Points

j is 5
k is 5 (*)
j is 10
j is 5
k is 5
j is 10
k is 10
j is 15
k is 15

Test: Correlating Java Methods, Classes, and


Other Structures with Alice 3 Tools: Quiz
Review the answers, results, and scores of the questions shown below. The
Correct answers are marked with an asterisk (*).

Section 1
Answer all the questions in this section.
1. The list below contains method descriptions. All are correct except which
Mark to
one?
Review
Points
(Select all the 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.

2. Main is an example of what in the following code?


Mark to
Review
public static void main (String[] args) {
Points
[Link]{"Hello World!");
}
An instance
A method (*)
A class
A variable

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

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

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

6. If you need to repeat a group of Java statements many times, which Java
which construct should you use?
Mark to
Review
Points
(Select all the correct answers)
repeat...until
do while loop (*)
while loop (*)
if

7. Review the code below.


Mark for
Review
Points

Select the result from the following statements about what happens when the
loopVal >= 5.
The message 'Printing Some Text' will be printed until loopVal is no
longer 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.

8. Which of the following statements about methods is false?


Mark for
Review
(1) Points
Classes must be defined directly within a method definition.
Methods whose return type is not void are required to include a return
statement specifying what to return.
The order in which methods are listed within the class is not important.
Java does not permit nesting one method definition within another.
method's definition.

9. In Java, a function is a method that must return a value. True or false?


Mark for
Review
Points
True
False (*)

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.
11Consider the following: You want to use the BufferedReader and
Mark for
InputStreamReader classes to get user input from the command line. Which
Review
Which of the following import statements must you use?
Points
import [Link].*;
x import [Link].*;
x import [Link].*;
x import [Link].*;
Section 3 - Using Greenfoot

Test: Getting Started with Greenfoot: Quiz


Review the answers, results, and scores of the questions shown below. The
Correct answers are marked with an asterisk (*).

Section 1
(Answer all the questions in this section)
1. In Greenfoot, what happens to an instance when the Act button is pressed?
Mark for Review
clicked in the environment?
(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
Repeat the class's act method until the scenario is stopped.
The instance executes all of the programming statements in their
Call the class's act method two times until the scenario is stopped.
The class executes all of the programming statements in their
Call the instance's act method twice until the scenario is stopped.

2. In Greenfoot, the Run button repeatedly executes all of the


Mark for Review
programming statements in the class's act method in sequential order
Points
until the pause button is clicked. True or false?
True (*)
False

True
Mark for Review
(1) Points
True (*)
False

4. In Greenfoot, the class holds the general attributes of an instance, such


Mark for Review
as the methods it inherits. True or false?
(1) Points
True (*)
False
A subclass has an inheritance relationship to a superclass.
Mark for Review
Points
for what
a-is
is-a
is by

6. What does an instance of the World class do?


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

7. In Greenfoot, after a subclass is created, what has to occur before


Mark for Review
Can instances be added to the scenario?
(1) Points
Creation of an instance
Compilation (*)
Creation of source code
Editing of source code

In Greenfoot, after a subclass is created and compiled, you cannot edit.


Mark for Review
the subclass's source code. True or false?
Points
True
False (*)

Test: Using Methods, Variables and Parameters:


Quiz
Review the answers, results, and scores of the questions shown below. The
Correct answers are marked with an asterisk (*).

Section 1
Answer all the questions in this section.
1. In Greenfoot, the move method expects what type of information in
Mark for Review
its parameters?
Points
Degrees to turn
True or false response
String statement
Integer of steps to move forward (*)

2. In Greenfoot, the turn method expects what type of information in its


Mark for Review
parameters?
Points
Degrees to turn (*)
True or false response
String statement
Integer of steps to move forward
Parameter void

3. Using the Greenfoot IDE, only five instances can be added to a


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

4. In Greenfoot, the instance has a source code editor. True or false?


Mark for Review
(1) Points
True
False (*)

5. In the Greenfoot IDE, an instance's position is on the x and y


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

6. In Greenfoot, which of the following options are not possible when


Mark for Review
associating an image file with an instance?
Points
Add a video (*)
Draw an image
Import an image
Select an image from the Greenfoot library
7. An instance variable can be saved and accessed later, even if the
Mark for Review
instance no longer exists. True or false?
Points
True
False (*)

8. A variable is also known as a placeholder.


Mark for Review
Points
Instance
Class
Field (*)
Syntax
Method

9. In Greenfoot, the body of the method is located between which of


Mark for Review
the following characters?
(1) Points
Parentheses ( )
Curly brackets { } (*)
Square brackets [ ]
Asterisks **

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

Test: Working with Source


Code and Documentation: Quiz
Review the answers, results, and scores of the
questions that are shown below. The correct answers
are marked with an asterisk (*).

Section 1
(Answer all the questions in this section)
1. The list below provides actions you
Mark for Review
can perform in the Greenfoot code
Points
editor except one. Which one should
be removed?
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.

2. The list below displays components


Mark for Review
of the Greenfoot source code editor
(1) Points
except one. Which one should be
removed?
Documentation
Comments
Method body
Instance creator (*)
Class description

3. In a Greenfoot if-statement, the


Mark for Review
programming statements that the if-
Points
statements executes are written in
curly brackets. True or false?
True (*)
False

4. An if-statement requires which type


Mark for Review
of information returned from the
(1) Points
condition?
Integer
Action
True or false (*)
Method

5. In Greenfoot, which of the


Mark for Review
following methods display an
Points
object's orientation?
(Select all answers
correct
void move()
int getRotation() (*)
int getX() (*)
void turn()

6. In Greenfoot, which of the


Mark for Review
following methods return the world
Points
that the instance lives in?
World getClass()
World getWorld() (*)
getRotation()
getXY()

Test: Developing and Testing an Application: Quiz


Review the answers, results, and scores of the questions shown below. The
correct answers are marked with an asterisk (*).

Section 1
Answer all the questions in this section.
1. Which of the following is an incorrectly written programming
Mark for Review
statement?
(1) Points
move(): (*)
move(2);
turn(25);
turn(2);

Which of the following features of Greenfoot will teach you how to


Mark for Review
identify bugs in your program?
Points
Code editor
Compilation (*)
Instance creation
Documentation

3. In object-oriented programming, programmers analyze a problem and


Mark for Review
create objects to solve the problem. True or false?
Points
True (*)
False
4. From your Greenfoot lessons, which of the following statements is
Mark for Review
most correct?
Points
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.

Test: Using Randomization and Understanding


Dot Notation and Constructors: Quiz
Review the answers, results, and scores of the questions shown below. The
Correct answers are marked with an asterisk (*).

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

2. What does the following Greenfoot programming statement tell the


Mark for Review
class to do?
Points
if ([Link](100) < 6) { turn(18); }
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.

3. Which of the following comparison operators represents 'greater'


Mark for Review
than or equal
Points
>
>= (*)
==
!=

4. In Greenfoot you can use comparison operators to compare a


Mark for Review
variable to a random number. True or false?
(1) Points
True (*)
False

5. An if-else statement executes its first code block if a condition is true.


Mark for Review
true, and its second code block if a condition is false, but not both.
(1) Points
True or false?
True (*)
False

6. The first step to executing an if-else statement is to:____________.


Mark for Review
Points
Execute the if statement
Execute the else statement
Evaluate the class
Evaluate the condition (*)

7. The list below displays characteristics of a Greenfoot world


Mark for Review
constructor, except for one. Which one should be removed?
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
created.

8. In Greenfoot, which keyword calls the World superclass?


Mark for Review
Points
world
constructor
super (*)
addObject
new
9. In Greenfoot, which of the following is the correct notation for
Mark for Review
calling a method for an instance of a class?
Points
[Link]-name(parameters); (*)
[Link]-name(parameters);
[Link]-name(parameters);
[Link]-name;

10. In Greenfoot, a semicolon is not necessary at the end of a method


Mark for Review
that uses dot notation. True or false?
(1) Points
True
False (*)

11. In Greenfoot, the origin of the world coordinate system (0,0) starts in
Mark for Review
the center of the world. True or false?
Points
True
False (*)

12. Which keyword indicates that Greenfoot needs to create a new


Mark for Review
object?
Points
new (*)
addObject
newObject
newClass

Test: Defining Methods: Quiz


Review the answers, results, and scores of the questions shown below. The
Correct answers are marked with an asterisk (*).

Section 1
(Answer all the questions in this section)
1. In the Greenfoot IDE, any new methods you create are written in the
Mark for Review
class's source code, below the act method. True or false?
(1) Points
True (*)
False

2. In reference to Greenfoot, if the following method was defined in a


Mark for Review
superclass (1) Points

public void lookForEdge(){


...
}
All subclasses of the superclass will inherit the method.
True or false?
True (*)
False

Test: Using Sound and Keyboard Control: Quiz


Review the answers, results, and scores of the questions shown below. The
Correct answers are marked with an asterisk (*).

Section 1
Answer all the questions in this section.
1. In Greenfoot, the sound file must be saved in the scenario and written
Mark for Review
in the source code for it to play. True or false?
(1) Points
True (*)
False

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

3. What type of parameter does the keyDown method expect?


Mark for Review
Points
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.

Test: Creating a World, Animating Actors, and


Ending a Game: Quiz
Review the answers, results, and scores of the questions shown below. The
correct answers are marked with an asterisk (*).
Section 1
(Answer all the questions in this section)
1. In Greenfoot, which method body correctly adds an instance of the
Mark for Review
World to a scenario, with size x = 300 y = 300 and a resolution of 2
(1) Points
pixels per cell?
world(300, 300, 2);
Super(300,300,2);
super(2,300,300);
super(300,300,2); (*)

A constructor is executed once during a Greenfoot scenario.


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

3. Which of the following Greenfoot programming statements creates a


Mark for Review
new instance of Duke, and places him at x = 140, y = 130 in the
(1) Points
world?
addObject(new( ), 140, 130);
addObject(new Duke( ), 140, 130); (*)
new(addObject(Duke), 140, 130);
new(Duke() 140, 130);

4. Which keyword is used to add an actor to a Greenfoot world?


Mark for Review
(1) Points
addObject
add
new (*)
super

5. Which of the following is the correct syntax for declaring a variable


Mark for Review
in Greenfoot?
Points
(Select all the correct answers)
public variable-type variable-name; (*)
private variable-name, variable-type;
public variable-name variable type;
private variable-type variable-name;

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


Mark for Review
Points
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.

7. Which operator is used to test if values are equal?


Mark for Review
Points
<
== (*)
>
!>

In Greenfoot, the == operator is used to test if two values are equal.


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

9. The GreenfootImage class enables Greenfoot actors to maintain their


Mark for Review
visible image by holding an object of type GreenfootImage. True or
(1) Points
false?
True (*)
False

10. What does the following programming statement mean?


Mark for Review
(1) Points
image1 = new GreenfootImage("[Link]");
The variable, image1, cannot use the image file, [Link].
The image file, [Link], has just been drawn and imported.
into the scenario.
The image file, [Link], is assigned to the variable image1.
(*)
Image files from 1-119 are associated with image1.
11. In Greenfoot, which method is used to end a game?
Mark for Review
(1) Points
[Link]();
[Link]( ); (*)
[Link]();
[Link](1);

12. Where can we review the available classes and methods in


Mark for Review
Greenfoot, including the stop method?
(1) Points
Class menu
Object menu
Class Application Programmers' Interface (API)
Greenfoot Application Programmers' Interface (API) (*)

Test: Understanding Abstraction: Quiz


Review the answers, results, and scores of the questions shown below. The
Correct answers are marked with an asterisk (*).

Section 1
Answer all the questions in this section.
1. From your Greenfoot lessons, which of the following are examples of
Mark for Review
when are abstraction techniques used?
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. (*)

2. Abstraction occurs in many different ways in programming. True or


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

Test: Using Loops, Variables, and Strings: Quiz


Review the answers, results, and scores of the questions shown below. The
Correct answers are marked with an asterisk (*).

Section 1
Answer all the questions in this section.
1. From your Greenfoot lessons, which of the following are examples
Mark for Review
of actions that can be achieved using the while loop?
(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. (*)

2. Which of the following is not a component of a while loop?


Mark for Review
Points
Local variable
Control operator
Loop variable
if statement (*)
while keyword

3. If an end to a while loop is not established, what happens?


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.

4. Infinite loops are a common cause of errors in programming. True or


Mark for Review
false?
Points
True (*)
False

False
Mark for Review
(1) Points
True
False (*)

6. In Greenfoot, arrays are a way to hold and access multiple variables.


Mark for Review
and assign different values to new instances each time the while loop
executes and produces a new instance. True or false? (1) Points
True (*)
False

7. Which of the following Greenfoot logic operators represents 'not'?


Mark for Review
(1) Points
&
&&
=
! (*)

8. In the Greenfoot IDE, what does the AND operator (&&) do?
Mark for Review
Points
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 is true.
Compares two boolean values and returns a boolean value which
It 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.

9. In Greenfoot, a local variable is declared at the beginning of a class.


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

10. In Greenfoot, what types of values cannot be stored in a local?


Mark for Review
variable?
Points
Class name
Objects
Integers
World name
Method (*)

11. In Greenfoot, string concatenation reduces the number of redundant


Mark for Review
characters or phrases you need to type into each array. True or false?
Points
True (*)
False

12. Which of the following is an example of string concatenation?


Mark for Review
(1) Points
Instead of entering ".png" after each image file name, add &&
".png" after the imageName value in the programming statement.
Instead of entering ".png" after each image file name, add =
".png" after the imageName value in the programming statement.
Instead of entering ".png" after each image file name, add +
.png after the imageName value in the programming statement.
(*)
Instead of entering '.png' after each image file name, add '.png'
after the imageName value in the programming statement.

Test: Creating an Inventory of Java


Fundamentals: Quiz
Review the answers, results, and scores of the questions shown below. The
correct answers are marked with an asterisk (*).

Section 1
(Answer all the questions in this section)
1. From your Greenfoot lessons, the __________ control structure is used to compare and make a decision.
Mark for
decision.

Conditional (*)
Repetition
Obsolete
Rewind

[Link] your Greenfoot lessons, the __________ control structure is often referred to as loops.
Mark for

Conditional
Repetition (*)
Obsolete
Rewind

3. The construct listed below is described as a __________________.


Mark for
/**
Get value and store in variable
*/
Method
Comment (*)
Variable Assignment
Instruction

4. The construct listed below is described as a __________________.


Mark by
termvar = [Link]();
Method
Comment
Variable Assignment (*)
Instruction

What is wrong with the following line of code?


Mark for
[Link](termvar + ' ' + termdef);
There are parenthesis instead of brackets.
There are parentheses instead of curly braces.
There are single quotes instead of double quotes.
The command is incorrectly capitalized.
Nothing is wrong with the code.

6. Which line of code contains a syntax error?


Mark for

2
3 (*)
4
5
6

7. In which step to create a Greenfoot game do you find and resolve errors in the game?
Mark by

Define the problem


Design the solution
Program the solution
Test the solution (*)

8. In which step to create a Greenfoot game is the solution implemented?


Mark by

Define the problem


Design the solution
Program the solution (*)
Test the solution

9. From your Greenfoot lessons, which of the following are examples of Q/A test variations?
Mark by

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.

The variations listed below are examples of changing what part of Q/A testing?
Mark by
Input numbers when characters are expected
Input characters when numbers are expected
Input symbols
Change the environment
Change the execution
Change the data (*)
None of the above

Test: Java Fundamentals Midterm Exam


Review the answers, results, and scores of the questions shown below. The
Correct answers are marked with an asterisk (*).
Section 2
(Answer all the questions in this section)
1. Before you can begin to develop the animation storyboard, what must be defined?

The code
The debugging process
The scenario (*)
The control statements

2. From your Alice lessons, inheritance means that the superclass inherits its traits from the subclass. True or False

True
False (*)

3. In Alice, objects inherit the characteristics of their:

Code
Project
Class (*)
Program

4. From your Alice lessons, what is a one-shot procedural method?

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.

5. In Alice, the procedures' arguments allow the programmer to adjust the object, motion, distance amount,
false?

True (*)
False

6. Which of the
following actions
would require a
control statement
to control
animation timing?
(Select all the correct answers)
A biped object walking.
A rock object turning.
A fish swimming.
A bird flying.

7. In Alice, a computer program requires functions to tell it how to perform the procedure. True or

True
False (*)

What is considered an Alice event?

A party with at least 20 people.


The orientation of an object.
Error handling.
A keystroke or mouse click.

9. Which of the following statements about methods is false?

Classes must be defined directly within a method definition.


Methods whose return type is not void are required to include a return statement specifying
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.

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


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.

11. From your Alice lessons,


Mark for Review
which programming
(1) Points
instruction represents the
following movement: A
turtle moves forward half
the distance to the flower.
[Link] move Forward [Link] getDistanceTo [Link] / 2.0 (*)
[Link] move Forward [Link] getDistanceTo [Link] / 0.5
[Link] moves Forward [Link] getDistanceTo [Link] / 1.0
[Link] move Forward [Link] getDistanceTo [Link] * 2

12. A loop can be infinite (continue forever) or conditional (stops upon a condition).
True or false?

True (*)
False

13. In Alice, we can avoid object collision using what?

Slowing movements down.


Using math operators. (*)
Downloading the Alice 3 collision detector app.
Using object detection.

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

[Link] move forward {[Link] getDistanceTo [Link] * 2} (*)


[Link] moves backward {[Link] gets distance to [Link] * 2}
[Link] moves backward {[Link] gets the distance to [Link] / 2}
[Link] moves forward {[Link] gets the distance to [Link] / 2}

15. From your Alice lessons, what does the Count control statement do?

Executes statements a random number of times.


Executes statements simultaneously.
Executes statements a specific number of times.
Executes statements while a condition is true.

16. From your Alice lessons, if


Mark for Review
you examined a science
(1) Points
process that had many steps,
which of the following is a
way that you could apply
functional decomposition to
this process?
1. Present the problem as an animation.
2. Further refine and define the tasks needed for each high level step.
3. Identify the high level steps for the science concept.
1. Identify the detailed steps for the science concept. Not correct
2. Present the problem as an animation.
Present the problem as an animation.
1. Identify the high level steps for the science concept.
2. Further refine and define the tasks needed for each high level step.
3. Present the problem as an animation. (*) correct

17. From your Alice lessons, the 'Checklist for Animation Completion' does not ask
questions about the scenario and storyboards, because these are not valid parts of
the animation creation process. True or false?
True
False (*)

18. Which of the following is not a reason for why comments are helpful in an Alice
program?

Comments change the functionality of the program. (*)


Comments describe the intention of the programming instructions.
Comments can outline the programming instructions.
Comments help during debugging and testing so the tester knows how the
programming statements are supposed to work.

If the value already exists in the variable it is overwritten by the assignment.


operator (=). True or false?

True (*)
False

20. Which of the following is not a valid primitive type in Java?

boolean
String (*)
long
int
double

21. From your


Mark for Review
Alice
Points
lessons
variables
are fixed
and cannot
be
changed.
True or
false?
True
False (*)

22. Which of the following programming instructions commands the fish to continuously move forward a ra
between 0.5 and 1.0 meters, minus 0.25 meters, until it collides with the shark?
(*)

Section 3
(Answer all the questions in this section)
23. In Greenfoot, if the condition is false in an if-statement, the code block inside the if-statement will not execute.

The programming statements are executed.


The if-statement is executed.
The act method is deleted.
The programming statements are not executed.

24. From your Greenfoot lessons, what are the ways that you can view a class's methods?

(Select all the correct answers)


In the scenario
In the class's documentation (*)
By right-clicking on an instance (*)
In the Greenfoot gallery

25. Which type of audience should you ask to play your Greenfoot game during testing?

Testing
Target (*)
Primary
Programmer

26. When
Mark for Review
designing a
Points
game in
Greenfoot, it
helps to
define the
actions that
will take
place in a
textual
storyboard.
True or false?
True (*)
False

27. What type of parameter does the Greenfoot playSound method take?
Mark for Review
expect?
Points
name of a sound file (as String) (*)
name of an integer (as int)
name of a keyboard key (as String)
name of the class (as String)

28. From your Greenfoot lessons, the reset button resets the
Mark for Review
Is the scenario back to its initial position? True or false?
Points
True (*)
False

29. From your Greenfoot lessons, a scenario is a game or


Mark for Review
simulation implemented in Greenfoot. True or false?
Points
True (*)
False

30. Use your Greenfoot knowledge: Abstraction occurs in many


Mark for Review
different ways in programming. True or false?
Points
True (*)
False

31. In Greenfoot, the


Mark for Review
properties of an
Points
instance can be
modified in the
documentation.
True or false?
True
False (*)

32. What type of Greenfoot method would be used to turn an


Mark for Review
object?
Points
orientTo( );
turnAround();
move ( );
turn( ); (*)

33. In the Greenfoot IDE, which type of variable allows


Mark for Review
instances to store information?
Points
Method variable
Instance variable (*)
Class variable
World variable

34. From your Greenfoot lessons, to view the methods that a


Mark for Review
class inherits, open the code editor and select
Points
documentation from the Tools menu. True or false?
True (*)
False

35. In Greenfoot, a local variable is declared at the beginning


Mark for Review
of a class. True or false?
Points
True
False (*)

36. In Greenfoot,
Mark for Review
what happens
Points
if the end to a
while loop
isn't
established?
The code will keep executing and will never stop.
The code will execute once and then stop, due to controls.
in Greenfoot.
The code will prompt you to enter a loop counter.
The code will not execute.

37. From your Greenfoot lessons, which symbol represents string


Mark for Review
concatenation?
Points
Symbol &
Symbol <
Symbol =
Symbol + (*)

38. In a Greenfoot loop constructor, which component is a


Mark for Review
counter that controls how many times the statement is
(1) Points
executed?
Local loop
While loop
Loop variable (*)
Condition

39. In Greenfoot, objects are created from:


Mark for Review
Points
Methods
Classes (*)
Signatures
Parameters

40. From your Greenfoot lessons, what is incorrect in this code


Mark for Review
example:
Points
setLocation(getX(), (int) (altitude));
Spacing
Capitalization
Parenthesis (*)
Comma

41. From your


Mark for Review
Greenfoot
Points
lessons
which of the
following is
an example
of changing
test data
during a
Q/A test
cycle?
Use a different operating system.
Use the mouse instead of the keyboard.
Use symbols instead of numbers.
All of the above.

42. In Greenfoot, a way to have all subclasses of a superclass inherit


Mark for Review
a method is by adding the method to the superclass. True or
(1) Points
false?
True (*)
False
43. In Greenfoot, defined methods must be used immediately. True
Mark for Review
or false?
Points
True
False (*)

44. Use your Greenfoot knowledge to answer the question: Where


Mark for Review
Are defined variables typically entered in a class's source code?
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.

45. In Greenfoot, which method is used to add a new instance to a


Mark for Review
scenario when the world is initialized?
(1) Points
addClass
addWorld
addObject (*)
addInstance

46. From your


Mark for Review
Greenfoot
Points
lessons,
where
should the
stop method
be inserted
into the
source
code?
In the defined method.
In the act method.
In the import statement.
In the class header.

47. From your Greenfoot lessons, which type of constructor can be


Mark for Review
used to automate creation of Actor instances?
(1) Points
Animal
World (*)
Actor
Vector

48. From your Greenfoot lessons, which axes define an object's


Mark for Review
position in a world?
Points
(Select all the correct answers)
x (*)
z
y (*)
w

49. In Greenfoot, you can use comparison operators to compare a


Mark for Review
variable to a random number. True or false?
(1) Points
True (*)
False

50. Use your Greenfoot knowledge: What range of numbers does the
What does the following method return? Mark for Review
Points
[Link](30)
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.
Section 4 - Using Eclipse
Test: Compiling with Eclipse - A First Program:
Quiz
Review the answers, results, and scores of the questions shown below. The
Correct answers are marked with an asterisk (*).

Section 1
Answer all the questions in this section.
1. When Eclipse launches, the Welcome page displays. Once this page is
Mark for Review
closed you cannot return to the resources available on this page. True or
(1) Points
False?
True
False (*)

Eclipse provides an edit area to help you navigate a hierarchy of information.


Mark for Review
True or False?
Points
True
False (*)

Eclipse provides views to help you navigate a hierarchy of information. True


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

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

5. A perspective is described as:


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

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

True
Mark for Review
Points
True (*)
False

8. Identify the components in the image below.


Mark for Review
Points

A-Main Method
Class
Package
None of the above

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

10.A package is used to organize Java related files.


Mark for Review
(1) Points
Project
Workspace
Package (*)
Collection

11. You need to compile Java code to generate a .class file


Mark for Review
(1) Points
Collect
Compile (*)
Package
Assemble

12. In a project, 2 of the classes must contain a main method. True or False?
Mark for Review
Points
True
False (*)

13. For every opening curly brace { there must be a closing curly brace } or the
Mark for Review
The program will not compile without error. True or False?
(1) Points
True (*)
False

Semi-colons at the end of each line are not required to compile successfully.
Mark for Review
True or False?
Points
True
False (*)

15. Quels symboles sont nécessaires pour qu'un compilateur ignore un commentaire ?
Mark for Review
Points
// (*)
/*
*/
/*/

16. When converting gallons to liters, it's best to put the calculation result into a
Mark for Review
variable with a _______________ data type.
Points
int
double (*)
boolean
None of the above

17. Two variables are required to support a conversion of one unit of measure to
Mark for Review
another unit of measure. True or False?
(1) Points
True (*)
False

Test: Using Object Classes and Driver


Classes: Quiz
Review the answers, results, and scores of the questions shown below. The
correct answers are marked with an asterisk (*).

Section 1
(Answer all the questions in this section)
Which of the two diagrams below illustrate the general form of a Java program?
Mark for
.
Review
(1) Points
Example A
Example B (*)

When importing another package into a class you must import the entire package.
Mark to
. as well as the package classes that will be called. True or False?
Review
(1) Points
True
False (*)

Which of the following defines a driver class?


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

Which of the following defines an object class?


Mark for
.
Review
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.

The following defines a package keyword:


Mark for
.
Review
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.

6The following defines an import keyword:


Mark to
.
Review
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.

The following defines a class keyword:


Mark to
.
Review
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. (*)

Test: Programming with Data Types


and Operators: Quiz
Review the answers, the results, and the scores of the questions shown below. The
correct answers are marked with an asterisk (*).

Section 1
Answer all the questions in this section
What is the output of the following lines of code?
Mark
.
for Review
int j=7,k=5,m=8,result;
Points
result=j/m*k;
[Link](result);
0 (*)
4.375
0.175
280

What is the output of the following lines of code?


Mark
.
for Review
int j=7,k=5,m=8,result;
Points
result=j-k%3*m;
[Link](result);
0
16
2
-9 (*)

Which of the following is not correct Java code?


Mark
.
for Review
Points
double x = [Link](16);
double x = [Link](3, 4) * 5.0;
double x=[Link]*5.0;
double x=[Link]; (*)
Which line of Java code assigns the value of 5 raised to the power of 8 to a?
Mark
.
for Review
Points
double a=15^8;
double a=[Link](5,8); (*)
int a=[Link](8,5);
int a=[Link](5,8);
double a = pow(8, 5);

Write a declaration statement that will hold a number like 2.541.


Mark
.
for Review
(1) Points
char number;
int number;
float number; (*)
boolean number;

Which of the following is the name of a Java primitive data type?


Mark
.
for Review
Points
String
int (*)
Rectangle
Object

Which of the following is not a legal name for a variable?


Mark
.
for Review
(1) Points
R2-D2
dgo2sleep
4geeks (*)
to be or not to be

Which of the following examples of Java code is not correct?


Mark
.
for Review
(1) Points
int x=6;
double d=4.5;
boolean b=1; (*)
char c='r';

Which of the following statements correctly assigns '3 times 10 to the 4th power' to the
Mark
Variable number?
for Review
(1) Points
double number = 3 * 10^4;
double number=3(e4);
double number=30000;
double number = 3 * 10e4;

Which line of code does not assign 3.5 to the variable x?


Mark
0
for Review
.
Points
double x=3.5
x=3.5;
3.5 = x
x=7.0/2.0;

1Consider the following:


Mark
1
for Review
. You are writing a class and are using a global variable. Inside a method you declare a
Points
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?
True
False (*)

What will the method methodA print to the screen?


Mark
2
for Review
.
(1) Points
18 (*)
15
6
3

Which line of Java code properly calculates the volume of a cone using
Mark
3
for Review
.
Points
where r and h are Java primitive integers?
double V = 1/3 * 3.14 * r * r * h;

double V = (double)1 / 3 * [Link] * [Link](r, 2) * h;


double V=1/3*[Link]*[Link](r,2)*h;
double V = (double)1/3 * [Link] * [Link](2, r) * h;
double V = 1/3 * 3.14 * r(2) * h;

Given the following declaration: int z=5, m=6;


Mark
4
for Review
Which line of Java code properly casts one type into another without data loss?
Points
double x = (double) z / m;
double x=z/m;
double x = (double)(z / m);
double x= double z/m;

Test: Using Strings: Quiz


Review the answers, results, and scores of the displayed questions.
below. The correct answers are marked with an asterisk (*).

Section 1
(Answer all the questions in this section)
1 Consider the following code snippet. What is printed?
Mark
.
for Review
String river = new String("Hudson"); Points
[Link]([Link]());
6 (*)
7
8
Hudson
river

2Which of the following creates a String reference named str and


Mark
. instantiates it?
for Review
Points
String str;
str="str";
String s="str";
String str=new String("str"); (*)

Declaring and instantiating a String is much like any other type of


Mark
. variable. However, once instantiated, they are final and cannot be
for Review
changed. True or false?
(1) Points
True (*)
False

Which of the following statements declares a String object called


Mark
. name?
for Review
Points
String name;
String name
int name;
double name;

Suppose that s1 and s2 are two strings. Which of the statements or


Mark
. Are expressions valid?
for Review
Points
(Select all the correct answers)
String s3 = s1 + s2;
String s3 = s1 - s2;
s1 is less than or equal to s2

[Link](s2); (*)
int m = [Link]();

Consider the following code snippet. What is printed?


Mark
.
for Review
Points

PoliiPolii (*)
Polii
auaacauaac
auaac
ArrayIndexOutOfBoundsException is thrown

What will the following code segment output?


Mark
.
for Review
Points

"\\\\\"
\"\\\\\"
"\\" (*)
"\\\"

What will the following code segment output?


Mark
.
for Review
Points

""\\"
""\"
""\
" (*)
"""\
""
""\
""
The following program prints 'Equal'. True or false?
Mark
.
for Review
Points

True (*)
False

Which of the following creates a String named string?


Mark
0
for Review
.
(1) Points
char string;
String s;
String string; (*)
String String;
String char;

Given the code below, which of the following would equate to true?
Mark
1
for Review
yes
Points
yes
String s3 = new String(s1);
(Select all correct answers)
s1 == s2 (*)
s1 = s2
s3 == s1
[Link](s2) (*)
[Link](s1) (*)

The String methods equals and compareTo perform the exact same
Mark
2function. True or false?
for Review
.
Points
True
False (*)
The == operator can be used to compare two String objects. The result
Mark
3 is always true if the two strings are identical. True or false?
for Review
.
Points
True
False (*)

The following program prints 'Equal'. True or false?


Mark
4
for Review
.
(1) Points

True
False (*)

Given the code below, which of the following calls are valid?
Mark
5
for Review
String s = new String("abc");
Points
(Select all the correct answers)
[Link]() (*)
[Link]('a', 'A') (*)
[Link](2) (*)
[Link]() (*)
[Link](1,'A')

Consider the following code snippet. What is printed?


Mark
6
for Review
String ocean = new String("Atlantic Ocean");
(1) Points
[Link]([Link]('a'));
0
2
3 (*)
11
12

1Consider the following code snippet. What is printed?


Mark
7
for Review
. Points

55555
87668 (*)
AtlanticPacificIndianArcticSouthern
The code does not compile.
An ArrayIndexOutOfBoundsException is thrown.

1Consider the following code snippet. What is printed?


To mark
8
for Review
.
(1) Points

55555
87658
AtlanticPacificIndianArcticSouthern
The code does not compile.
An ArrayIndexOutofBoundsException is thrown.

Test: Using Scanner and Conditional


Statements: Quiz
Review the answers, results, and scores of the questions shown below. The
Correct answers are marked with an asterisk (*).

Section 1
(Answer all the questions in this section)
1. What will be printed if the following Java code is executed?
Mark for
Review
Points
0
3 (*)
4
5

2. Which of the following correctly initializes an instance of Scanner, called 'in', that
Mark for
reads input from the console screen?
Review
(1) Points
Scanner in = new Scanner([Link]); (*)
Scanner in = new Scanner("[Link]");
Scanner in = Scanner([Link]);
[Link] in = new Scanner();

3. Which of the two diagrams below illustrate the correct syntax for variables used in
Mark for
an if-else statement?
Review
(1) Points
Example A (*)
Example B

4. In an if-else construct, the condition to be evaluated must be contained within


Mark for
parentheses. True or False?
Review
Points
True (*)
False

5. The six relational operators in Java are:


Mark for
Review
Points
>,<,=,!,<=,>=
>,<,=,!=,=<,=>
>,<,=,!=,<=,>=
>,<,==,!=,<=,>= (*)

6. Determine whether this boolean expression evaluates to true or false:


Mark for
!(3<4&&5>6||6<=6&&7-1==6)
Review
(1) Points
True
False (*)

7. The three logic operators in Java are:


Mark to
Review
Points
!=,=,==
&&, ||, ! (*)
&&,!=,=
&,|,=

8. What is the difference between the symbols = and == ?


Mark to
Review
Points
The symbol = is used in if statements and == is used in loops.
The symbol == is used to assign values to variables and the = is used in
declarations.
The = is used to assign values to variables and the == compares values.
There is no difference.

9. In Java, each case segment of a switch statement requires the keyword break to avoid
Mark for
falling through
Review
Points
True (*)
False

The following code fragment properly implements the switch statement. True or
Mark for
[Link]?
Review
Points
default(input)
switch '+'
answer+=num;
break;
case '-' :
answer-=num;
break;
!default
Invalid input
True
False (*)

How would you use the ternary operator to rewrite this if statement?
Mark for
Review
if (skillLevel > 5)
Points
numberOfEnemies = 10;
else
numberOfEnemies = 5;
( skillLevel > 5) ? 5 : 10
if skillLevel is less than 5, then 10 else 5
( skillLevel >= 5) ? 5 : 10;
( skillLevel >= 5) ? 10 : 5
( skillLevel > 5) ? 10 : 5;

How would you use the ternary operator to rewrite this if statement?
Mark for
2.
Review
if (gender == "male")
(1) Points
Mr.
else
Ms.
[Link]( (gender == "male") ? "Mr." : "Ms." ); (*)
[Link]( (gender == "male") ? "Ms." : "Mr." );
(gender == "male") ? "Mr." : "Ms." ;
Mr.

Test: Using Program Control


Statements: Quiz
Review the answers, results, and scores of the questions shown below. The
Correct answers are marked with an asterisk (*).

Section 1
(Answer all the questions in this section)
1. What is a loop?
Mark for Review
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.

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

3. Which of the following are types of loops in Java?


Mark for Review
Points
(Select all correct answers)
while (*)
if/else
do-while (*)
for (*)

4. What is the function of the word 'break' in Java?


Mark for Review
Points
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.

5. Identify which situation could be an example of a while loop.


Mark for Review
Points
Taking coins out of a pile one at a time and adding their value to the
total 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 are petted.
have been petted.
All of the above.

6. What is one significant difference between a while loop and a do-while loop?
Mark for Review
loop?
(1) Points
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 loop 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.

7. A counter used in a for loop cannot be initialized within the For loop
Mark for Review
statement. True or False?
Points
True
False (*)

8. The syntax below represents a valid initialization of a for loop counter. True
Mark for Review
or False?
(1) Points
public class ForLoop {
public static void main (String args[])
{
for (int i=10; i <20; i++)
[Link]("i: " + i);
}
}
True (*)
False

9. For both the if-else construct and the for loop, it is true to say that when the
Mark for Review
If the condition statement is met, the construct is exited. True or False?
Points
True
False (*)

10. In a for loop, the counter is automatically incremented after each loop.
Mark for Review
iteration. True or False?
Points
True
False (*)

11. Which of the following correctly initializes a for loop that executes 5 times?
Mark for Review
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++)
Section 6 - Using Arrays and Exceptions
Test: Using Arrays: Quiz
Review the answers, results, and scores of the questions shown below. The
correct answers are marked with an asterisk (*).

Section 1
(Answer all the questions in this section)
1. Which of the following statements is a valid array declaration?
Mark for
Review
Points
(Select all the correct answers)
int number();
float average[]; (*)
double[] marks; (*)
counter int[];

2. The following array declaration is valid:


Mark for
Review
int[] y = new int[5];
Points
True (*)
False

3. Which of the following declares a one-dimensional array named "score" of type


Mark for
int that can hold 9 values?
Review
Points
int score;
int[] score;
int[] score=new int[9]; (*)
int score=new int[9];

4. Which of the following declares and initializes a one-dimensional array named


Mark for
words of size 10 so that all entries can be Strings?
Review
Points
String words=new String[10];
char words=new char[10];
char[] words=new char[10];
String[] words=new String[10]; (*)

5. Which of the following declares and initializes a two-dimensional array?


Mark for
Review
(1) Points
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};

6. What is the output of the following segment of code?


Mark for
Review
Points

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

7. What is the output of the following segment of code?


Mark for
Review
Points

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

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

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

Which of the following statements print every element of the one-dimensional?


Mark for
array prices to the screen?
Review
Points
for(int i=0; i < [Link]; i++){[Link](prices[i]);} (*)
[Link]([Link]);
for(int i=1; i <= [Link]; i++){[Link](prices[i]);}
for(int i=0; i <= [Link]; i++){[Link](prices[i]);}

What is the output of the following segment of code?


Mark to
.
Review
Points

753
6
7766554433221
7531 (*)
This code does not compile.

The following creates a reference in memory named y that can refer to five
Mark for
Different integers via an index. True or false?
Review
Points
int[] y = new int[5];
True (*)
False

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

What is the output of the following segment of code if the command line
Mark to
arguments are "apples oranges pears"?
Review
Points

apples
pears (*)
oranges
args
This code does not compile.

What is the output of the following segment of code if the command line
Mark for
arguments are "apples oranges pears"?
Review
Points

0
1
2
3 (*)
This code does not compile.

What will be the content of array variable table after executing the following
Mark for
. code?
Review
Points

000
000
000
100
010
the correct one
1 0 0 is not correct
110
111
001
010
100

What is the output of the following segment of code?


Mark for
.
Review
(1) Points

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

18 After execution of the following statement, which of the following are true?
Mark to
.
Review
int number[] = new int[5];
Points
number[0] is undefined
number[4] is null
number[2] is 0 (*)
[Link]() is 6

The following array declaration is valid. True or false?


Mark to
.
Review
int x[] = int[10];
Points
True
False (*)

Test: Sorting and Searching: Quiz


Review the answers, results, and scores of the questions shown below. The
Correct answers are marked with an asterisk (*).

Section 1
(Answer all the questions in this section)
1. Which of the following best describes lexicographical order?
Mark for Review
Points
A simple sorting algorithm that is inefficient on large arrays.
An order based on the ASCII value of characters. (*)
A complex sorting algorithm that is efficient on large arrays.
The order of indices after an array has been sorted.

2. Which of the following is the correct lexicographical order for the contents of
Mark for Review
the int array {17, 1, 1, 83, 50, 28, 29, 3, 71, 22}
Points
{71, 1, 3, 28,29, 50, 22, 83, 1, 17}
{83, 71, 50, 29, 28, 22, 17, 3, 1, 1}
{1, 1, 17, 22, 28, 29, 3, 50, 71, 83}
{1, 2, 7, 0, 9, 5, 6, 4, 8, 3}
{1, 1, 3, 17, 22, 28, 29, 50, 71, 83} (*)

3. Bubble Sort is a sorting algorithm that involves swapping the smallest value
Mark for Review
into the first index, finding the next smallest value and swapping it into the
Points
next index and so on until the array is sorted. True or false?
True
False (*)

4. Which of the following sort algorithms was used to sort the char array {'M',
Mark for Review
'S', 'A', 'T', 'H'}. The steps are shown below: {'M', 'S', 'A', 'T', 'H'} {'M', 'A',
(1) Points
'S', 'T', 'H'} {'A', 'M', 'S', 'T', 'H'} {'A', 'M', 'S', 'H', 'T'} {'A', 'M', 'H', 'S', 'T'}
{'A', 'H', 'M', 'S', 'T'}
Selection Sort
Merge Sort
Bubble Sort (*)
Sequential Search
Binary Search

False
Mark for Review
Points
True
False (*)

6. Selection sort is a sorting algorithm that involves finding the minimum value
Mark for Review
in the list, swapping it with the value in the first position, and repeating these
Points
steps for the remainder of the list. True or false?
True (*)
False

False.
Mark for Review
Points
True
False (*)

8. Which searching algorithm involves using a low, middle, and high index
Mark for Review
value to find the location of a value in a sorted set of data (if it exists)?
Points
Sequential Search
Merge Sort
Selection Sort
Binary Search (*)
All of the above

9. A sequential search is an iteration through the array that stops at the index
Mark for Review
where the desired element is found. True or false?
Points
True (*)
False
10. Why might a sequential search be inefficient?
Mark for Review
(1) Points
It utilizes the "divide and conquer" method, which makes the algorithm
more error prone.
It requires incrementing through the entire array in the worst case, which
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.

11. Big-O Notation is used in Computer Science to describe the performance of


Mark for Review
Sorts and Searches on arrays. True or false?
Points
True (*)
False

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


Mark for Review
Points
n
n squared
lg(n) (*)
n*lg(n)

Test: Handling Errors: Quiz


Review the answers, the results, and the scores of the questions shown below. The
Correct answers are marked with an asterisk (*).

Section 1
(Answer all the questions in this section)
1. Which of the following would give you an array index out of bounds?
Mark for Review
exception?
Points
Misspelling a variable name somewhere in your code.
Referring to an element of an array that is at an index less than the length
of the array minus one.
Using a single equal symbol to compare the value of two integers.
Referring to an element of an array that is at an index greater than the
length of that array minus one.
Unintentionally placing a semicolon directly after initializing a for loop.
What exception message indicates that a variable may have been misspelled?
Mark for Review
somewhere in the program?
(1) Points
variableName cannot be resolved to a variable (*)
method methodName(int) is undefined for the type className
Syntax error, insert ";" to complete statement
All of the above

3. Which of the following defines an Exception?


Mark for Review
Points
A very severe non-fixable problem with interpreting and running your
code.
Code that has no errors and therefore runs smoothly.
A problem that can be corrected or handled by your code.
An interpreter reading your code.

4. What do exceptions indicate in Java?


Mark for Review
Points
(Select all correct answers)
The code has considered and dealt with all possible cases.
A mistake was made in your code.
There are no errors in your code.
Exceptions do not indicate anything, their only function is to be thrown.
The code was not written to handle all possible conditions.

5. Which line of code shows the correct way to throw an exception?


Mark for Review
Points
new throw Exception("Array index is out of bounds");
throw new Exception("Array index is out of bounds"); (*)
throw Exception("Array index is out of bounds");
throws new Exception("Array index is out of bounds");

6. What does the interpreter look for when an exception is thrown?


Mark for Review
Points
It does not look for anything. It just keeps reading through your code.
It does not look for anything. It stops interpreting your code.
The end of the code.
A catch statement in the code.

7. Which of the following would be a correct way to handle an index out of bounds?
Mark for Review
bounds exception?
Points
(Select all the correct answers)
Throw the exception and catch it. In the catch, set the index to the index
of the array closest to the one that was out of bounds.
Do nothing, it will fix itself.
Throw the exception that prints out an error message. There is no need to
have the catch handle the exception if it has already been thrown.
Rewrite your code to avoid the exception by not allowing the use of an
index that is not inside the array. (*)

A computer company has one million dollars to give as a bonus to the


Mark for Review
employees, and they wish to distribute it evenly amongst them.
Points
The company writes a program to calculate the amount each employee
receives, given the number of employees.

Unfortunately, the employees all went on strike before they heard about the
bonus. This means that the company has zero employees.

What will happen to the program if the company enters 0 into the employment
number?
(Select all the correct answers)
An unfixable error will occur.
The program will calculate that each employee will receive zero dollars
because there are zero employees.
An exception will occur because it is not possible to divide by zero.
The programmers will have proven their worth in the company because
without them the company wrote faulty code.

You might also like