DATA STRUCTURES AND ALGORITHMS - TEST 1 QUIZZES WITH COMPLETE SOLUTIONS, Exams of Advanced Education

DATA STRUCTURES AND ALGORITHMS - TEST 1 QUIZZES WITH COMPLETE SOLUTIONS

Typology: Exams

2025/2026

Available from 03/27/2026

EXAMGUIDE
EXAMGUIDE 🇺🇸

4.4

(33)

32K documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
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++);
pf3

Partial preview of the text

Download DATA STRUCTURES AND ALGORITHMS - TEST 1 QUIZZES WITH COMPLETE SOLUTIONS and more Exams Advanced Education in PDF only on Docsity!

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)^ 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++);

What value is displayed by the cout statement? - Correct Answers - 1 Consider the C++ statements: int* ip = new int[3]{1,2,3}; cout << (++ip); What value is displayed by the cout statement? - Correct Answers - 2 Consider the C++ statements: int ip = new int[3]{1,2,3}; cout << (ip)++; What value is displayed by the cout statement? - Correct Answers - 1 Consider the C++ statements: int ip = new int[3]{1,2,3}; cout << ++(ip); What value is displayed by the cout statement? - Correct Answers - 2 For a resize_array() function, what is the correct formula to determine the number of resizes for n elements where n is an exact power of 2? - Correct Answers - log_2(n) For a resize_array() function, what is the correct formula to determine the total number of copied elements, n, when n is an exact power of 2? - Correct Answers - n- 1 True or false: The binary and linear search algorithms take the same number of comparisons to find the target in the worst case. - Correct Answers - False A quadratic algorithm, O(n^2), takes 10^3 sec to complete a task on the input size of 106 elements. What should the input size be for this algorithm to complete the same task in 4 · 10^3 sec? - Correct Answers - 210^ The first algorithm performs (10^−8)(n^2) operations on an input of the size n, and the second algorithm on the same input performs (10^3)n operations. True or false: "There exists an input such that the first and second algorithm performs the same number of operations." - Correct Answers - True! Which statement is true about the algorithm below? The running time function f (n) provides a formula for the number of operations (additions and assignments) done on