Exam 3: Using Classes and Objects

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

Which of the following expressions correctly compute 5 + 26?

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

D

When two references point to the same object, ________________________________ .

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

C

A special method that is invoked to set up an object during instantiation is called a ___________________.

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

D

When an object variable is declared but it is not assigned a value, it is called a ______________________.

(Multiple Choice)
4.9/5
(41)

The ________________ operator is used to instantiate an object.

(Multiple Choice)
4.8/5
(38)

Which of the following is an invalid way to instantiate a String object?

(Multiple Choice)
4.7/5
(41)

Write a single line that creates a wrapper for an int variable num.

(Short Answer)
4.7/5
(33)

Suppose we have a String object called myString. Write a single line of Java code that will output myString in such a way that all of its characters are uppercase.

(Short Answer)
4.8/5
(31)

Which of the following is a correct declaration of enumerated type for the suits of a deck of cards?

(Multiple Choice)
4.8/5
(50)

Assume that we have a Random object referenced by a variable called generator. Which of the following lines will generate a random number in the range 5-20 and store it in the int variable randNum?

(Multiple Choice)
4.9/5
(37)

Write an expression that will compute the length of the tangent of a right triangle, given one of the non-right angles. You may assume that this value is stored in a variable called angle.

(Short Answer)
4.9/5
(33)

The Math class is part of the java.lang package.

(True/False)
4.8/5
(39)

Explain how variables representing objects and variables representing primitive types are different.

(Essay)
4.9/5
(39)

Write a short program that allows the user to input a positive integer and then outputs a randomly generated integer between 1 and the input number.

(Essay)
4.9/5
(38)

All of the classes contained in the java.util package are automatically included in every Java program.

(True/False)
4.9/5
(40)

The String class _______________________________ .

(Multiple Choice)
4.9/5
(35)

Enumerated types allow a programmer to treat primitive data as objects.

(True/False)
4.9/5
(37)

Write a short program that asks the user to input a string, and then outputs the number of characters in the string.

(Essay)
5.0/5
(33)

Explain what it means for a String object to be immutable. Are there any workarounds for this?

(Essay)
4.8/5
(36)

A variable that is declared as a primitive type stores the actual value of the associated data. A variable that is declared as an object type stores a pointer to the associated object.

(True/False)
4.8/5
(39)
Showing 1 - 20 of 40
close modal

Filters

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