Com. Prog. Final Exam – Flashcards

Unlock all answers in this set

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