JAVA 5-8 Quiz

Ace your homework & exams now with Quizwiz!

By default, Java initializes array elements to ________.

0

Given the following method header, which of these method calls is incorrect?public void displayValue(double x, int y);

All of these would give an error. NOT

Given the following method header, which of these method calls is incorrect?public void displayValue(int x, int y);

All of these would give an error. NOT

If method A calls method B, and method B calls method C, and method C calls method D, when method D finishes, what happens?

Control is returned to method A. NOT

Given the following two-dimensional array declaration, which statement is true?

The numbers array has 6 rows and 9 columns.

For the following code, what would be the value of str[2]?String[] str = {"abc", "def", "ghi", "jkl"};

a reference to the String object containing "ghi"

A ragged array is ________.

a two-dimensional array where the rows have different numbers of columns

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

a value-returning method

All @param tags in a method's documentation must ________.

appear after the general description of the method

A class's responsibilities include ________.

both of these

A constructor ________.

has the same name as the class

In Java, you do not use the new operator when you use a(n) ________.

initialization list

Each array in Java has a public field named ________ that contains the number of elements in the array.

length

A method ________.

may have zero or more parameters

A ________ is a part of a method that contains a collection of statements that are performed when the method is executed.

method body

If numbers is a two-dimensional array, which of the following would give the number of columns in row r?

numbers[r].length

A special variable that holds a value being passed into a method is called a(n) ________.

parameter

Given the following method, which of these method calls is valid?

showProduct(3.3, 55)

Given that String[] str has been initialized, to get a copy of str[0] with all the characters converted to uppercase, you would use the ________ statement.

str[0].toUpperCase();

A(n) ________ is used as an index to pinpoint a specific element within an array.

subscript

A UML diagram does not contain ________.

the object names

Data hiding (which means that critical data stored inside the object is protected from code outside the object) is accomplished in Java by ________.

using the private access specifier on the class fields

A partially filled array is normally used ________.

with an accompanying integer value that holds the number of items stored in the array

A(n) ________ can be thought of as a blueprint that can be used to create a type of ________.

class, object

For the following code, which statement is not true?

The y field is available to code written outside the Circle class.

Class objects normally have ________ that perform useful operations on their data, but primitive variables do not.

methods

A reference variable stores a(n) ________.

string. NOT

In a @return tag statement the description ________.

describes the return value

A class specifies the ________ and ________ that a particular type of object has.

fields, methods

Given the following code, what will be the value of finalAmount when it is displayed?

580.00 NOT


Related study sets

Chapter 9: Physical and cognitive Development in Adoslence

View Set

California: Real Estate Principles - Chapter 22

View Set

Workplace - Corporate Social Responsibility

View Set

Marketing Competitive Advantage Exam

View Set

SB HW Ch 5 Evidence & Documentation

View Set

Chapter 7 Groups & Consumer Behavior

View Set

Chapter 7 Management and Leadership

View Set

Chapter 7: Trust, Justice and Ethics

View Set