CSCI 112 Final Exam

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

Given a pointer p of type double, the statement p++; increments the value of p by ____ bytes.

8

____ is a "has a" relationship between classes.

Composition

____ takes place when one or more members of a class are objects of another class type.

Composition

A class can have more than one destructor.

False

A friend function of a class is a nonmember function of the class, so it cannot access the members of the class.

False

Both constructors and destructors can have parameters.

False

C++ allows users to create their own operators.

False

Dynamic variables are destroyed using the operator new.

False

If a pointer p points to a dynamic array, the elements of p can be processed using a range-based for loop.

False

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

False

In C++, all operators can be overloaded for user-defined data types.

False

In C++, pointer is a reserved word.

False

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

False

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

False

In composition, one or more members of a class are objects of another class type.

False

In protected inheritance, the private members of the base class are protected members of the derived class.

False

In single inheritance, a base class can create only one derived class.

False

The address of operator returns the address and value of its operand.

False

The binding of virtual functions occurs at compile time.

False

The class ios is the base class for all stream classes.

False

The member functions of a class must be public.

False

The member variables of a class must be of the same type.

False

The precedence of an operator cannot be changed, but its associativity can be changed.

False

The public members of a base class can only be inherited as public members in the derived class.

False

The statement delete p; deallocates the variable pointer p.

False

When writing the definition of a friend function, the keyword friend must appear in the function heading.

False

Which of the following statements is FALSE?

The derived class cannot redefine the public member functions of the base class.

Which of the following statements regarding creating executable code and running a program is TRUE?

The user must have access to the object code file.

Which of the following is not a use of the address of operator, &?

To prevent the access of private member variables out of the class.

A class can have more than one constructor.

True

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

Given the declaration: int list[10]; int *p; the statement p=list; is valid in c++.

True

If p is a pointer variable, then *p refers to the memory location to which p points.

True

If the derived class does not override a public member function of the base class, you may specify a call to that public member function by using the name of the function and the appropriate parameter list.

True

In C++, operators cannot be redefined for built-in types.

True

In C++, the return type of a function can be a pointer.

True

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

True

Suppose that x and y are classes, one of the member variables of x is an object of type y, and both classes have constructors. The constructor of x specifies a call to the constructor of y by using the object name of type y.

True

The constructor of a derived class can specify a call to the constructor of the base class in the heading of the function definition.

True

The constructor of a derived class can specify a call to the constructor of the base class using the name of the class.

True

The function that overloads an operator is called the operator function.

True

The statement delete p; deallocates the dynamic variable that is pointed to by p.

True

To redefine (or override) a member function of the base class in the derived class, the corresponding member function must have the same name, number, and type of parameters.

True

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

True

When the destructor of the derived class executes, it automatically invokes the destructor of the base class.

True

If a derived class overrides a public member function of the base class, you can call the base class function by using the ____.

base class name, followed by the scope resolution operator, followed by the function name and appropriate parameter list.

In C++, a pointer ____.

can be passed as a value or reference parameter

The general syntax for an object to access the members of its class is ____.

classObjectName.memberName

When you declare a pointer variable, you specify the ____ of the value to be stored in the memory location.

data type

When a program no longer needs a dynamic variable, the operator ____ is used.

delete

The ____ operator in C++ refers to the object to which its operand points.

dereferencing

C++ allows the user to pass an object of a _____ class to a formal parameter of the base class type.

derived

Like any other data type, an ADT has three things associated with it: the type name; set of operations; and the ____.

domain

To include a user-defined header file in a program, you enclose the header file between ____.

double quotation marks

Because a user must be able to look at the specification details to correctly call a function, the specification details are contained in a separate file called the _____ file.

header

A call to the base class's constructor is specified in the ____.

heading of the definition of the derived class constructor

To avoid multiple inclusions of header files in a program, which of the following preprocessor commands (with the appropriate identifiers and/or statements) should you use?

ifndef, define, endif

Because the user only needs to know what an object does, not how it does it, it is good practice to hide the details in a(n) ____ file.

implementation

Derived classes ____.

inherit the properties of base classes

In C++ terminology, a class variable is called a class object or class ____.

instance

Which of the following statements creates a two-dimensional dynamic array of four pointers in which each pointer is of type int?

int *arrayName[4];

Inheritance is an example of a(n) ____ relationship.

is-a

To simplify the accessing of a class or struct with a pointer, C++ provides the ____.

member access operator arrow

In a UML diagram, the last box contains the ____.

member functions, parameter list, and return type of the functions

In the case of composition, use the ____ name to invoke its own constructor.

member object

Unused memory space that cannot be allocated is referred to as a _____.

memory leak

A ____ function is a member function of a class that modified the values or the member variables.

mutator

When a program requires a dynamic variable, the operator ____ is used.

new

A common and simple technique to identify classes is to identify all of the nouns and verbs in the description of the problem; ____ represent the classes.

nouns

Pointer variables are initialized using the constant value 0, called the ____ pointer.

null

In OOD, a program is a collection of interacting ____.

objects

The class ofstream is directly derived from the class ____.

ostream

If the corresponding functions in the base class and the derived class have the same name but different sets of parameters, this is function ____.

overloading

In ____ polymorphism, the (data) type is left unspecified and then later instantiated.

parametric

A _____ variable is one whose content is a memory address.

pointer

By default, all members of a class are ____.

private

If a member function is only used to implement other member functions of a class and the user does not need to access the function, you should declare it as ____.

private

If a member of a class is a function, you typically use the function ____ to declare that member.

prototype

Any class member that needs to be accessed outside of the class should be declared as ____.

public

A ____ is a collection of distinct elements of the same type.

set

In ____ inheritance, a derived class is inherited from a single base class.

single

A public _____ member, function, or variable of a class can be accessed using the class name and the scope resolution operator.

static

The name of a destructor function is the ____ character followed by the class name.

tilde (~)

In a shallow copy, ____.

two or more pointers of the same type point to the same memory location

Which of the following characters appears before a desutructor's name?

~

In a UML diagram, a(n) ____ sign in front of a member name indicates that the member is a public member.

+

When the destructor of the derived class executes, it automatically invokes the destructor of the _____ class.

Base

What is the only difference between a struct and a class?

By default, all members of a struct are public, and all members of a class are private.

_____ is the ability to combine data and operations on that data in a single unit.

Encapsulation

____ is the ability to use the same expression to denote different operations.

Polymorphism

Which of the following is not a common operation performed on a list?

Rearrange in a user specified order.

The copy constructor automatically executes in three situations. Which of the following is not one of those situations?

When, as a parameter, an object is passed by reference.

When no member access specifier is included in a derived class header definition, it is assumed to be ____.

a private inheritance

A class containing one or more pure virtual functions is called a(n) ____ class.

abstract

A data type that separates the logical properties from the implementation details is called a(n) _____ data type.

abstract

Separating the design details from usage is called _____.

abstraction

In C++, the ampersand (&) is called the _____ operator.

address of

If a member of a class is a function, it can access member variables ____.

and member functions directly

The items in an ordered list are in _____ order.

ascending

A class object is ____ if it is created each time the control reaches its declaration and is destroyed when the control exits the surrounding block.

automatic


संबंधित स्टडी सेट्स

Outcome ID and Planning mastery level 3

View Set

Chapter 6 Accounting Multiple Choice Questions

View Set

Chapter 12: Gender, Sex, and Sexuality

View Set

Precalc Trigonometric Units (units 10, 11, 12)

View Set

Academic IELTS Writing 1_List of Expressions_English-Russian

View Set

High-Yield and Frequently Missed ABSITE questions

View Set