Java Chapter 3

¡Supera tus tareas y exámenes ahora con Quizwiz!

Most class data fields are . a. private b. public c. static d. final

a. private

The method with the declaration public static int aMethod(double d) has a method type of . a. static b. int c. double d. You cannot determine the method type.

b. int

All method declarations contain. a. the keyword static b. one or more explicitly named access specifiers c. arguments d. parentheses

d. parentheses

The method public static boolean testValue(int response) returns a. a boolean value b. an int value c. no value d. You cannot determine what is returned.

a. a boolean value

If you use the automatically supplied default constructor when you create an object, a. numeric fields are set to 0(zero) b. character fields are set to blank c. Boolean fields are set to true d. All of these are true.

a. numeric fields are set to 0(zero)

In Java, methods must include all of the following except . a. a declaration b. a call to another method c. curly braces d. a body

b. a call to another method

Which of the following could be the last legally coded line of a method declared as public static int getVal(double sum)? a. return; b. return 77; c. return 2.3; d. Any of these could be the last coded line of the method.

b. return 77;

A method is declared as public static void showResults(double d, int i). Which of the following is a correct method call? a. showResults(double d, int i); b. showResults(12.2, 67); c. showResults(4, 99.7); d. Two of these are correct.

b. showResults(12.2, 67);

The method with the declaration public static char procedure(double d) has a method type of a. public b. static c. char d. double

c. char

A public static method named computeSum() is located in classA. To call the method from within classB, use the statement . a. computeSum(classB); b. classB(computeSum()); c. classA.computeSum(); d. You cannot call computeSum() from within classB.

c. classA.computeSum();

The concept of allowing a class's private data to be changed only by a class's own methods is known as a. structured logic b. object orientation c. information hiding d. data masking

c. information hiding

Which of the following method declarations is correct for a static method named displayFacts() if the method receives an int argument? a. public static int displayFacts() b. public void displayFacts(int data) c. public static void displayFacts(int data) d. Two of these are correct.

c. public static void displayFacts(int data)

If a class is named Student, the class constructor name is a. any legal Java identifier b. any legal Java identifier that begins with S c. Student Constructor d. Student

d. Student

Which of the following is a correct call to a method declared as public static void aMethod(char code)? a. void aMethod(); b. void aMethod('V'); c. aMethod(char 'M'); d. aMethod('Q');

d. aMethod('Q');


Conjuntos de estudio relacionados

Chapter 38 - Agents to Control Blood Glucose Levels PrepU

View Set

Chapter 10: Power politics and Glory

View Set

Individual Life Insurance Contract- Provisions and Options

View Set

Module 2 - Forms of Property Ownership

View Set

Structure and Function of the Kidney

View Set

APHY 102 Ch 20: Blood Vessels Ivy Tech

View Set

NRSG. CH. 27- Skills - Patient Safety

View Set

Private Insurance Plans for Seniors

View Set

Forecasting & Inventory Management Exam #1

View Set

CSE 598 • 6. Social Insects & Collective Computation

View Set