CS244 - Data Structures Test 0 questions

¡Supera tus tareas y exámenes ahora con Quizwiz!

A derived class can directly access the protected members of a base class. A) True B) False

A) True

A program goes through many phases from the time it is first conceived until the time it is retired, called the life cycle of the program. A) True B) False

A) True

By using templates, you can write a single code segment for a set of related functions. A) True B) False

A) True

Composition is a "has-a" relationship. A) True B) False

A) True

Default arguments can be used with an overloaded operator. A) True B) False

A) True

If g(n) = 1, the growth rate is constant and does not depend on the size of the problem. A) True B) False

A) True

In C++, the mechanism that allows you to combine data and the operations on that data in a single unit is called a class. A) True B) False

A) True

In OOP, each object consists of data and operations on that data. A) True B) False

A) True

In a deep copy, two or more pointers have their own data. A) True B) False

A) True

In multiple inheritance, the derived class is derived from more than one base class. A) True B) False

A) True

In single inheritance, the derived class is derived from a single base class. A) True B) False

A) True

Inheritance is an ''is-a''relationship. A) True B) False

A) True

When an integer is added to a pointer variable, the value of the pointer variable is incremented by the integer times the size of the memory to which the pointer is pointing. A) True B) False

A) True

When overloading an operator, you might define the meaning of how the operator works with the related object. A) True B) False

A) True

When writing the definition of a friend function, the name of the class and the scope resolution operator do not precede the name of the friend function in the function heading. A) True B) False

A) True

The value of a pointer variable is an_____. A) address B) entry in a table C) array D) unknown value

A) address

29. The ampersand, &, is called the__________. A) address of operator B) sizeof operator C) entry operator D) heap operator

A) address of operator

The name of a constructor is the same as the name of the_____. A) class B) main function C) helper function D) friend function

A) class

By using templates, you can write a single code segment for a set of related functions, called a ______. A) function template B) function type C) class set D) class template

A) function template

To define new classes, you would usually create new_____files. A) header B) friend C) prototype D) placeholder

A) header

The statement________declares a variable "board" to be a pointer to an int pointer. A) int **board B) int*&board C) *int *board D) **int board

A) int **board

The members of a class are classified into three categories(public, private, protected) called_____access specifiers. A) member B) object C) function D) object

A) member

The statement______stores the address of x in p. A) p = &x; B) p = &x C) x = &p; D) x = &p

A) p = &x;

The destructor automatically executes when the class object goes out of___. A) scope B) use C) bounds D) phase

A) scope

The correct syntax for the destructor of the class tempClass is_______. A) tempClass::~tempClass() B) tempClass::~tempClass(x) C) tempClass::tempClass() D) tempClass::tempClass(x)

A) tempClass::~tempClass()

To redefine a public member function of a base class in the derived class, the corresponding function in the derived class must have_____. A) the same name, number, and types of parameters B) only the same name and types of parameters C) only the same name and number D) only the same number and types of parameters

A) the same name, number, and types of parameters

The increment operator increments the value of a pointer variable by twice the size of the memory to which it is pointing. A) True B) False

B) False

When an integer is subtracted from a pointer variable, the value of the pointer variable is decremented by the integer times half the size of the memory to which the pointer is pointing. A) True B) False

B) False

You can initialize a pointer variable by setting it to____. A) EMPTY B) NULL C) INIT D) NONE

B) NULL

When you declare a derived class object, this object inherits the members of the base class, but the derived class object cannot directly access the_____. A) private data members of the base class B) data members in its own class C) base class constructors D) public data members of the base class

A) private data members of the base class

The values belonging to pointer data types are the memory addresses of your computer. A) True B) False

A) True

Two different type pointer variables cannot point to same memory location. A) True B) False

A) True

When * is used as a unary operator, * refers to the object to which the operand of the * (that is, the pointer) points. A) True B) False

A) True

When a dynamic variable is no longer needed, it can be destroyed; that is, its memory can be deallocated. A) True B) False

A) True

When a program no longer needs a dynamic variable, the operator delete is used. A) True B) False

A) True

A_____variable is a variable whose content is a memory address. A) class B) dynamic C) pointer D) heap

C) pointer

Passing parameters to a function has an effect at_____time. A) compile B) link C) run D) build

C) run

A(n) ____is a data type that separates the logical properties from the implementation details. A) public B) protected C) private D) abstract data type

D) abstract data type

A(n)____typically serves to initialize the member variables of a derived class. A) inheritor B) initiator C) deconstructor D) constructor

D) constructor

The general syntax to declare a pointer variable is____. A) dataType &identifier; B) *dataType identifier; C) &dataType identifier; D) dataType *identifier;

D) dataType *identifier;

If a class contains the default constructor and no values are specified when the object is declared, the_____executes and initializes the object. A) default destructor B) first destructor in the program listing C) last constructor in the program listing D) default constructor

D) default constructor

When a dynamic variable is no longer needed, it can be______. A) renamed B) reassigned C) reconstructed D) destroyed

D) destroyed

If a class has member variables that are pointers, you must ensure that you implement____. A) garbage collection B) base constructors C) friend functions D) destructor

D) destructor

An array created during the execution of a program is called a____array. A) static B) final C) just in time D) dynamic

D) dynamic

To include a header file in a program, you use the preprocessor command_____. A) pragma B) fetch C) pull D) include

D) include

The components of a class are called the____of the class. A) operators B) friends C) objects D) members

