Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
77 Cards in this Set
- Front
- Back
________ is a graphical language that allows people who design software systems to use an industry standard notation to represent them. |
The Unified Modeling Language |
|
What is the difference between a float and a double? |
Double variables store numbers with larger magnitude and finer detail. |
|
Which command executes the Java class file Welcome.class? |
java Welcome |
|
Which of the following is not one of the six logical units of a computer? |
Printer |
|
Which of the following is not a control structure: |
Declaration structure. |
|
All import declarations must be placed |
before the class declaration. |
|
Which of the following is not a Java primitive type? |
real |
|
Every Java application is composed of at least one: |
public class declaration
|
|
Which of the following statements is false? |
Information in the memory unit is persistent—it is retained when the computer's power is turned off. |
|
What is output by the following Java code segment? |
This porridge is too hot! This porridge is just right! |
|
Which command compiles the Java source code file Welcome.java? |
javac Welcome.java |
|
Which class provides prebuilt dialog boxes that enable programs to display windows containing messages (such windows are called message dialogs)? |
JOptionPane |
|
Attributes of a class are also known as: |
Fields |
|
Which of the following is not one of the three general types of computer languages? |
Spoken languages. |
|
What is the default value of a reference? |
null |
|
What does the expression x %= 10 do? |
Divides x by 10 and stores the remainder in x. |
|
Which of the following does not contain a syntax error? |
System.out.println( "Hello world!" ); |
|
Which statement is true? |
Syntax errors are caught by the compiler. Logic errors have effects at execution time. |
|
What is the result value of c at the end of the following code segment? |
0 |
|
What is output by the following Java code segment? |
None of the above. |
|
Which of the following statements about the break statement is false? |
The break statement, when executed in a while, for or do…while, skips the remaining statements in the loop body and proceeds with the next iteration of the loop. |
|
Consider the following two Java code segments: |
Both (a) and (b) are true. |
|
Which of the following will count down from 10 to 1 correctly? |
for ( int j = 10; j >= 1; j-- ) |
|
Which of the following statements about the continue statement is true? |
A continue statement proceeds with the next iteration of the immediately enclosing while, for, do…while statement. |
|
Which of the following statements about a do…while repetition statement is true? |
The body of a do…while loop is always executed at least once. |
|
To exit out of a loop completely, and resume the flow of control at the next line in the method, use _______. |
A break statement |
|
Consider the code segment below. |
if ( gender == 1 && age >= 65 ) |
|
For the code segment below: |
Anything greater than or equal to 4. |
|
Suppose variable gender is MALE and age equals 60, how is the expression |
The condition ( gender == FEMALE ) is evaluated first and the evaluation stops immediately. |
|
The control variable of a counter-controlled loop should be declared as ________to prevent errors. |
int |
|
Which statement creates a random value from the sequence 2, 5, 8, 11 and 14. Suppose randomNumbers is a Random object. |
2 + 3 * randomNumbers.nextInt( 5 ); |
|
In a class containing methods with the same name, the methods are distinguished by: |
(a) and (b). Number of arguments. Types of arguments. |
|
Suppose method1 is declared as |
void method1 ( float a, int b ) |
|
Declaring main as ________ allows the JVM to invoke main without creating an instance of the class. |
static. |
|
To declare a method as static, place the keyword static before ________ in the method’s declaration. |
the return type. |
|
A well-designed method |
performs a single, well-defined task |
|
An overloaded method is one that |
has the same name as another method, but different parameters (by number, types or order of the types). |
|
Consider the following Java statements: |
x and y are parameters. |
|
Which statement is not true. |
The Java API consists of import declarations. |
|
Stacks are known as ________ data structures. |
LIFO |
|
A programmer must do the following before using an array: |
declare then create the array. |
|
Which statement correctly passes the array items to method takeArray? Array items contains 10 elements. |
takeArray( items ) |
|
What do the following statements do? |
Create a double array containing 14 elements |
|
In this question, assume a class, Book, has been defined. Which set of statements creates an array of Book objects? |
Book[] books; |
|
Which method call converts the value in variable stringVariable to an integer? |
Integer.parseInt( stringVariable ). |
|
Consider the array: |
9 |
|
Arrays are: |
fixed-length entities. |
|
Attempting to access an array element out of the bounds of an array, causes a(n) |
ArrayIndexOutOfBoundsException. |
|
Consider the program below: |
Result is: 65. |
|
The preferred way to traverse a two-dimensional array is to use |
two nested for statements.
|
|
Which of the following should usually be private? |
Variables (or fields). |
|
Having a this reference allows: |
A) a method to refer explicitly to the instance variables and other methods of the object on which the method was called All of the above. |
|
A class within a package must be declared public if |
It will be used by classes that are not in the same package. |
|
The import declaration import *; ________. |
causes a compilation error. |
|
When should a program explicitly use the this reference? |
Accessing a field that is shadowed by a local variable. |
|
When no access modifier is specified for a method or variable, the method or variable: |
Has package access. |
|
Static class variables: |
are shared by all objects of a class.
|
|
Which of the following is false? |
Objects are marked for garbage collection by method finalize. |
|
Instance variables declared final do not or cannot: |
Be modified. |
|
A package is: |
a.A directory structure used to organize classes and interfaces. b.A mechanism for software reuse. c.A group of related classes and interfaces ALL OF THE ABOVE! |
|
Failure to prefix the superclass method name with the keyword super and a dot (.) separator when referencing the superclass’s method causes ________. |
infinite recursion |
|
An advantage of inheritance is that: |
Objects of a subclass can be treated like objects of their superclass. |
|
Superclass methods with this level of access cannot be called from subclasses. |
private |
|
Overriding a method differs from overloading a method because: |
Overridden methods have the same signature. |
|
Using the protected keyword gives a member: |
package access |
|
Which superclass members are inherited by all subclasses of that superclass? |
protected instance variables and methods |
|
Every class in Java, except ________, extends an existing class. |
Object |
|
Which of the following keywords allows a subclass to access a superclass method even when the subclass has overridden the superclass method? |
super |
|
The default implementation of method clone of Object performs a ________. |
shallow copy |
|
When a subclass constructor calls its superclass constructor, what happens if the superclass’s constructor does not assign a value to an instance variable? |
The program compiles and runs because the instance variables are initialized to their default values |
|
Which of the following is a Scanner method? |
nextLine |
|
Which of the following is not a Java keyword? |
next |
|
Which of the following is a valid fully qualified name? |
java.util.Scanner
|
|
Which of the following statements is true? |
Compilers translate high-level language programs into machine language programs. |
|
A(n) ________ enables a program to read data from the user. |
Scanner |
|
Which statement is true? |
Syntax errors are caught by the compiler. Logic errors have effects at execution time. |
|
________ models software in terms similar to those that people use to describe real-world objects. |
Object-oriented design |