Name:     ID: 
 
Email: 

Java Programming Quiz 1

Multiple Choice
Identify the choice that best completes the statement or answers the question.
 

 1. 

____ are insertions within the code that explain the purpose of the code statements.
a.
Comments
c.
Requirements
b.
Algorithms
d.
Solutions
 

 2. 

____ are values that cause a certain rule to become effective.
a.
Boundary values
c.
Operation values
b.
Method values
d.
Trigger values
 

 3. 

____ allows an instruction to be given to an object using a generalized rather than a specific, detailed command.
a.
Aggregation
c.
Inheritance
b.
Encapsulation
d.
Polymorphism
 

 4. 

The System class extends methods from its superclass, which is the ____ class.
a.
Array
c.
Object
b.
Exception
d.
JavaBean
 

 5. 

A(n) ____, identified by the = new notation, declares the type of data or object to be stored and assigns it a variable name in the computer's memory.
a.
constructor
c.
declarer
b.
destructor
d.
initializer
 

 6. 

The immediate superclass of a TextArea component is ____.
a.
TextContainer
c.
TextComponent
b.
Text
d.
TextField
 

 7. 

Consider the following for statement: for (int counter = 1; counter < 1; counter --). How many times will the loop execute?
a.
0
c.
2
b.
1
d.
infinite number of times
 

 8. 

To represent a null string, type ____.
a.
‘’
c.
“ ”
b.
“”
d.
‘ ’
 

 9. 

Which of the following obeys the order of operator precedence rules for arithmetic operators (from highest to lowest)?
a.
* , %, +
c.
*, +, %
b.
%, - , /
d.
+, /, %
 

 10. 

The ____ method assigns a caption or String to an object.
a.
add()
c.
setForeground()
b.
println()
d.
setText()
 

 11. 

Which of the following is a valid condition for an if statement? Assume the variable "done" is a boolean.
a.
(done=true)
c.
(done == "false")
b.
((done == false) || (done == true))
d.
(done == false && done)
 

 12. 

Which of the following is not a requirement for method arguments and their respective parameters?
a.
An argument and its respective parameter must have the same identifier name.
b.
There must be the same number of arguments as parameters.
c.
The arguments must be in the same order as the parameters.
d.
Each argument must be of the same data type as its respective parameter.
 

 13. 

All of the following are conceptual constructs of object-oriented programming except ____.
a.
encapsulation
c.
iteration
b.
inheritance
d.
polymorphism
 

 14. 

Which of the following is the correct shortcut syntax for creating and initializing an array?
a.
boolean[] results = {true, false, true};
c.
boolean[] results = [true, false, true];
b.
boolean results = {true, false, true};
d.
boolean[3] results = [true, false, true];
 

True/False
Indicate whether the statement is true or false.
 

 15. 

The impetus, or trigger, that causes a message to be sent to an object must come from another object.
 

 16. 

In TextPad, the Save button is enabled only when changes have been made to the document.
 

 17. 

FlowLayout contains the following alignment constants that can be used as arguments to its constructor: LEFT, CENTER, RIGHT, TOP, and BOTTOM.
 

 18. 

In Java, the length of an array is not a method, but a property provided for all arrays.
 

 19. 

If several variables of the same data type are declared in a program, the data type can be listed once followed by the variables separated by commas.
 

 20. 

The expression, !(a == a), evaluates to true.
 

 21. 

An applet is a small program that executes on a Web server.
 

 22. 

A class name cannot contain spaces and must not begin with a number.
 

 23. 

The if...else structure is an example of a repetition structure.
 

 24. 

Modules are not reusable.
 

Completion
Complete each statement.
 

 25. 

The particular set of rules or grammar that specify how the instructions are to be written is called the ____________________ of the language.
 

 

 26. 

A portion of a program that allows the programmer to specify that code will be executed only if a condition is met is called a(n) ____________________.
 

 

 27. 

The ____________________, also know as the UML, is a language tool that provides a standardized model for object-oriented design to depict or describe concepts graphically.
 

 

 28. 

The Java compiler converts the source code for a program into ____________________.
 

 

 29. 

Identifiers are used to name ____________________, which are locations in computer memory that can change values as the code executes.
 

 

 30. 

The layout manager, ____________________, places components into one of five geographical regions within the container.
 

 

 31. 

The ____________________ is associated with ActionEvent objects and can be used to compare its return object with another component of the same type.
 

 

 32. 

The ____________________ assigns an image to a Frame's title bar icon.
 

 

 33. 

When using a(n) ____________________ in the third parameter of a for loop, the stop value in the second parameter must be less than the initial value in the first parameter in order to avoid an infinite loop.
 

 

 34. 

The ____________________ in the java.lang package allow programmers to convert Strings to a numeric data type.
 

 

 35. 

The operators <, >, <=, and >= are called ____________________.
 

 

 36. 

Each of the single-line if statements, block if statements, or if...else statements may be ____________________, or completely included, within another if statement.
 

 

 37. 

The ____________________ takes three arguments, each of which is a number in the range from 0 to 255 that corresponds to a specified red, green, and blue color.
 

 

 38. 

The result of a comparison operation is a(n) ____________________ data type.
 

 

 39. 

A(n) ____________________ uses a graphical user interface (GUI) for user input and program output with on-screen elements such as text boxes, buttons, menus, and toolbars to support user interaction.
 

 

 40. 

A(n) ____________________, also called a bean, is a reusable software component developed in Java, which can be used by any application that understands the same format.
 

 

 41. 

____________________ refers to the program's ability to deliver a result quickly enough to be useful and in a space small enough to fit the environment.
 

 

 42. 

Unlike other comments in Java, ____________________ have no ending symbol.
 

 

 43. 

The ____________________, or AWT, is a package included with the SDK to provide programs access to color, draw methods, and other GUI elements.
 

 

 44. 

The operators == and != are called ____________________.
 

 

 45. 

A(n) ____________________ listens for events during the execution of an interactive program.
 

 

 46. 

Each of the single-line if statements, block if statements, or if...else statements may be ____________________, or completely included, within another if statement.
 

 

 47. 

The ____________________ component is used to construct an instance of a menu bar.
 

 

 48. 

The ____________________ component adds a command to a previously declared Menu component, thus resulting in a new command on the drop-down menu.
 

 

 49. 

The ActionListener interface requires a(n) ________________________method.
 

 

 50. 

The Toolkit class is the ________________________ of all actual implementations
of the Abstract Window Toolkit.
 

 



 
         Start Over