Exam 5: Methods

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

Assume that the following method header is for a method in class A. public void displayValue(int value) Assume that the following code segments appear in another method, also in class A. Which contains a legal call to the displayValue method?

(Multiple Choice)
4.8/5
(45)

When writing the documentation comments for a method, you can provide a description of each parameter by using a:

(Multiple Choice)
4.8/5
(29)

The lifetime of a method's local variable is:

(Multiple Choice)
4.9/5
(44)

When you pass an argument to a method, be sure that the argument's data type is compatible with:

(Multiple Choice)
4.7/5
(43)

A value-returning method must specify this as its return type in the method header.

(Multiple Choice)
4.9/5
(39)

Which of the following values can be passed to a method that has an int parameter variable?

(Multiple Choice)
4.7/5
(32)

All @param tags in a method's documentation comment must:

(Multiple Choice)
4.9/5
(37)

What will be returned from the following method? Public static int methodA() { Double a = 8.5 + 9.5; Return a; }

(Multiple Choice)
5.0/5
(40)

In the following code, Integer.parseInt(str), is an example of: int num; String str = "555"; Num = Integer.parseInt(str) + 5;

(Multiple Choice)
4.9/5
(41)

You must have a return statement in a value-returning method.

(True/False)
4.8/5
(40)

Given the following method header, which of the method calls would be an error? Public void displayValues(double x, int y)

(Multiple Choice)
4.7/5
(38)

Any method that calls a method with a throws clause in its header must either handle the potential exception or have the same throws clause.

(True/False)
4.8/5
(37)

A value-returning method can return a reference to a non-primitive type.

(True/False)
4.9/5
(38)

A parameter variable's scope is the method in which the parameter is declared.

(True/False)
4.8/5
(29)

This type of method performs a task and sends a value back to the code that called it.

(Multiple Choice)
4.7/5
(42)

This part of a method is a collection of statements that are performed when the method is executed.

(Multiple Choice)
4.9/5
(37)

Two general categories of methods are void methods and value returning methods.

(True/False)
4.9/5
(38)

Local variables can be initialized with:

(Multiple Choice)
4.7/5
(23)

When an object, such as a String, is passed as an argument, it is:

(Multiple Choice)
4.9/5
(40)

Breaking a program down into small manageable methods:

(Multiple Choice)
4.7/5
(32)
Showing 21 - 40 of 60
close modal

Filters

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