Quiz 4

Ace your homework & exams now with Quizwiz!

True or false? A cast operator must always be used to convert the pointer on the right of an assignment to the pointer type of the left of the assignment.

False

True or false? The values 0 and 1 are the only values that can be assigned directly to a pointer variable.

False

True or false? A pointer can always be assigned to another pointer of the same type.

True

True or false? A pointer to void can be assigned a pointer of any type.

True

True or false? A pointer with the value NULL points to nothing.

True

True or false? Initializing a pointer to 0 is equivalent to initializing a pointer to NULL, but NULL is preferred.

True

True or false? NULL is a symbolic constant defined in the <stdio.h> header file.

True

True or false? Placing a * operator before a pointer dereferences the pointer.

True

True or false? The operand of the unary * operator must be a pointer.

True

True or false? The unary * operator is called the indirection operator or the dereferencing operator.

True

True or false? Variables of all pointer types can be assigned a pointer to void.

True

If an array named arrayName is passed to a function, C automatically passes ___________. a) &arrayName[0] b) arrayName[1] c) arrayName[0] d) *arrayName

a

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

b

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

b

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

c

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

c

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? a) 2003 b) 2006 c) 2012 d) 2024

c

Pointers are variables that contain ___________ as their values. a) strings b) flowlines c) memory addresses d) directions

c

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

c

When a compiler encounters a function parameter for a single-subscripted array of the form int a[], it converts the parameter to a) int a b) int &a c) int * a d) int * const a

c

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

d

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

d

True or false? The unary * operator returns the value of its operand.

false


Related study sets

Chapter 28: Child, Older Adult, and Intimate Partner Violence

View Set

Complete First Page 101 UOE Part 4

View Set

Chapter 12: Aggregate Demand and Aggregate Supply

View Set

3) SALIENT FEATURES OF THE CONSTITUTION

View Set

Chapter 4 Business Ethics and Social Responsibility

View Set

Ch. 20 : Nursing Management: Patients w/ Hematologic Disorders

View Set

Toughy Chapter 18 Pain and Comfort

View Set

ati capstone post study quiz med surg assessment 1

View Set