Exam 4: More Object Concepts

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

____ involves using one term to indicate diverse meanings, or writing multiple methods with the same name but with different parameter lists.

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

B

When an object of one class is a data field within another class, they are related by ____.

Free
(Multiple Choice)
4.7/5
(34)
Correct Answer:
Verified

C

Describe a block and define an outer block and an inner block.

Free
(Essay)
4.8/5
(38)
Correct Answer:
Verified

Within any class or method, the code between a pair of curly braces is called a block. An outer block begins at the first opening curly brace and ends at the last closing curly brace, at the end of a method. The inner block starts with the second opening curly brace and ends with the first closing curly brace.

A(n) ____________________ begins immediately after the method declaration and ends at the end of the method.

(Short Answer)
4.9/5
(47)

You can use ____ arguments to initialize field values, but you can also use arguments for any other purpose.

(Multiple Choice)
4.8/5
(42)

____ variables are variables that are shared by every instantiation of a class.

(Multiple Choice)
4.7/5
(37)
Match each term with the correct statement below.
Using one term to indicate diverse meanings
constant
Created using the keyword final
class methods
Useful when working with dates and times
optional classes
Correct Answer:
Verified
Premises:
Responses:
Using one term to indicate diverse meanings
constant
Created using the keyword final
class methods
Useful when working with dates and times
optional classes
No object associated with them
Math class
A variable comes into existence
Java.time
Starts with the second opening curly brace and ends with the first closing
curly brace
composition
Must be explicitly named in an import statement
overloading
Defines mathematical constants such as PI
inner block
Describes the relationship between classes when an object of one class is a data field within another class
comes into scope
(Matching)
4.9/5
(31)

List and describe the four types of nested classes.

(Essay)
4.9/5
(44)

   In the above code, what happens to the value of aNumber when the main() method is executed? What happens to the value of aNumber when the firstMethod and secondMethod methods are executed? In the above code, what happens to the value of aNumber when the main() method is executed? What happens to the value of aNumber when the firstMethod and secondMethod methods are executed?

(Essay)
4.8/5
(35)

   In the above code, what would happen if calculateInterest was passed the values of 100 for the bal and .10 for the interest rate? What would happen if calculateInterest was passed the values of 100 for the bal and 10 for the interest rate? Why is it a problem when these values are passed to the calculateInterest method, and what would be a possible solution to fix the problem? In the above code, what would happen if calculateInterest was passed the values of 100 for the bal and .10 for the interest rate? What would happen if calculateInterest was passed the values of 100 for the bal and 10 for the interest rate? Why is it a problem when these values are passed to the calculateInterest method, and what would be a possible solution to fix the problem?

(Essay)
4.8/5
(34)

A(n) ____________________ is simply a folder that provides a convenient grouping for classes.

(Short Answer)
4.8/5
(37)

Fields declared to be static are not always final .

(True/False)
4.8/5
(25)

Another name for a nonstatic member class is a(n) ____.

(Multiple Choice)
4.9/5
(36)

A disadvantage of Java is the large memory requirements to store a separate copy of each variable and method for each instantiation of a class.

(True/False)
4.9/5
(30)

   In the above code, if the simpleMethod() method received a double or integer value, the resulting output is Method receives double parameter. Explain how Java can promote one data type to another when a parameter is passed to a method. In the above code, if the simpleMethod() method received a double or integer value, the resulting output is "Method receives double parameter". Explain how Java can promote one data type to another when a parameter is passed to a method.

(Essay)
4.8/5
(34)

What is the difference between class variables and instance variables?

(Essay)
4.9/5
(35)

Within any class or method, the code between a pair of curly braces is called a(n) ____.

(Multiple Choice)
4.8/5
(44)

The reference to an object that is passed to any object's nonstatic class method is called the ____.

(Multiple Choice)
4.8/5
(36)

A block can exist entirely within another block or entirely outside and separate from another block, and sometimes blocks can overlap.

(True/False)
4.8/5
(31)

A method can receive ____ arguments, even if it is defined as needing double arguments.

(Multiple Choice)
4.9/5
(34)
Showing 1 - 20 of 66
close modal

Filters

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