Quiz 8

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

A

A pointer can be used as a function argument, giving the function access to the original argument. A. True B. False

A

Dynamic memory allocation occurs A. when a new variable is created at runtime B. when a new variable is created by the compiler C. none of the answers D. when a pointer is assigned an incorrect address E. when a pointer fails to dereference the right variable

C

With pointer variables you can __________ manipulate data stored in other variables. A. never B. none of the answers C. indirectly D. directly E. seldom

B

With pointer variables, you can access but not modify data in other variables. A. True B. False

E

The __________, also known as the address operator, returns the memory address of a variable. A. none of the answers B. exclamation point ( ! ) C. percent sign ( % ) D. asterisk ( * ) E. ampersand ( & )

B

Use the delete operator only on pointers that were A. dereferenced inappropriately B. created with the new operator C. never used D. not correctly initialized E. none of the answers

D

When the less than operator (<) is used between two pointer values, the expression is testing whether A. the value pointed to by the first is greater than the value pointed to by the second B. the value pointed to by the first is less than the value pointed to by the second C. the first variable was declared before the second variable D. the address of the first variable comes before the address of the second variable in the computer's memory E. none of the answers

B

When you work with a dereferenced pointer, you are actually working with A. a copy of the value pointed to by the pointer variable B. the actual value of the variable whose address is stored in the pointer variable C. none of the answers D. the pointer values E. a variable whose memory has been allocated

E

Which of the following defines a unique_ptr named uniq that points to a dynamically allocated int? A. unique_ptr<uniq> int( new int ); B. none of the answers C. unique_ptr<uniq> uniq( new int ); D. unique_ptr<int> int( new uniq ); E. unique_ptr<int> uniq( new int );

B

Which of the following statements is invalid C++ code? A. int ptr = &num1; B. All of these are invalid C. int ptr = int *num1; D. string str = &(0x1736FCA8) E. float num1 = &ptr2;


Ensembles d'études connexes

Processes that Shape the Coastline

View Set

USA Differential Diagnosis Exam #1 (Chapters 1-8)

View Set