

Data Structures
Exam Answer Key
Course Introduction
Data Structures is a foundational course that introduces students to the fundamental concepts, principles, and techniques used to organize, manage, and store data efficiently in computer systems. The course covers a variety of abstract data types such as arrays, linked lists, stacks, queues, trees, and graphs, as well as their implementations and applications. Through theoretical explanations and practical programming exercises, students will develop the ability to select and use appropriate data structures to optimize algorithm performance, solve computational problems, and manage memory effectively. The course also explores complexity analysis and real-world use cases, equipping students with critical skills for software development and computer science research.
Recommended Textbook
C++ Programming Program Design Including Data Structures 8th Edition by D. S. Malik
Available Study Resources on Quizplus
21 Chapters
881 Verified Questions
881 Flashcards
Source URL: https://quizplus.com/study-set/3128

Page 2

Chapter 1: An Overview of Computers and Programming Languages
Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/128445
Sample Questions
Q1) ____________________ languages include FORTRAN, COBOL, Pascal, C, C++, Java, and Python.
Answer: High-level high-level
High level
high level
Q2) The term GB refers to ____.
A) giant byte
B) gigabyte
C) group byte
D) great byte
Answer: B
Q3) The devices that feed data and programs into computers are called ____ devices.
A) entry
B) input
C) output
D) secondary
Answer: B
Q4) The ASCII data set consists of ____________________ characters. Answer: 128
To view all questions and flashcards with answers, click on the resource link above. Page 3
Chapter 2: Basic Elements of C++
Available Study Resources on Quizplus for this Chatper
50 Verified Questions
50 Flashcards
Source URL: https://quizplus.com/quiz/61982
Sample Questions
Q1) ____ is a valid char value.
A) "-129"
B) 'A'
C) "A"
D) 129
Answer: B
Q2) The expression static_cast<int>(6.9) + static_cast<int>(7.9) evaluates to ____.
A) 13
B) 14
C) 14.8
D) 15
Answer: A
Q3) ____________________ is the process of planning and creating a program.
Answer: Programming programming
Q4) A comma is also called a statement terminator.
A)True
B)False
Answer: False

Page 4
To view all questions and flashcards with answers, click on the resource link above.

Chapter 3: Inputoutput
Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/61983
Sample Questions
Q1) Suppose that x is an int variable, y is a double variable, and z is an int variable.The input is: 15 76.3 14
Choose the values after the following statement executes: Cin >> x >> y >> z;
A) x = 15, y = 76, z = 14
B) x = 15, y = 76, z = 0
C) x = 15, y = 76.3, z = 14
D) x = 15.0, y = 76.3, z = 14.0
Answer: C
Q2) You can use the function getline to read a string containing blanks.
A)True
B)False
Answer: True
Q3) If input failure occurs in a C++ program, the program terminates immediately and displays an error message.
A)True
B)False
Answer: False
To view all questions and flashcards with answers, click on the resource link above. Page 5

Chapter 4: Control Structures I Selection
Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/61984
Sample Questions
Q1) Which of the following operators has the lowest precedence?
A) !
B) ||
C) &&
D) =
Q2) Suppose P and Q are logical expressions.The logical expression P && Q is true if both P and Q are true.
A)True
B)False
Q3) Which of the following will cause a logical error if you are attempting to compare x to 5?
A) if (x == 5)
B) if (x = 5)
C) if (x <= 5)
D) if (x >= 5)
Q4) Which of the following is a relational operator?
A) =
B) ==
C) !
D) &&
To view all questions and flashcards with answers, click on the resource link above. Page 6

Chapter 5: Control Structures Ii Repetition
Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/128468
Sample Questions
Q1) A(n) ____-controlled while loop uses a bool variable to control the loop.
A) counter
B) sentinel
C) flag
D) EOF
Q2) The statement in the body of a while loop acts as a decision maker.
A)True
B)False
Q3) Assume that all variables are properly declared.The following for loop executes 20 times.
for (i = 0; i <= 20; i++) cout << i;
A)True
B)False
Q4) Which executes first in a do...while loop?
A) the statement
B) loop condition
C) the expression
D) update statement
Q5) The function eof is a member of the data type ____________________.
To view all questions and flashcards with answers, click on the resource link above. Page 7

