Docsity

Data Structures Final Multiple Choice, Exams of Data Structures and Algorithms

Toggle sidebar
bg1
Data Structures Final
Multiple Choice
_____is the ability to create new data types from existing data types.
a. Encapsulation c. Inheritance
b. Information hiding d. Polymorphism - ANSc. Inheritance
___is the ability to use the same type pointer to point to pointers of different
types.
a. Overloading operators c. Inheritance
b. Polymorphism d. Encapsulation - ANSb. Polymorphism
A ____is a data structure in which elements of the same type are added at
one end and removed at another end.
a. hash table c. queue
b. tree d. network - ANSc. queue
A ___case is the case for which the solution is obtained directly.
a. base c. direct
b. general d. recursive - ANSa. base
A binary search can be performed only on .
a. unordered lists c. comparable lists
b. arrays d. ordered lists - ANSd. ordered lists
A call to the base class constructor is specified in the_____of a derived class.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Data Structures Final Multiple Choice and more Exams Data Structures and Algorithms in PDF only on Docsity!

Data Structures Final

Multiple Choice

_____is the ability to create new data types from existing data types. a. Encapsulation c. Inheritance b. Information hiding d. Polymorphism - ANSc. Inheritance ___is the ability to use the same type pointer to point to pointers of different types. a. Overloading operators c. Inheritance b. Polymorphism d. Encapsulation - ANSb. Polymorphism A ____is a data structure in which elements of the same type are added at one end and removed at another end. a. hash table c. queue b. tree d. network - ANSc. queue A ___case is the case for which the solution is obtained directly. a. base c. direct b. general d. recursive - ANSa. base A binary search can be performed only on. a. unordered lists c. comparable lists b. arrays d. ordered lists - ANSd. ordered lists A call to the base class constructor is specified in the_____of a derived class.

a. body of the definition c. heading of the constructor b. body of the constructor d. heading of the definition - ANSc. heading of the constructor A doubly linked list can be traversed in direction. a. only the forward c. a circular b. only the backward d. either the forward or backward - ANSd. either the forward or backward A doubly linked list is a linked list in which every node has a next pointer and a ____ pointer. a. back c. null b. center d. binary - ANSa. back A function that calls another function and eventually results in the original function call is said to be___ recursive. a. directly c. indirectly b. indeterminately d. suspiciously - ANSc. indirectly A linked list in which the last node points to the first node is called a linked list. a. circular c. standard b. recursive d. doubly - ANSa. circular The last is pointing to first. So if you visualize it, it looks like a circle A linked list is a collection of. a. classes c. addresses b. nodes d. memory variables - ANSb nodes

A(n) ____is a data type that separates the logical properties from the implementation details. a. public c. private b. protected d. abstract data type - ANSd. abstract data type A(n) definition is a definition in which something is defined in terms of a smaller version of itself. a. iterative c. non-standard b. general d. recursive - ANSd. recursive A(n) is a list of items, called nodes, in which the next node is determined by the address, called the link, stored in each node. a. array c. linked list b. structure d. hash table - ANSc. linked list A(n)____typically serves to initialize the member variables of a derived class. a. inheritor c. deconstructor b. initiator. d. constructor - ANSd. constructor An algorithm that finds the solution to a given problem by reducing the problem to smaller versions of itself is called a(n). a. iterative algorithm c. regressive algorithm b. recursive algorithm d. successive algorithm - ANSb. recursive algorithm An array created during the execution of a program is called a____array. a. static c. just in time b. final d. dynamic - ANSd. dynamic

Because all the elements of a stack are of the same type, you can use a(n) to implement a stack. a. struct c. record b. array d. class - ANSb. array Because initially the list is empty, the pointer first must be initialized to. a. NULL c. NIL b. EMPTY d. NOP - ANSa. NULL Building a linked list backward places the item to be added at the of the linked list. a. beginning c. middle b. end d. key point - ANSa. beginning Building a linked list forward places the item to be added at the of the linked list. a. beginning c. middle b. end d. key point - ANSb. end By using templates, you can write a single code segment for a set of related functions, called a ______. a. function template c. class set b. function type d. class template - ANSa. function template Class templates are called_____types. a. abstract c. template b. general d. parameterized - ANSd. parameterized

If a class has member variables that are pointers, you must ensure that you implement____. a. garbage collection c. friend functions b. base constructors d. destructor - ANSd. destructor 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.

  • ANSb. In the case of single inheritance, retriever is derived from no other class except dog. 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. - ANSb. The shape class is a base class, and circle and square are derived classes of shape. In a doubly linked list, every node contains the address of the next node except for the node. a. middle c. first b. last d. second to last - ANSb. last

