10

Ace your homework & exams now with Quizwiz!

a

What will be the result of executing the following code? int[] x = {0, 1, 2, 3, 4, 5}; a) An array of 6 values ranging from 0 through 5 and referenced by the variable x will be created. b) A compilation error will occur. c) The program will crash when it is executed. d)The value of x[1] will be 0, x[2] will be 0, x[3] will be 0, x[4] will be 0, x[5] will be 0, and x[6] will be 0.

all of these

When an array is passed to a method: a reference to the array is passed it is passed just as an object the method has direct access to the original array All of these

subscript

What do you call the number that is used as an index to pinpoint a specific element within an array? subscript global unique identifier element argument

an array of float values

What will be returned from the following method? public static float[] getValue(int x) A float value An array of float values An integer An array of integers

0

By default, Java initializes array elements with what value? 0 100 1 -1

c

For the following code, what would be the value of str[2]? String[] str = {"abc", "def", "ghi", "jkl"}; a) "ghi" b) "def" c) A reference to the String "ghi" d) A reference to the String "def"

c

If final int SIZE = 15 and int[] x = new int[SIZE], what would be the range of subscript values that could be used with x[]? a) 1 through 15 b) 1 through 14 c) 0 through 14 d) 0 through 15

a

In memory, an array of String objects: a) consists of elements, each of which is a reference to a String object b) is always implemented as a ragged array c) consists of elements, each of which is a String object d) must be initialized when the array is declared

final

It is common practice to use a ________ variable as a size declarator. static reference final boolean

array bounds checking

Java performs ________, which means that it does not allow a statement to use a subscript that is outside the range of valid subscripts for the array. active array sequencing array bounds checking scope resolution binding buffer overrun protection

0

Subscript numbering always starts at what value? 0 1 -1 None of these

long[]

To return an array of long values from a method, use this as the return type for the method. long long[] long[ARRAY_SIZE] []long

33

What will be the value of x[1] after the following code is executed? 27 33 38 49

38

What will be the value of x[1] after the following code is executed? 27 33 38 49

60

What will be the value of x[8] after the following code has been executed? 50 55 60 65

c

What do you normally use with a partially-filled array? a) A class that does nothing but manage the array b) An accompanying parallel array c) An accompanying integer value that holds the number of items stored in the array d)An accumulator

length

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

b

What will be the results of the following code? a) All the values in the array are initialized to 10.0. b) All the values, except the first, are set to 10.0. c) An error will occur when the program runs. d) There will be a compilation error.


Related study sets

Life Insurance Exam Question (Texas)

View Set

D2L Quiz: Dental Materials Chapter 12

View Set

Life insurance policy provisions, options, and riders

View Set

Health Education: Psychological Health (CONTINUED)

View Set

Unit 1: Basic Economic Concepts and Supply & Demand

View Set

Client Pro Midterm Question Chap 1 - 7

View Set