D) members

A_____leak is when there is an unused memory space that cannot be allocated. A) variable B) function C) constructor D) memory

D) memory

Class templates are called_____types. A) class B) general C) template D) parameterized

D) parameterized

In a(n) _____copy, two or more pointers of the same type may point to the same memory. A) indirect B) direct C) deep D) shallow

D) shallow

The function that overloads any of the operators (), [], ->, or = for a class must be declared as a member of the class. A) True B) False

A) True

The term asymptotic means the study of the function f as n becomes larger and larger. A) True B) False

A) True

The three fundamental stages through which a program goes are implementation, use, and maintenance A) True B) False

A) True

A class and its members can be described graphically using a notation known as Unified Modeling Language (UML) notation. A) True B) False

A) True

OOD has three basic principles: encapsulation, inheritance and polymorphism A) True B) False

A) True

Overriding a member function is the same as redefining it. A) True B) False

A) True

Software engineers typically break the software development process into the following four phases: analysis, design, implementation, and testing and debugging. A) True B) False

A) True

The decrement operator decrements the value of a pointer variable by the size of the memory to which it is pointing. A) True B) False

A) True

A derived class inherits all its data members from the base class; it has none of its own. A) True B) False

B) False

A friend function is a member function of a class but only has access to the class's public data members. A) True B) False

B) False

As parameters to functions, class objects can be passed only by reference. A) True B) False

B) False

Class objects cannot be passed as parameters to functions or returned as function values. A) True B) False

B) False

In C++ the user can create new operators. A) True B) False

B) False

In C++, every object of a class maintains a hidden pointer to itself, and the name of this pointer is "hidden". A) True B) False

B) False

In a shallow copy, two pointers of different data types point to the same memory. A) True B) False

B) False

The ampersand, &, is a binary operator that returns the address of itsoperand. (& is not binary) A) True B) False

B) False

The components of a class are called objects. A) True B) False

B) False

If class "dog" has a derived class "retriever", which of the following is true? A) In the case of single inheritance, dog can have no other derived classes. B) In the case of single inheritance, retriever is derived from no other class except dog. C) The relationship between these classes implies that dog "is a" retriever. D) The relationship between these classes implies that retriever "has-a" dog.

B) In the case of single inheritance, retriever is derived from no other class except dog.

____is the ability to use the same type pointer to point to pointers of different types. A) Overloading operators B) Polymorphism C) Inheritance D) Encapsulation

B) Polymorphism

8. If there are three classes, shape, circle, and square, what is the most likely relationship among them? A) The square class is a base class, and shape and circle are derived classes of square. B) The shape class is a base class, and circle and square are derived classes of shape. C) The shape, circle, and square classes are all sibling classes. D) These three classes cannot be related.

B) The shape class is a base class, and circle and square are derived classes of shape.

To include a system-provided header file, such as iostream, in a user program, you enclose the header file between_____. A) curly brackets B) angular brackets C) asterisks D) square brackets

B) angular brackets

Like function templates, _____are used to write a single code segment for a set of related classes. A) function types B) class templates C) inherited classes D) protected members

B) class templates

The ability to combine data and operations is called_____. A) inheritance B) encapsulation C) redefinition D) composition

B) encapsulation

Composition is a(n) "_____" relationship. A) is a B) has a C) was a D) had a

B) has a

The statement______declares list to be an array of five integers. A) int [5] list; B) int list[5]; C) int list[]; D) int list[]={0,1,2,3,4,5};

B) int list[5];

The syntax for accessing a class (struct) member using the operator -> is______. A) pointerVariableName.classMemberName B) pointerVariableName->classMemberName C) pointerVariableName&->classMemberName D) &pointerVariableName.classMemberName

B) pointerVariableName->classMemberName

For a base class to give access to a member to its derived class and still prevent its direct access outside the class, you must declare that member under the member access specifier_____. A) private B) protected C) public D) shared

B) protected

A pointer variable can be passed as a parameter to a function either by value or by _____. A) retention B) reference C) approximation D) referral

B) reference

The implementation of member functions can be placed in a separate file whose extension is_____. A) .cxx B) .c C) .cpp D) .cc

C) .cpp

____ is the ability to create new data types from existing data types. A) Encapsulation B) Information hiding C) Inheritance D) Polymorphism

C) Inheritance

The general syntax to include the copy constructor in the definition of a class is_____. A) className(className& otherObject); B) className(className otherObject); C) className(const className& otherObject); D) className(const className* otherObject);

C) className(const className& otherObject);

In a(n) _____copy, pointers should have their own data. A) indirect B) direct C) deep D) shallow

C) deep

The * is commonly referred to as the______operator. A) referencing B) allocating C) dereferencing D) addressing

C) dereferencing

Variables that are created during program execution are called_____ variables. A) stack B) heap C) dynamic D) static

C) dynamic

A call to the base class constructor is specified in the_____of a derived class. A) body of the definition B) body of the constructor C) heading of the constructor D) heading of the definition

C) heading of the constructor


Conjuntos de estudio relacionados

Anthropology (ANTH 001) FINAL EXAM REVIEW

View Set

Child Abuse and Neglect Presentation

View Set

EAQ - Chapter 19: Care of Patients With Cardiac Disorders

View Set

UF PHA6936 Final Exam Prep - Edited by T. Dickson

View Set

Factorial Analysis vs. Principal Component Analysis (PCA)

View Set