Filters
Question type

Study Flashcards

What is the purpose of the ImageIcon class?

Correct Answer

verifed

verified

The ImageIcon class is used to represent...

View Answer

The Random class' setSeed( ) method allows you to restart the pseudo-random number sequence.

A) True
B) False

Correct Answer

verifed

verified

True

What will be displayed by this command: System.out.println(Math.pow(3, 3-1) ) ;


A) 9
B) 8
C) 6
D) 4
E) 27

F) A) and B)
G) A) and C)

Correct Answer

verifed

verified

In Java a variable may contain


A) a value or a reference
B) a package
C) a method
D) a class
E) any of the above

F) B) and E)
G) B) and D)

Correct Answer

verifed

verified

Given two String variables, s1 and s2, is it possible for (s1 != s2) to be True while (s1.equals(s2)) is also True? Why or why not?

Correct Answer

verifed

verified

The condition (s1 != s2) means that s1 a...

View Answer

Consider the following enumeration enum Speed { FAST, MEDIUM, SLOW };


A) The ordinal value of MEDIUM is 2
B) The ordinal value of SLOW is 1
C) The name of the Speed enumeration whose ordinal value is zero is FAST
D) The name of the Speed enumeration whose ordinal value is one is SLOW
E) None of the above

F) All of the above
G) A) and E)

Correct Answer

verifed

verified

You may apply the prefix and postfix increment and decrement operators to instances of the Integer class.

A) True
B) False

Correct Answer

verifed

verified

Autoboxing is


A) the automatic conversion of a wrapper object to/from its corresponding primitive type
B) the automatic enclosure of a graphics object within a bounding box
C) the automatic widening of ints into floats or doubles, as required
D) the automatic conversion of an enumeration into its numeric representation
E) none of the above

F) A) and D)
G) B) and D)

Correct Answer

verifed

verified

A JPanel can be added to a JFrame to form a GUI. In order to place other GUI components such as JLabels and Buttons into the JFrame, which of the following messages is passed to the JPanel?


A) insert
B) include
C) get
D) getContentPane
E) add

F) A) and D)
G) B) and E)

Correct Answer

verifed

verified

What happens if you attempt to use a variable before it has been initialized?


A) A syntax error may be generated by the compiler
B) A runtime error may occur during execution
C) A "garbage" or "uninitialized" value will be used in the computation
D) A value of zero is used if a variable has not been initialized
E) Answers A and B are correct

F) A) and D)
G) B) and D)

Correct Answer

verifed

verified

Why does one set up a containment hierarchy?

Correct Answer

verifed

verified

It is common to use multiple layers of n...

View Answer

Consider the condition (x == y). How is this handled if x and y are primitive types? How is this handled if x and y are objects?

Correct Answer

verifed

verified

If x and y are primitive types, then the...

View Answer

Only difficult programming problems require a pseudocode solution before the programmer creates the implementation (program) itself.

A) True
B) False

Correct Answer

verifed

verified

What is the function of the dot operator?


A) It serves to separate the integer portion from the fractional portion of a floating point number
B) It allows one to access the data within an object when given a reference to the object
C) It allows one to invoke a method within an object when given a reference to the object
D) It is used to terminate commands (much as a period terminates a sentence in English)
E) Both B and C are correct

F) A) and D)
G) A) and C)

Correct Answer

verifed

verified

In Java, "instantiation" means


A) noticing the first time something is used
B) creating a new object of the class
C) creating a new alias to an existing object
D) launching a method
E) none of the above

F) All of the above
G) A) and E)

Correct Answer

verifed

verified

The names of the wrapper classes are just the names of the primitive data types, but with an initial capital letter.

A) True
B) False

Correct Answer

verifed

verified

False

What is autoboxing?

Correct Answer

verifed

verified

Autoboxing provides automatic conversions between primitive values and corresponding wrapper objects. It makes your code shorter by relieving you of the need to provide explicit wrapping of primitive values and explicit extraction of primitive values. For the questions below: Assume an interactive Java program which asks the user for their first name and last name, and outputs the user's initials.

When comparing any primitive type of variable, == should always be used to test to see if two values are equal.

A) True
B) False

Correct Answer

verifed

verified

These two ways of setting up a string yield identical results: a) String string = new String("string"); b) String string = "string";

A) True
B) False

Correct Answer

verifed

verified

Write a statement using a Scanner method to get the first name interactively.

Correct Answer

verifed

verified

firstName ...

View Answer

Showing 1 - 20 of 58

Related Exams

Show Answer