CMPE 30 - Chapter 7 Quiz

Ace your homework & exams now with Quizwiz!

The __________, or address operator, is a unary operator that returns the address of its operand. % * & &&

&

If array name arrayName is passed to a function, C automatically passes __________. &arrayName[0] arrayName[1] arrayName[0] *arrayName

&arrayName[0]

Assuming that t is an array and tPtr is a pointer to that array, what expression refers to the address of element 3? &t[3] tPtr[3] (t + 3) (tPtr + 3)

&t[3]

If bPtr is assigned b (the name of an array), then array element b[3] can alternatively be referenced with the pointer expression __________. b[bPtr + 3] *(bPtr + 3) b [bPtr + 3] bPtr + 3

*(bPtr + 3)

Three of the following expressions have the same value. Which of the following's value is different from the others? *Ptr Ptr *&Ptr &*Ptr

*Ptr

Which of the following can have a pointer as an operand? % += / ++

++

Given that k is an integer array starting at location 2000, kPtr is a pointer to k, and each integer is stored in 4 bytes of memory, what location does kPtr + 3 point to? 2003 2012 2006 2024

2012

Which statement is false? In C, programmers use pointers and the indirection operator to simulate call-by-reference. Call-by-reference enables a called function to modify variables in the calling function. All function calls in C pass arguments call-by-value. Call-by-value is always more efficient than call-by-reference.

Call-by-value is always more efficient than call-by-reference.

A pointer cannot be assigned to any other pointer by using the cast operator a pointer to void another pointer of the same type a pointer of a type other than its own type and void

a pointer of a type other than its own type and void

When calling a function with arguments that should be modified, the __________ of those arguments are passed. memory values addresses complements

addresses

The statement y = &yPtr; assigns the address of the variable y to pointer variable yPtr. assigns the address of the variable yPtr to pointer variable y. is a logic error. is a compilation error.

assigns the address of the variable yPtr to pointer variable y.

Pointers may be assigned which of the following? an address NULL all integer values both (b) and (c)

both (b) and (c)

A string array can only provide access to strings of a certain length is always less memory efficient than an equivalent double-subscripted array stores an actual string in each of its elements is actually an array of pointers

is actually an array of pointers

Pointers are variables that contain __________ as their values. strings directions flowlines memory addresses

memory addresses

Pointers cannot be used to reference values directly. manipulate dynamic data structures. find the address of a variable in memory. simulate call-by-reference.

reference values directly.

sizeof returns the total number of elements in an array usually returns a double returns the total number of bytes in an array is a binary operator

returns the total number of bytes in an array

Which of the following gives the number of elements in the array int r[]? sizeof (*r) / sizeof (int) sizeof (r) sizeof (*r) sizeof (r) / sizeof (int)

sizeof (r) / sizeof (int)

A pointer to a function contains __________. the address of the function's automatic variables the address of the function on the stack the address of the function in memory the address of the entry for that function in the System Function Table

the address of the function in memory

An expression such as sizeof(arrayName) / sizeof(double) might typically be used to determine the number of elements in half an array the number of elements in an array the size of an element of an array the size of an array

the number of elements in an array

Comparing pointers and performing arithmetic on them is meaningless unless they point to arrays of the same type they point to different locations they point to members of the same array they point to arrays of equal size

they point to members of the same array


Related study sets

Introductory Chemistry Quiz and Exam Answers

View Set

Muskuloskeletal Imaging, Breast, & Superficial Structures

View Set