Exam 11: Arrays, Addresses, and Pointers

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

Pointers ____ be initialized when they are declared.

(Multiple Choice)
4.7/5
(32)

Access to an array using a subscript can always be replaced by an equivalent access using the array name as a pointer.

(True/False)
4.7/5
(48)

You can replace lines 5 and 6 in the following function with ____. 1 /* copy string2 to string1 */ 2 void strcopy(char string1[], char string2[]) 3 { 4 int i = 0; 5 while (string1[i] = string2[i]) 6 i++; 7 }

(Multiple Choice)
4.8/5
(33)

The following code is valid in C: char *message; strcpy(message,"abcdef");

(True/False)
4.9/5
(34)

A suitable equivalent to the function header calc(int pt[2][3]) is ____.

(Multiple Choice)
4.9/5
(36)

When working with pointers, the ____ tells the number of variables that are to be skipped over.

(Multiple Choice)
4.9/5
(26)

After creating two variables as follows: Char message1[81] = "this is a string"; Char *message2 = "this is a string"; The statement ____ is not valid in C.

(Multiple Choice)
4.8/5
(39)

One advantage of using subscripts for array processing is that they are more efficient than using pointers directly.

(True/False)
4.8/5
(41)

Offsets may be included in expressions using pointers.

(True/False)
4.8/5
(32)

The address stored in the array name cannot be changed by an assignment statement.

(True/False)
4.9/5
(42)

When adding or subtracting numbers to pointers, the computer automatically adjusts the number to ensure that the result still "points to" a value of the original data type.

(True/False)
4.9/5
(48)

In performing ____ on pointers, we must be careful to produce addresses that point to something meaningful.

(Multiple Choice)
4.8/5
(39)

The addresses in pointers can be compared using any of the relational operators (==, !=, <, >, etc.) that are valid for comparing other variables.

(True/False)
4.8/5
(42)

A pointer access can sometimes (but not always) be replaced using subscript notation.

(True/False)
4.9/5
(37)

If we store the address of grade[0] in a pointer named gPtr (using the assignment statement gPtr = &grade[0];), then, the expression ____ references grade[0].

(Multiple Choice)
4.9/5
(33)

Pointers are closely associated with array names.

(True/False)
4.8/5
(42)

int *ptNum = &miles; is ____.

(Multiple Choice)
4.8/5
(33)

Pointers, both as variables and function parameters, are used to store addresses.

(True/False)
4.8/5
(49)

Instead of initially creating a string as an array it is possible to create a string using a pointer.

(True/False)
4.7/5
(33)

The address operator in C is ____.

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

Filters

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