CSC240

Ace your homework & exams now with Quizwiz!

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

*board[6]

The following statement creates alpha to be a two-dimensional array with ____________________ rows. int alpha[10][25];

10

The declaration char str[] = "Hello there"; declares str to be a string of ____________________ characters.

12

The statement strlen("Marylin Stewart"); returns ____________________.

15

The following statements store the value ____________________ into len. int len; len = strlen("Sunny California");

16

In the following declaration, the array gamma has ____________________ components. int gamma[5][6][10];

300

The following statement defines a struct houseType with a total of ____________________ member(s). struct houseType { string style; int numOfBedrooms; int numOfBathrooms; int numOfCarsGarage; int yearBuilt; };

5

A friend function does not have access to the private data members of the class.

F

A function can return a value of the type array.

F

Aggregate input/output operations are allowed on a struct variable.

F

Given the declaration int list[20]; the statement list[12] = list[5] + list[7]; updates the content of the twelfth component of the array list.

F

If an object is created in a user program, then the object can access both the public and private members of the class.

F

If the heading of a member function of a class ends with the word const, then the function member cannot modify the private member variables, but it can modify the public member variables.

F

In C++, pointer variables are declared using the reserved word pointer.

F

In C++, the dot operator has a lower precedence than the dereferencing operator.

F

In C++, the member access operator arrow is >>.

F

In structs, you access a component by using the struct name together with the relative position of the component.

F

In the statement int* p, q; p and q are pointer variables.

F

Operator functions typically return void

F

Relational operations can be used on struct variables.

F

Suppose list is a one dimensional array of size 25, wherein each component is of type int. Further, suppose that sum is an int variable. The following for loop correctly finds the sum of the elements of list. sum = 0; for (int i = 0; i < 25; i++) sum = sum + list;

F

The declaration of a friend function cannot be placed within the private part of the class.

F

Variables that are created during program execution are called static variables.

F

When writing the definition of a friend function, the name of the class and the scope resolution operator precede the name of the friend function in the function heading.

F

You can use arithmetic operators to perform arithmetic operations on class objects.

F

The array index can be any integer less than the array size

False

The statement int list[25]; declares list to be an array of 26 components, since the array index starts at 0

False

A class is an example of a structured data type.

T

A function can return a value of the type struct.

T

A memory leak is an unused memory space that cannot be allocated.

T

A pointer variable is a variable whose content is a memory address.

T

Both parameters of the function to overload the operator << are reference parameters.

T

Data in a struct variable must be read one member at a time.

T

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.

T

If an object is declared in the definition of a member function of the class, then the object can access both the public and private members of the class.

T

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

T

In C++ terminology, a class object is the same as a class instance.

T

In C++, >> is used as a stream extraction operator and as a right shift operator.

T

In C++, class is a reserved word and it defines only a data type.

T

In C++, operator is a reserved word.

T

Most operator functions can either be member functions or nonmember functions of a class.

T

Operators can be overloaded either for objects of the user-defined types, or for a combination of objects of the user-defined type and objects of the built-in type.

T

The associativity of the operator = is from right to left.

T

The contents of a struct variable must be written one member at a time.

T

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

T

You can declare struct variables when you define a struct.

T

You can use an assignment statement to copy the contents of one struct into another struct of the same type.

T

You can use the assignment statement on structs.

T

All components of an array are of the same data type

True

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

Once a class contains one or more pure virtual functions, then that class is called a(n) ____________________ class.

abstract

Consider the following statements: int x; int &y = x; The second statement declares y to be a(n) ____________________ of x.

alias

The ____________________ operator causes a member-wise copy of the member variables of the class.

assignment

With the exception of the ____________________ operator and the member selection operator, operators must be overloaded to be used on class objects.

assignment

The ____________________ of an array is the address (that is, the memory location) of the first array component.

base address

The ____________________ operator function as a member of a class has only one parameter; as a nonmember of a class, it has two parameters.

binary

The header file string contains the function ____________________,which converts a value of type string to a null-terminated character array.

c_str

Passing a parameter to a class template has an effect at ____________________ time.

compile

The word ____________________ is used before the array declaration in a function heading to prevent the function from modifying the array.

const

A(n) ____________________ constructor converts its argument to an object of the constructor's class.

conversion

Classes with pointer member variables must include the ____________________ constructor.

copy

Memory is allocated for struct variables only when you ____________________ them

declare

A struct is a(n) ____________________, not a declaration.

definition

For classes with pointer member variables, you should include the copy constructor and the ____________________ in the class.

destructor

The binding of virtual functions occurs at program ____________________ time.

execution

Arrays can be passed as parameters to a function by value, but it is faster to pass them by reference.

f

If an array index goes out of bounds, the program always terminates in an error

f

An object of the base class type cannot be passed to a(n) ____________________ parameter of the derived class type.

formal

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

int* p;

A(n) ____________________ is a set of elements of the same type.

list

Consider the following struct definition: const int ARRAY_SIZE = 1000; struct listType { int listElem[ARRAY_SIZE]; int listLength; }; The statement that declares intList to be a struct variable of type listType is ____________________.

listType intList;

The only built-in operations on classes are assignment (=) and ____________________.

member selection

In C++, a function ____________________ can be overloaded.

name

The operator function that overloads the insertion operator, <<, or the extraction operator, >>, for a class must be a(n) ____________________ function of that class.

nonmember

The copy constructor automatically executes when the return value of a function is a(n) ____________________.

object

Any function that overloads an operator is called a(n) ____________________ function.

operator

Two (or more) arrays are called ____________________ if their corresponding components hold related information.

parallel

A class template is called a(n) ____________________ type because it specifies how a generic class template is to be customized to form a specific template class.

parameterized

The ____________________ members of a class are local to the class and, therefore, cannot be accessed outside of the class.

private

Arrays are passed by ____________________ only.

reference

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

reference

If a variable is passed by ____________________, then when the formal parameter changes, the actual parameter also changes.

reference

In C++, struct is a(n) ____________________ word

reserved

Complete the following statement so that it outputs the array sales. double sales[10]; int index; for (index = 0; index < 10; index++) cout << ____________________ << " ";

sales[index]

For a list of length n, the ____________________ sort makes exactly (n(n - 1))/2 key comparisons and 3(n-1) item assignments.

selection

The ____________________ sort algorithm finds the location of the smallest element in the unsorted portion of the list and moves it to the top of the unsorted portion of the list.

selection

A data type is called ____________________ if variables of that type can store only one value at a time.

simple

A conversion constructor is a(n) ____________________-parameter function.

single

The operators that cannot be overloaded are ., .*, ::, ?:, and ____________________.

sizeof

The function ____________________ returns the length of the string s, excluding the null character.

strlen(s)

A(n) ____________________ is a collection of a fixed number of components in which the components are accessed by name.

struct

Both arrays and structs are examples of ____________________ data types.

structured

In a(n) ____________________ data type, each data item is a collection of other data items.

structured

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

The one place where C++ allows aggregate operations on arrays is the input and output of C-strings.

t

When you pass an array as a parameter, the base address of the actual array is passed to the formal parameter.

t

To overload a(n) ____________________ operator for a class, if the operator function is a nonmember, it has one parameter.

unary

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

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

virtual destructor


Related study sets

Sullivan English IV Honors Final

View Set

Microeconomics Exam 2 part B Chapter 7- Dr.McClung

View Set

MGMT 391 Organizational Behavior

View Set

Ch. 4 Northern Colonies in the 17th Century

View Set

Ch. 6 (Values, Ethics, and Advocacy)

View Set

AP Chemistry — Unit 6 Progress Check: MCQ

View Set