CSI 1103 - Chapter 12

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

True or False: Given the declaration int *p; The statement p = new int[50]; dynamically allocates an array of 50 components of type int and p contains the base address of the array.

True

True or False: A pointer variable is a variable whose content is a memory address.

True

True or False: If p is a pointer variable, the statement p = p + 1; is valid in C++.

True

True or False: The dereferencing operator is also known as the indirection operator and refers to the object to which its operand points.

True

The statement int *p; is equivalent to int * p;, which is also equivalent to the statement ____________________.

int* p;

Consider the following statement: ptrMemberVarType objectThree(objectOne); The values of the member variables of objectOne are being copied into the corresponding member variables of objectThree. This initialization is called the ____.

member-wise initialization

The C++ operator ____ is used to create dynamic variables.

new

Which of the following can be used to initialize a pointer variable? '0' nullptr 1 "0"

nullptr

Consider the following statements:void pointerParameters(int* &p, double *q){...}In the function pointerParameters, the parameter q is a(n) ____________________ parameter.

value

The copy constructor automatically executes when, as a parameter, an object is passed by ____________________.

value

In C++, virtual functions are declared using the reserved word ____.

virtual

The ____________________ of a base class automatically makes the destructor of a derived class virtual.

virtual destructor

True or False: In the statement int* p, q; p and q are pointer variables.

False

True or False: In C++, pointer variables are declared using the reserved word pointer.

False

True or False: In C++, the dot operator has a lower precedence than the dereferencing operator.

False

True or False: In C++, the member access operator arrow is >>.

False

True or False: Variables that are created during program execution are called static variables.

False

In C++, ____ is called the address of operator.

&

In C++, you declare a pointer variable by using the ____ symbol.

*

The statement that declares board to be an array of six pointers wherein each pointer is of type int is: int ____________________;

*board[6]

What is the output of the following code? int *p; int x; x = 12; p = &x; cout << x << ", "; *p = 81; cout << *p << endl;

12, 81

What is the output of the following statements? int x = 33; int *q; q = &x; cout << *q << endl;

33

What is the output of the following code? int *p; int x; x = 76; p = &x; *p = 43; cout << x << ", " << *p << endl;

43, 43

What is the value of x after the following statements execute? int x = 25; int *p; p = &x; *p = 46;

46

Which of the following operations is allowed on pointer variables? == % exp /

==

Which of the following arithmetic operations is allowed on pointer variables? Modulus Increment Division Multiplication

Increment

The code int *p; declares p to be a(n) ____ variable.

Pointer

Consider the following statements: class shape { public:virtual void draw() = 0; virtual void move(double x, double y) = 0; . . . }; The code above is an example of a(n) ____________________ class definition.

abstract

The ____ operator can be used to return the address of a private data member of a class.

address of

The ____ constructor is executed when an object is declared and initialized by using the value of another object.

copy

In a ____ copy, two or more pointers have their own data.

deep

The C++ operator ____ is used to destroy dynamic variables.

delete

A class ____ automatically executes whenever a class object goes out of scope.

destructor

An array created during the execution of a program is called a(n) ____ array.

dynamic

Run-time binding is also known as ____ binding.

dynamic

Given the statement double *p;, the statement p++; will increment the value of p by ____ byte(s).

eight

The binding of virtual functions occurs at program ____________________ time.

execution

Given the declaration int *a;, the statement a = new int[50]; dynamically allocates an array of 50 components of the type ____.

int

Consider the following statements: void pointerParameters(int* &p, double *q) { . . . } In the function pointerParameters, the parameter p is a(n) ____________________ parameter.

reference

Which of the following would be appropriate syntax for the heading of a copy constructor for a class called rulerType? rulerType() copy rulerType(int inches, int centimeters) rulerType(int inches, int centimeters) rulerType(const rulerType& myRuler)

rulerType(const rulerType& myRuler)

In a ____ copy, two or more pointers of the same type point to the same memory.

shallow

In ____ binding, the necessary code to call a specific function is generated by the compiler.

static

Consider the following declaration of a struct: struct studentType { char name[26]; double gpa; int sID; char grade; }; studentType student; studentType *studentPtr; The statement (*studentPtr).gpa = 2.5; is equivalent to ___________________ = 2.5;.

studentPtr->gpa

True or False: A memory leak is an unused memory space that cannot be allocated.

true


Ensembles d'études connexes

COMS 126 Critical Thinking and Everyday Argument Ch 1-3, 9-10, 12, 14 Terms Cal Poly SLO

View Set

Chapter 15 Using Communication Skills As You Enter the Workplace

View Set

Macroeconomics Exam 1 (ECON3070)

View Set

Parallel lines cut by a Transversal

View Set

Chapter 13 Treatment of Psychological Disorders

View Set

PrepU Ch. 65: Assessment of Neurological Function

View Set

Scripting and Programming - Foundations - C173 (Unit 8)

View Set

NCLEX Practice Questions HURST REVIEW (Fundamentals)

View Set