Exam 11: Arrays, Addresses, and Pointers

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

If gPtr is a pointer that points to the first element of an integer array (and each integer requires four bytes of storage), *(gPtr + 4 * 4) references the variable that is four integers beyond the variable pointed to by gPtr.

Free
(True/False)
4.9/5
(42)
Correct Answer:
Verified

False

If nums is a two-dimensional integer array, *(*(nums + 2) + 1) refers to element nums[1][2].

Free
(True/False)
4.8/5
(38)
Correct Answer:
Verified

False

Consider the declarations Int nums[100]; Int *nPtr; The statement ____ produces the same result as nPtr = nums;.

Free
(Multiple Choice)
4.9/5
(41)
Correct Answer:
Verified

A

If numPtr is declared as a pointer variable, the expression ____ can also be written as numPtr[i].

(Multiple Choice)
4.8/5
(31)

Assuming grade is an array of ten integers, the statement ____ is invalid.

(Multiple Choice)
4.8/5
(34)

If nums is a two-dimensional integer array, ____ refers to element nums[1][0].

(Multiple Choice)
4.9/5
(32)

The parentheses in the pointer expression *(gPtr + 3) are not necessary to access the desired array element correctly.

(True/False)
4.9/5
(32)

If nums is a two-dimensional integer array, ____ refers to element nums[0][0].

(Multiple Choice)
4.9/5
(36)

The declaration char *seasons[4]; creates an array of four elements, where each element is a pointer to a character.

(True/False)
5.0/5
(34)

Of the following expressions, ____ is the most commonly used. This is because such an expression allows each element in an array to be accessed as the address is "marched along" from the starting address of the array to the address of the last array element.

(Multiple Choice)
4.9/5
(42)

Any subscript used by a programmer is automatically converted to an equivalent pointer expression by the compiler.

(True/False)
4.9/5
(31)

The expression ____ adds 3 to "the variable pointed to by gPtr."

(Multiple Choice)
4.9/5
(35)

The header line ____ declares calc to be a pointer to a function that returns an integer.

(Multiple Choice)
4.8/5
(38)

When an array is passed to a function, the array address is the only item actually passed.

(True/False)
4.9/5
(43)

Attempting to assign the address of an array name is invalid.

(True/False)
4.9/5
(29)

When working with pointers and offsets, the correspondence between the number of bytes and number of variables is not handled by the compiler, so you must perform the conversions yourself.

(True/False)
4.7/5
(29)

A pointer constant is equivalent to a symbolic constant, in that the address stored in the pointer constant cannot be changed once it is set.

(True/False)
4.9/5
(38)

Consider the following declarations of a function that receives an array of integers and finds the element with the maximum value: (i) findMax(int *vals, int numEls) (ii) findMax(int vals[], int numEls) The address in vals may be modified ____.

(Multiple Choice)
4.9/5
(41)

Addresses cannot be incremented or decremented using prefix or postfix increment and decrement operators.

(True/False)
4.9/5
(33)

When initializing pointers you must be careful to set an address in the pointer.

(True/False)
4.9/5
(49)
Showing 1 - 20 of 49
close modal

Filters

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