Anda di halaman 1dari 5

11. What is the purpose of the main method? To build a user interface. To hold the APIs of the application.

To create buttons and scrollbars. To act as the entry point for the program. Each question is worth one point. Select the best answer for each question.


What are the two common characteristics shared by all objects?

Please select the best answer. A. B. C. Methods and interfaces State and behavior Methods and messages


What really happens when a message is sent to an object?

Please select the best answer. A. B. C. A method is called on that object. A member variable is set for that object. A text string is assigned to the object.


When a class is based on another class, it inherits:

Please select the best answer. A. B. C. The data and methods for the class The methods and messages for the class Only the data for the class


OOP promotes a way of programming that allows programmers to think in terms of:

Please select the best answer.

A. B. C.

Data Procedures Objects


What is a template, or specification, that defines a type of object?

Please select the best answer. A. B. C. A class A prototype A framework


What Java keyword do you use to define a class?

Please select the best answer. A. B. C. Baacac 1. What is it called when a program is written to respond to the button clicks, menu selections, and other actions of the user in whatever order the user does them? A. Event-driven programming. B. Action-driven programming. C. User-driven programming. D. Mouse-driven programming 6. When the user clicks on a button, what is generated? A. An Event. B. A Button object. C. A Container D. A Listener. What letter do many Swing class names start with? define new class

A. A B. B C. J D. S Fill in the blanks so that this program displays a JFrame:

import java.awt.*;

public class microGUI { public static void main ( String[] args ) { JFrame frm = new ___________(); frm.___________( 150, 100 ); frm.___________( true ); } }

A. Form, setVisible, setOn B. JFrame, setSize, setVisible C. Frame, setVisible, setSize D. Window, setSize, paint What is a class? A. A class is a section of computer memory containing objects. B. A class is a section of the hard disk reserved for object oriented programs. C. A class is the part of an object that contains the variables. D. A class is a description of a kind of object.

What is another name for creating an object? A. instantiation B. insubordination C. initialization D. inheritance How many objects of a given class may be constructed in an application? A. Only one per constructor. B. As many as the application asks for. C. Only one per class. D. One object per variable. Examine the following section of code:

String strA; String strB = new String("Cheese");

How many objects have been created?

A. zero B. one C. two D. three What value is assigned to a reference variable to show that there is no object? A. 0 B. void C. null D. "" . Why is the main() method special in a Java program?

A. It is where the Java interpreter starts the whole program running. B. Only the main() method may create objects. C. Every class must have a main() method. D. The main() method must be the only static method in a program. II. TRUE OR FALSE

Inheritance specifies an is-a-kind-of relationship All object references in Java are potentially polymorphic Sorting is the process of arranging a list of items in a particular order The processing of the selection sort algorithm includes the swapping of two values a class that implements the Comparable interface defines a compareTo method to determine the relative order of its objects 6. The sorting method doesn't "care" what it is sorting, it just needs to be able to call the compareTo method 7. Common behavior can be defined in a superclass and inherited into a subclass using the extends keyword. 8. A namespace that organizes classes and interfaces by functionality is called a package 1. 2. 3. 4. 5.