DATA STRUCTURES AND
ALGORITHMS - TEST 1 QUIZZES WITH
COMPLETE SOLUTIONS
Abstract Data Type (ADT) - Correct Answers -A theoretical model of a data structre
Debugger - Correct Answers -It is a misconception that debuggers make large
programs more time efficient; they do not
Dynamic Array - Correct Answers -Stores input data on the stack computer memory
What should the class do if a private data member is declared as a pointer? - Correct
Answers -Create a copy constructor (and the remaining of the Big 5) to avoid creating a
shallow copy
Bubble Sort does how many comparisons? - Correct Answers -(n-1)^2
What is the big-O classification of Bubble Sort? - Correct Answers -O(n^2)
What data structure should be used to reverse input data? - Correct Answers -Stack
Which data structure should be used for the simulation of replenishing bottles of milk in
grocery shelves? - Correct Answers -Queue
Can an element of a dynamic array allocated on heap memory be access explicitly
using [ ]? - Correct Answers -Yes!
What type is:
int* ip = new int(5); ? - Correct Answers -A pointer to type int.
Where does the variable ip:
int* ip = new int(5);
reside in computer memory? - Correct Answers -Stack. Not the heap...
Consider the C++ statements:
int* ip = new int[3]{1,2,3};
cout << *(ip++);
ALGORITHMS - TEST 1 QUIZZES WITH
COMPLETE SOLUTIONS
Abstract Data Type (ADT) - Correct Answers -A theoretical model of a data structre
Debugger - Correct Answers -It is a misconception that debuggers make large
programs more time efficient; they do not
Dynamic Array - Correct Answers -Stores input data on the stack computer memory
What should the class do if a private data member is declared as a pointer? - Correct
Answers -Create a copy constructor (and the remaining of the Big 5) to avoid creating a
shallow copy
Bubble Sort does how many comparisons? - Correct Answers -(n-1)^2
What is the big-O classification of Bubble Sort? - Correct Answers -O(n^2)
What data structure should be used to reverse input data? - Correct Answers -Stack
Which data structure should be used for the simulation of replenishing bottles of milk in
grocery shelves? - Correct Answers -Queue
Can an element of a dynamic array allocated on heap memory be access explicitly
using [ ]? - Correct Answers -Yes!
What type is:
int* ip = new int(5); ? - Correct Answers -A pointer to type int.
Where does the variable ip:
int* ip = new int(5);
reside in computer memory? - Correct Answers -Stack. Not the heap...
Consider the C++ statements:
int* ip = new int[3]{1,2,3};
cout << *(ip++);