Chapter 6: User-Defined Function
Available Study Resources on Quizplus for this Chatper
41 Verified Questions
41 Flashcards
Source URL: https://quizplus.com/quiz/61986
Sample Questions
Q1) Assume the following.
Static_cast<int>('a') = 97
Static_cast<int>('A') = 65
The output of the statement:
Cout << static_cast<int>(tolower('B')) << endl;
Is ____.
A) 65
B) 67
C) 96
D) 98
Q2) To use the predefined function tolower, the program must include the header file
A) <cctype> B) <iostream> C) <cmath> D) <cstdlib>
Q3) Stream variables (for example, ifstream and ofstream) should be passed by ____________________ to a function.
To view all questions and flashcards with answers, click on the resource link above. Page 8
Chapter 7: Namespaces, the Class String, and
User-Defined Simple Data Types
Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/61987
Sample Questions
Q1) The data type string has a named constant, ____, associated with it.
A) string::size
B) string::size_type
C) string::pos
D) string::npos
Q2) What is the output of the following code? enum courses {ALGEBRA, BASIC, PASCAL, PHILOSOPHY, ANALYSIS};
Courses registered;
Registered = ALGEBRA;
Cout << registered << endl;
A) ALGEBRA
B) 0
C) 1
D) "ALGEBRA"
Q3) The string expression strVar.____________________ starts at index pos, replaces the next n characters of strVar with all the characters of str.
Q4) An enumeration type can be passed as a parameter to a function only by value. A)True
B)False

9
To view all questions and flashcards with answers, click on the resource link above.

Chapter 8: Arrays
Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/61988
Sample Questions
Q1) In C++, the null character is represented as ____.
A) '\0'
B) "\0"
C) '0'
D) "0"
Q2) Which of the following correctly declares name to be a character array and stores "William" in it?
A) char name[6] = "William";
B) char name[7] = "William";
C) char name[8] = "William";
D) char name[8] = 'William';
Q3) The one place where C++ allows aggregate operations on arrays is the input and output of C-strings.
A)True
B)False
Q4) The word ____________________ is used before the array declaration in a function heading to prevent the function from modifying the array.
Q5) In a(n) ____________________ data type, each data item is a collection of other data items.
To view all questions and flashcards with answers, click on the resource link above. Page 10

Chapter 9: Records Structs
Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/61989
Sample Questions
Q1) In structs, you access a component by using the struct name together with the relative position of the component.
A)True
B)False
Q2) A function can return a value of the type struct.
A)True
B)False
Q3) To compare struct variables, you compare them ____.
A) by reference
B) by value
C) index-wise
D) member-wise
Q4) Aggregate input/output operations are allowed on a struct variable.
A)True
B)False
Q5) A struct is typically a ____ data structure.
A) simple
B) dynamic
C) heterogeneous
D) linked
To view all questions and flashcards with answers, click on the resource link above. Page 11

Chapter 10: Classes and Data Abstraction
Available Study Resources on Quizplus for this Chatper
43 Verified Questions
43 Flashcards
Source URL: https://quizplus.com/quiz/61990
Sample Questions
Q1) A(n) ____________________ is a statement specifying the condition(s) that must be true before the function is called.
Q2) You can use arithmetic operators to perform arithmetic operations on class objects.
A)True
B)False
Q3) A class and its members can be described graphically using a notation known as the ____ notation.
A) OON
B) OOD
C) UML
D) OOP
Q4) A(n) ____________________ contains the definitions of the functions to implement the operations of an object.
Q5) A(n) ____________________ function of a class changes the values of the member variable(s) of the class.
Q6) As parameters to a function, class objects can be passed by reference only.
A)True
B)False
To view all questions and flashcards with answers, click on the resource link above. Page 12

Chapter 11: Inheritance and Composition
Available Study Resources on Quizplus for this Chatper
41 Verified Questions
41 Flashcards
Source URL: https://quizplus.com/quiz/61991
Sample Questions
Q1) Which of the following is true about a derived class?
A) A derived class can directly access any member variable of the base class.
B) A derived class can redefine any public member function of the base class.
C) A derived class can have at most one base class.
D) A derived class can redefine any member function of the base class.
Q2) OOP implements ____.
A) UML
B) IPE
C) EIP
D) OOD
Q3) If the derived class classD overrides a public member function functionName of the base class classB, then to specify a call to that public member function of the base class, you use the statement ____.
A) classD::functionName();
B) classB::functionName();
C) classD.functionName();
D) classB.functionName();
Q4) If inheritance is public, all protected members of the base class are ____________________ members of the derived class.
To view all questions and flashcards with answers, click on the resource link above. Page 13

