Java final

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

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

A partially filled array is normally used __________.

subscript

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

False

An array can hold multiple values of several different types of data simultaneously.

the account object's toString method will be implicitly called.

Assume the class BankAccount has been created and the following statement correctly creates an instance of the class.

True

Declaring an array reference variable does not create an array

length

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

a reference to the String object containing "ghi"

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

numbers[r].length

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

for (int row = 0; row < numbers.length; row++) { for (int col = 0; col < numbers[row].length; col++) total += numbers[row][col]; }

If numbers is a two-dimensional int array that has been initialized and total is an int that has been set to 0, which of the following will sum all the elements in the array?

initialization list

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

True

Once an array is created, its size cannot be changed.

0

Subscripting always starts with __________.

arrays size indicator

The __________ indicates the number of elements the array can hold.

remove

The __________ method removes an item from an ArrayList at a specific index.

will cut the portion of the array being searched in half each time it fails to locate the search value

The binary search algorithm __________.

It specifies that only String objects may be stored in the ArrayList object.

What does <String> specify in the following statement? ArrayList<String> nameList = new ArrayList<String ();

a = 5

What will be the results after the following code is executed? int[] x = { 55, 33, 88, 22, 99, 11, 44, 66, 77 }; int a = 10; if(x[2] > x[5]) a = 5; else a = 8;

180

What will be the value of x[8] after the following code is executed?

x[] = {36, 78, 12, 24} and y[] = {36, 78, 12, 24}

What would be the result after the following code is executed? int[] x = {23, 55, 83, 19}; int[] y = {36, 78, 12, 24}; x = y; y = x;

the method does not have access to the original array

When an individual element of an array is passed to a method __________.

add

Which of the following ArrayList class methods is used to insert an item at a specific location in an ArrayList?

set

You can use the __________ method to replace an item at a specific location in an ArrayList.

has a

____ is the term for the relationship created by object aggregation.

enum

a decleration for an enumerated type begins with the ___ key word

state

an objects ___ is simply the data that is stored in the objects field at any given moment.

a reference to an object of that class

when a method's return type is a class, what is actually returned to the calling program?

the method has access to the object that the variable references

when a reference variable is passed as an argument to a method

it must be the first statement in the constructor making the call

when the this variable is used to call a constructor

you are performing a deep copy

when you make a copy of the aggregate object and of the objects that it references ___

they are called from an instance of the class

which of the following is not true about static methods

The code contains a syntax error and will not compile.

What will be the result after the following code is executed? final int ARRAY_SIZE = 5; float[] x = float[ARRAY_SIZE]; for (i = 1; i <= ARRAY_SIZE; i++) { x[i] = 10.0; }

write a method for the class that will make a field by field copy of object1 data

if object1 and object2 are objects of the same class, to make object2 a copy of object1

any of these

in java it is possible to write a method that will return

they cannot refer to nonstatic members of the class

the only limitation that static methods have is ___

write an equals method that will make a field by field compare of the two objects

to compare two objects in a class, ___

objects

you cannot use the == operator to compare the contents of

1

given the following decleration: enum Tree (OAK, MAPLE, PINE) What is the ordinal value of the MAPLE enum constant?

Tree.PINE

given the following decleration: enum Tree (OAK, MAPLE, PINE) what is the fully-qualified name of the PINE enum constant?

this is a public method named add that accepts and returns references to objects in the Stock class

if the following is from the method section of a UML diagram, which of the statements below is true? + add(object2:Stock) : Stock

this is a public method that accepts a Stock object as it's argument and returns a boolean value

if the following is from the method section of the UML diagram, which of the statements below is true? + equals (object2:Stock) : boolean

the program will terminate

if you attempt to perform an operation with a null reference variable ___

whole part relationship

the "has a" relationship is sometimes called a(n) ___ because one object is part of a greater whole

is used to locate a specific item in a collection of data

A search algorithm __________.

False

A sorting algorithm is used to locate a specific item in a larger collection of data

ordinal

enumerated types have the ___ method which returns the position of an enum constant in the declaration list


संबंधित स्टडी सेट्स

All of AP Euro Sets (Duncan's sets Combined)

View Set

AP Art History Exam May 2019 (ALL 250 PIECES)

View Set

BIO 103 Test Your Knowledge Chapter 19

View Set

NURS 204 - Exam 3 - Chapters 61, 62, and 63

View Set

Ch. 13 Nutrition, Ch. 11 Nutrition, Chapter 12 - nurtition, NUtrition Chp 13, exam 11-13

View Set

Taylor Fundamentals of Nursing Chapter 43- Loss, Grief, and Dying

View Set

Chp 13 - Employee Benefits: Retirement Plans

View Set