In a linked list, we always want head to point to the node. a. key c. first b. main d. last - ANSc. first In a(n) _____copy, pointers should have their own data. a. indirect c. deep b. direct d. shallow - ANSc. deep In a(n) _____copy, two or more pointers of the same type may point to the same memory. a. indirect c. deep b. direct d. shallow - ANSd. shallow In an ordered linked list, the search algorithm is somewhat improved because the list is___. a. larger c. referenced b. smaller d. sorted - ANSd. sorted Can apply binary search In____ , the data is stored within the hash table and no linked structure is used. a. closed addressing c. inverted addressing b. open addressing d. converted addressing - ANSb. open addressing Closed addressing refers to chaining. Open addressing refers to linear probing

a. referencing c. dereferencing b. allocating d. addressing - ANSc. dereferencing The ability to combine data and operations is called_____. a. inheritance c. redefinition b. encapsulation d. composition - ANSb. encapsulation The address of the first node in the list is stored in a separate location, called the. a. head c. key b. tail d. top - ANSa. head The ampersand, &, is called the__________. a. address of operator c. entry operator b. sizeof operator d. heap operator - ANSa. address of operator The attempts to find solutions to a problem by constructing partial solutions and making sure that any partial solution does not violate the problem requirements. a. backtracking algorithm c. interpretation algorithm b. inferring algorithm d. stack tracing algorithm - ANSa. backtracking algorithm The components of a class are called the____of the class. a. operators c. objects b. friends d. members - ANSd. members The correct syntax for the destructor of the class tempClass is_______.

a. tempClass::~tempClass() c. tempClass::tempClass() b. tempClass::~tempClass(x) d. tempClass::tempClass(x) - ANSa. tempClass::~tempClass() The destructor automatically executes when the class object goes out of___. a. scope c. bounds b. use d. phase - ANSa. scope The function____ makes an identical copy of a stack. a. readStack c. clearStack b. buildStack d. copyStack - ANSd. copyStack The general syntax to declare a pointer variable is____. a. dataType &identifier; c. &dataType identifier; b. *dataType identifier; d. dataType *identifier; - ANSd. dataType *identifier; The general syntax to declare a pointer variable is____. a. dataType &identifier; c. &dataType identifier; b. *dataType identifier; d. dataType *identifier; - ANSd. dataType identifier; 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); - ANSc. className(const className& otherObject);

The operation___ checks whether the stack is full. a. isEmpty c. pop b. peek d. isFullStack - ANSd. isFullStack The operation___ is used to add an element onto the stack. a. push c. add b. pop d. insert - ANSa. push The process of solving a problem by reducing it to smaller versions of itself is called. a. iteration c. recursion b. succession d. repulsion - ANSc. recursion The queue operation determines whether the queue is full. a. isFullQueue c. queueFront b. isNullQueue d. deleteQueue - ANSa. isFullQueue The statement________declares a variable "board" to be a pointer to an int pointer. a. int **board c. *int board b. int&board d. **int board - ANSa. int **board The statement______declares list to be an array of five integers. a. int [5] list; c. int list[]; b. int list[5]; d. int list[]={0,1,2,3,4,5}; - ANSb. int list[5];

The statement______stores the address of x in p. a. p = &x; c. x = &p; b. p = &x d. x = &p - ANSa. p = &x; The syntax for accessing a class (struct) member using the operator -> is______. a. pointerVariableName.classMemberName b. pointerVariableName->classMemberName c. pointerVariableName&->classMemberName d. &pointerVariableName.classMemberName - ANSb. pointerVariableName- >classMemberName The value of a pointer variable is an_____. a. address c. array b. entry in a table d. unknown value - ANSa. address To define new classes, you would usually create new_____files. a. header c. prototype b. friend d. placeholder - ANSa. header To include a header file in a program, you use the preprocessor command_____. a. pragma c. pull b. fetch d. include - ANSd. include To include a system-provided header file, such as iostream, in a user program, you enclose the header file between_____.

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 - ANSa. private data members of the base class Whenever a system is modeled on the First In First Out principle, are used. a. stacks c. arrays b. trees d. queues - ANSd. queues You can initialize a pointer variable by setting it to____. a. EMPTY c. INIT b. NULL d. NONE - ANSb. NULL