Chapter 12: Pointers, Classes, Virtual Functions, and
Abstract Classes
Available Study Resources on Quizplus for this Chatper
44 Verified Questions
44 Flashcards
Source URL: https://quizplus.com/quiz/61992
Sample Questions
Q1) A memory leak is an unused memory space that cannot be allocated.
A)True
B)False
Q2) The code int *p; declares p to be a(n) ____ variable.
A) new
B) num
C) pointer
D) address
Q3) The seqSearch function returns true if an item in the list equals the searchItem.
A)True
B)False
Q4) The ____________________ of a base class automatically makes the destructor of a derived class virtual.
Q5) Run-time binding is also known as ____ binding.
A) static
B) shallow
C) dynamic
D) deep
Q6) A(n) ____________________ is a collection of distinct elements of the same type. Page 14
To view all questions and flashcards with answers, click on the resource link above.
Page 15

Chapter 13: Operator Overloading and Templates
Available Study Resources on Quizplus for this Chatper
41 Verified Questions
41 Flashcards
Source URL: https://quizplus.com/quiz/61993
Sample Questions
Q1) Both parameters of the function to overload the operator << are reference parameters.
A)True
B)False
Q2) The name of the function to overload the operator <= is ____.
A) overload<=
B) <=new
C) operator<=
D) <=operator
Q3) Using a class ____________________ allows you to define an arrayListType that can process any type of list.
Q4) The associativity of the operator = is from right to left.
A)True
B)False
Q5) The operators that cannot be overloaded are ., .*, ::, ?:, and ____________________.
Q6) A(n) ____________________ constructor converts its argument to an object of the constructor's class.
Q7) Any function that overloads an operator is called a(n) ____________________ function.
To view all questions and flashcards with answers, click on the resource link above. Page 16

Chapter 14: Exception Handling
Available Study Resources on Quizplus for this Chatper
43 Verified Questions
43 Flashcards
Source URL: https://quizplus.com/quiz/61994
Sample Questions
Q1) A(n) ____________________ block specifies the type of exception it can catch and contains an exception handler.
Q2) To use the assert function in your program, you should include the statement ____.
A) #include <assert>
B) #include <cassert>
C) #include <iostream>
D) #include <exception>
Q3) The heading of a try block can contain ellipses in place of a parameter.
A)True
B)False
Q4) When an exception is thrown in a function, the function-call stack is ____ so that the exception can be caught in the next try/catch block.
A) destroyed
B) allocated
C) unbound
D) unwound
Q5) The string concatenation operator is represented by the ____________________ symbol.
To view all questions and flashcards with answers, click on the resource link above. Page 17

Chapter 15: Recursion
Available Study Resources on Quizplus for this Chatper
43 Verified Questions
43 Flashcards
Source URL: https://quizplus.com/quiz/128470
Sample Questions
Q1) In a recursive function, the base case stops the recursion.
A)True
B)False
Q2) A recursive function in which the last statement executed is the recursive call is called a(n) ____ recursive function.
A) direct
B) tail
C) indefinite
D) indirect
Q3) If every recursive call results in another recursive call, then the recursive function (algorithm) is said to have ____ recursion.
A) unlimited
B) indefinite
C) infinite
D) tail
Q4) If you execute an infinite recursive function on a computer, the function executes until the system runs out of ____________________.
Q5) Recursive algorithms are implemented using ____________________ functions.
To view all questions and flashcards with answers, click on the resource link above. Page 18

Chapter 16: Linked Lists
Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/61996
Sample Questions
Q1) Consider the accompanying statements.The operation returns true if the list is empty; otherwise, it returns false.The missing code is ____.
A) protected
B) int
C) void
D) bool
Q2) Suppose that the pointer head points to the first node in the list, and the link of the last node is nullptr.The first node of the linked list contains the address of the ____ node.
A) head
B) first
C) second
D) tail
Q3) A linked list is a random access data structure.
A)True
B)False
Q4) Linked lists allow you to overcome the size limitations of an array data type.
A)True
B)False
To view all questions and flashcards with answers, click on the resource link above. Page 19

