Exam 7: Arrays

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

If an array named num is dimensioned to hold 10 values,what happens if you write num[100] = 50;?

(Multiple Choice)
4.8/5
(94)

There are several ways to do a compile-time initialization of arrays.All of the following are valid ways EXCEPT ____.

(Multiple Choice)
4.9/5
(88)

You create an array in much the same way you instantiate an object of a user-defined class,by using the new keyword at the time of declaration.

(True/False)
4.8/5
(84)

int [ ] anArray = new int[24]; -Array identifiers are normally defined using a plural noun.

(True/False)
5.0/5
(83)

Arrays can be sent to methods as arguments,and methods can have arrays as their return type.

(True/False)
4.9/5
(79)

for (int i = 0;i < anotherArray.Length;i++) total += i; Using the above declaration along with the for loop,what is stored in total after the program statements are executed?

(Multiple Choice)
4.7/5
(64)

If you use the params parameter type,params must appear both in the formal parameter list of the method heading and in the actual argument list.

(True/False)
4.9/5
(62)

One of the special properties in the Array class is ____________.It returns an int representing the total number of elements in an array.

(Short Answer)
4.8/5
(84)

Given an array declared to hold 100 values,the smallest index that can be used with the array is ____.

(Multiple Choice)
4.7/5
(78)

If an array is to be sent to a method,which of the following is a valid heading for a method?

(Multiple Choice)
4.8/5
(96)

int [ ] anArray = new int[24]; -You can instantiate arrays of user-defined array objects and send in arrays as arguments to methods,but you cannot return arrays from methods.

(True/False)
4.8/5
(86)

BinarySearch( )is ____.

(Multiple Choice)
4.9/5
(88)

int [ ] anArray = new int[24]; -For the above declaration,25 cells are set aside for the array since the first element is referenced by index 0.

(True/False)
4.9/5
(75)

If you try to access the array using a negative index value,____.

(Multiple Choice)
4.9/5
(64)

double [ ] price = new double [ ] {3, 2.2, 4.7, 6.1, 4}; -With the declaration above,price[2] refers to 2.2.

(True/False)
5.0/5
(87)

With parallel arrays,the relationship is established through using the same subscript or index to refer to the elements in both arrays.

(True/False)
4.9/5
(80)

If you do not know the size of the array needed,you can create an array large enough to hold any number of entries and tell users to enter a predetermined sentinel value after they enter the last value.Using this approach:

(Multiple Choice)
4.8/5
(75)

When you use the assignment operator with an array,individual elements are copied to another memory location.

(True/False)
5.0/5
(65)

int [ ] anArray = new int[24]; -Array elements are normally stored in contiguous,side-by-side,memory locations with the first index in all arrays being referenced by index 0.

(True/False)
4.9/5
(90)

Which loop structure can be used to change the contents of the array?

(Multiple Choice)
4.9/5
(61)
Showing 21 - 40 of 75
close modal

Filters

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