DATA STRUCTURES AND ALGORITHMS IN
CPLUSPLUS COMPREHENSIVE EXAM
SCRIPT VERIFIED QUESTIONS AND
SOLUTIONS GRADED APLUS
●● What is the advantage of a linear search?
Answer: It is simple and can be used on unordered data.
●● Which search is more efficient, binary or linear?
Answer: Binary search is more efficient than linear search.
●● Where does a binary search begin in an array?
Answer: It begins with the middle element of an array.
●● Can binary search find an item more quickly than linear search in an
unordered set?
Answer: False.
●● What is the minimum amount of passes that bubble sort will ever
make?
Answer: One.
, ●● Can pointer variables modify data in other variables?
Answer: False.
●● What are access specifiers in a class?
Answer: The area(s) in a class that specify what can have access to those
members of the class.
●● What is a class in programming?
Answer: An encapsulation of data items and operations on those items.
●● What is an object in programming?
Answer: A single instance of a class.
●● What does the statement 'int *ptr = new int;' do?
Answer: It acquires memory to hold an integer and sets ptr to point to
the allocated memory.
●● What command is used to free up memory that a pointer points to?
Answer: The delete command.
●● Can a programmer decide what values are acceptable for a custom
data type?
Answer: True.
CPLUSPLUS COMPREHENSIVE EXAM
SCRIPT VERIFIED QUESTIONS AND
SOLUTIONS GRADED APLUS
●● What is the advantage of a linear search?
Answer: It is simple and can be used on unordered data.
●● Which search is more efficient, binary or linear?
Answer: Binary search is more efficient than linear search.
●● Where does a binary search begin in an array?
Answer: It begins with the middle element of an array.
●● Can binary search find an item more quickly than linear search in an
unordered set?
Answer: False.
●● What is the minimum amount of passes that bubble sort will ever
make?
Answer: One.
, ●● Can pointer variables modify data in other variables?
Answer: False.
●● What are access specifiers in a class?
Answer: The area(s) in a class that specify what can have access to those
members of the class.
●● What is a class in programming?
Answer: An encapsulation of data items and operations on those items.
●● What is an object in programming?
Answer: A single instance of a class.
●● What does the statement 'int *ptr = new int;' do?
Answer: It acquires memory to hold an integer and sets ptr to point to
the allocated memory.
●● What command is used to free up memory that a pointer points to?
Answer: The delete command.
●● Can a programmer decide what values are acceptable for a custom
data type?
Answer: True.