Chapter 17: Stacks and Queue
Available Study Resources on Quizplus for this Chatper
43 Verified Questions
43 Flashcards
Source URL: https://quizplus.com/quiz/61997
Sample Questions
Q1) The postfix expression 5 6 + 4 * 10 5 / - = evaluates to ____.
A) 10
B) 30
C) 42
D) 44
Q2) When describing a queuing system, we use the term ____________________ to refer to the time it takes to serve a customer.
Q3) Postfix notation requires the use of parentheses to enforce operator precedence. A)True B)False
Q4) The ____________________ constructor is called when a stack object is passed as a (value) parameter to a function.
Q5) In the array representation of a stack, the stack is initialized simply by setting stackTop to ____________________.
Q6) In ____________________ notation, operators are written after the operands.
Q7) A queue is a First In First Out data structure. A)True B)False
Q8) An array is a(n) ____________________ access data structure.
To view all questions and flashcards with answers, click on the resource link above. Page 20

Chapter 18: Searching and Sorting Algorithms
Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/61998
Sample Questions
Q1) To construct a search algorithm of the order less than log<sub>2</sub>n, it cannot be ____________________ based.
Q2) With the binary search algorithm, ____ key comparison(s) is/are made in the successful case-the last time through the loop.
A) one B) two C) n-2
D) n
Q3) The swap function of quick sort is written differently from the swap function for selection sort.
A)True
B)False
Q4) The top node of a comparison tree is call the ____________________ node.
Q5) The selection sort algorithm finds the location of the smallest element in the unsorted portion of the list.
A)True
B)False
Q6) In a quick sort, all of the sorting work is done by the function
21
To view all questions and flashcards with answers, click on the resource link above.

Chapter 19: Binary Trees
Available Study Resources on Quizplus for this Chatper
43 Verified Questions
43 Flashcards
Source URL: https://quizplus.com/quiz/61999
Sample Questions
Q1) In a binary tree, the branches go only from a child to a parent.
A)True
B)False
Q2) In addition to the inorder, preorder, and postorder traversals, a binary tree can also be traversed level-by-level, which is also known as ____________________ traversal.
Q3) Assume the key of the left child below the root node of a binary search tree is 30.The value in the root node could be ____.
A) 0
B) 10
C) 30
D) 40
Q4) A pointer to the root node of the binary tree is stored outside the binary tree in a pointer variable, usually called the ____.
A) node
B) parent
C) root
D) nodeType
To view all questions and flashcards with answers, click on the resource link above. Page 22
Chapter 20: Graph Algorithms
Available Study Resources on Quizplus for this Chatper
48 Verified Questions
48 Flashcards
Source URL: https://quizplus.com/quiz/62000
Sample Questions
Q1) Linked lists cannot be used to implement an adjacency list.
A)True
B)False
Q2) A minimal spanning tree of G is a spanning tree with the minimum ____.
A) path
B) cycle
C) weight
D) height
Q3) We can always traverse an entire graph from a single vertex.
A)True
B)False
Q4) The shortest path algorithm is also called the ____ algorithm.
A) recursive
B) minimal
C) greedy
D) spanning
Q5) A simple path is a path in which all vertices, except possibly the first and last vertices, are distinct.
A)True
B)False

Page 23
To view all questions and flashcards with answers, click on the resource link above.

Chapter 21: Standard Template Library
Available Study Resources on Quizplus for this Chatper
41 Verified Questions
41 Flashcards
Source URL: https://quizplus.com/quiz/62001
Sample Questions
Q1) Functions begin and end do not take any parameters.
A)True
B)False
Q2) If a container is declared as ____, then we must prevent the iterator from modifying the elements of the container, especially accidentally.
A) static
B) const
C) public
D) private
Q3) The only difference between the containers set and multiset is that the container multiset allows ____________________.
Q4) You must use the container name, the container element type, and the scope resolution operator to use the typedef iterator.
A)True
B)False
Q5) All containers use the same names for the common operations.
A)True
B)False
Q6) ____________________ predicates check a specific property for a single argument.
To view all questions and flashcards with answers, click on the resource link above. Page 24