Exam 3: Using Classes and Objects

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

Consider the following two lines of code. What can you say about s1 and s2? String s1 = "testing" + "123"; String s2 = new String("testing 123");

Free
(Multiple Choice)
4.8/5
(41)
Correct Answer:
Verified

C

What is the advantage of putting an image in a JLabel instance?

Free
(Multiple Choice)
4.9/5
(40)
Correct Answer:
Verified

A

Java.text's NumberFormat class includes methods that

Free
(Multiple Choice)
4.8/5
(43)
Correct Answer:
Verified

E

Which of the following will yield a pseudorandom number in the range [ -5, +5 ) given the following: Random gen = new Random( );

(Multiple Choice)
4.9/5
(39)

What is the function of the dot operator?

(Multiple Choice)
4.8/5
(30)

You may use the String replace( ) method to remove characters from a String.

(True/False)
5.0/5
(34)

The String class' compareTo method

(Multiple Choice)
4.8/5
(37)

A containment hierarchy is

(Multiple Choice)
4.8/5
(41)

Which properties are True of String objects?

(Multiple Choice)
4.8/5
(37)

In the StringMutation program shown in Listing 3.1, if phrase is initialized to "Einstein" what will Mutation #3 yield if Mutation #1: mutation1 = phrase.concat(".")?

(Multiple Choice)
4.7/5
(36)

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

(True/False)
4.9/5
(47)

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?

(Essay)
4.9/5
(36)

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

(Multiple Choice)
4.8/5
(36)

An API is

(Multiple Choice)
4.8/5
(34)

Write a method to extract the initial from the first name.

(Essay)
4.8/5
(33)

All the methods in the Math class are declared to be static.

(True/False)
4.9/5
(39)

An "alias" is when

(Multiple Choice)
4.9/5
(31)

What is the function of a frame's pack method?

(Multiple Choice)
4.9/5
(30)

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?

(Multiple Choice)
4.8/5
(28)

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

(True/False)
5.0/5
(30)
Showing 1 - 20 of 58
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)