How can we help?

You can also find more resources in our Help Center.

75 terms

Com. Prog. Final Exam

blah..........
STUDY
PLAY
A program written in ____ is the most basic circuitry-level language.
b. machine language
____ are also called modules, methods, functions, and subroutines. Java programmers most frequently use the term
a. Procedures
____ refers to the hiding of data and methods within an object.
d. Encapsulation
____ describes the feature of languages that allows the same word to be interpreted correctly in different situations based on the context.
a. Polymorphism
In Java, the reserved keyword ____ means that a method is accessible and usable even though no objects of the class exist.
c. static
In a ____ environment, you can change directories using the cd command. For example, to change to a directory named MyClasses, you type cd MyClasses and press Enter.
d. DOS
Java contains a class named ____ that allows you to produce dialog boxes.
b. JOptionPane
Whenever a method requires multiple arguments, the arguments are always separated with ____.
a. commas
If a compiler detects a violation of language rules, it refuses to translate the class to ____.
c. machine code
It is best to use the ____ available text editor when writing Java programs.
b. simplest
A data item is ____ when it cannot be changed while a program is running.
b. constant
Primitive types serve as the building blocks for more complex data types, called ____ types.
c. reference
____ refers to the order in which values are used with operators.
a. Associativity
The characters ____ move the cursor to the next line when used within a println() statement.
b. \n
A(n) ____ dialog box asks a question and provides a text field in which the user can enter a response.
d. input
A(n) ____ dialog box displays the options Yes, No, and Cancel.
a. confirm
The method ____ is the first line of a method.
d. declaration
The ____ method executes first in an application, no matter where you physically place it within its class.
c. main()
Data items you use in a call to a method are called ____.
a. arguments
When a variable ceases to exist at the end of a method, programmers say the variable____.
c. goes out of scope
Methods used with object instantiations are called ____ methods.
d. instance
A(n) ____ constructor is one that requires no arguments
b. default
A variable comes into existence, or ____, when you declare it.
b. comes into scope
A method can receive ____ arguments, even if it is defined as needing double arguments.
b. integer
The compiler determines which version of a method to call by the method's ____.
b. signature
____ variables are variables that are shared by every instantiation of a class.
c. Class
The keyword ____ indicates that a field value is unalterable.
b. final
A(n) ____ consists of written steps in diagram form, as a series of shapes connected by arrows.
b. flowchart
A(n) ____ statement is the decision structure you use when you need to take one or the other of two possible courses of action.
b. dual-alternative if
The compiler does not take indentation into account when compiling code, but consistent indentation can help readers understand a program's ____.
d. logic
The ____ statement is useful when you need to test a single variable against a series of exact integer, character, or string values.
a. switch
The ____ operator is always evaluated before the OR operator.
b. AND
Which is an infinite loop?
b. loopCount = 1;
while(loopCount < 3);
{
System.out.println("Hello");
}
A(n) ____ loop is a special loop that is used when a definite number of loop iterations is required.
b. for
The ____ loop checks the value of the loop control variable at the bottom of the loop after one repetition has occurred.
b. do...while
How many times will outputLabel be called?
for(customer = 1; customer <= 20; ++customer)
for(color = 1; color <= 3; ++color)
d. 60
A(n) ____ is a variable that holds a memory address.
a. reference
A(n) ____ is a class for storing and manipulating changeable data that is composed of multiple characters.
d. StringBuilder
Strings and other objects that can't be changed are known as ____.
c. immutable
Besides Double and Integer, other wrapper classes such as Float and Long also provide ____ methods that convert Strings to the wrapper types.
a. valueOf()
To alter just one character in a StringBuilder, you can use the ____ method, which allows you to change a character at a specified position within a StringBuilder object.
d. setCharAt()
A(n) ____ is an integer contained within square brackets that indicates one of an array's variables.
b. subscript
When you declare an array name, no computer memory address is assigned to it. Instead, the array variable name has the special value ____, or Unicode value '\u0000'.
b. null
Individual array elements are ____ by value when a copy of the value is made and used within the receiving method.
b. passed
Primitive type variables are always passed by ____.
a. value
To declare a two-dimensional array in Java, you type two sets of ____ after the array type.
b. [ ]
The ArrayList class ____________________ method retrieves an item from a specified location in an ArrayList.
b. get
Regarding enumerations, the ____ method returns the name of the calling constant object.
a. toString
Regarding enumerations, the ____ method returns an array of the enumerated constants.
b. values
The ability to use inheritance in Java makes programs easier to write, ____, and more quickly understood.
d. less error prone
The class used as a basis for inheritance is the ____ class.
c. base
____ polymorphism is the ability of one method name to work appropriately for different subclass objects of the same parent class.
a. Subtype
You can use the ____ modifier with methods when you don't want the method to be overridden.
c. final
An application's ability to select the correct subclass method is known as ____.
b. dynamic method binding
The Object class equals() method returns a(n) ____ value indicating whether the objects are equal.
d. boolean
When a class both extends and implements, by convention the ____ clause is last in the class header.
c. implements
A(n) ____ statement is one that sends an Exception out of a method so it can be handled elsewhere.
a. throw
____ statements are program statements that can never execute under any circumstances.
c. Unreachable
Many developers believe that it is poor style for a method to throw more than ____ type(s) of exceptions.
c. three or four
The Java compiler does not require that you catch or specify ____ exceptions.
b. runtime
Some text files are ____ files that contain facts and figures, such as a payroll file that contains employee numbers, names, and salaries.
c. data
A(n) ____ is a group of characters that has some meaning.
d. field
A data file is used as a(n) ____ file when each record is stored in order based on the value in some field.
b. sequential access
You can create a writeable file by using the Path class ____ method.
b. newOutputStream()
An array of bytes can be wrapped, or encompassed, into a ByteBuffer using the ByteBuffer ____ method.
a. wrap()
A(n) ____ field is the field in a record that makes the record unique from all others.
b. key
The Swing classes are part of a more general set of UI programming capabilities that are collectively called the ____.
b. Java Foundation Classes
What is the default layout manager for JFrame?
a. BorderLayout
Within an implementation of the itemStateChanged() method, you can use the ____ method to determine which object generated the event and the getStateChange() method to determine whether the event was a selection or a deselection.
c. getItem()
A ____ is a component that combines two features: a display area showing an option and a list box containing additional options.
b. JComboBox
Use the ____ layout manager when you need to add components that are displayed one at a time.
d. CardLayout
When components in a Swing UI require more display area than they have been allocated, you can use a ____ container to hold the components and allow the user to display the components using scrollbars.
d. JScrollPane
If you want to see the x-coordinate of a user click, you would use the ____ method of the MouseEvent class.
b. getX()
74.
Each JMenu can contain options, called JMenuItems, or can contain submenus that are ____.
d. JMenus
The state of a JCheckBoxMenuItem or JRadioButtonMenuItem can be determined with the ____ method.
d. isSelected()