Comprehensive Exam Answers PDF
Document Details
![EasySousaphone9888](https://quizgecko.com/images/avatars/avatar-12.webp)
Uploaded by EasySousaphone9888
American University of Science and Technology
2022
Tags
Summary
This document contains answers to a computer science comprehensive exam from June 24, 2022. The exam covers various topics including data structures, algorithms (e.g., sorting).
Full Transcript
6/28/22, 1:50 PM Comprehensive Exam: Attempt review Home / My Courses / Comprehensive Examination - Section A / Comprehensive Exam / Comprehensive Exam Question 1 Correct M...
6/28/22, 1:50 PM Comprehensive Exam: Attempt review Home / My Courses / Comprehensive Examination - Section A / Comprehensive Exam / Comprehensive Exam Question 1 Correct Mark 1.00 out of 1.00 The preorder traversal of a certain binary search tree is 10532151220 If the value 11 is then added to this tree, what is the preorder traversal of the resulting tree? (hint: First, draw the tree, using the fact that it is a search tree.) a. 10 11 5 3 2 15 12 20 b. 10 5 3 2 15 11 12 20 c. 10 5 3 2 15 12 11 20 d. 11 10 5 3 2 15 12 20 The correct answer is: 1053215121120 https://aust.mrooms.net/mod/quiz/review.php?attempt=423788&cmid=201257&showall=1 1/60 6/28/22, 1:50 PM Comprehensive Exam: Attempt review Question 2 Correct Mark 1.00 out of 1.00 When an array is to be sorted, it may happen that some data values start out being in the same position where they should end up. For example, in the array which is originally 40-1330 the 33 is right where it will be in the fnal sorted output: -103340 But as a particular sorting algorithm operates, it might (depending on the algorithm) move such an element out of the position where it belongs (of course, it will eventually get moved back). Which of the following statements are true? I. Mergesort never (even temporarily) moves such an element. II. Quicksort never (even temporarily) moves such an element. III. Selection sort never (even temporarily) moves such an element. a. I only b. I and III c. II and III d. II only The correct answer is: II and III https://aust.mrooms.net/mod/quiz/review.php?attempt=423788&cmid=201257&showall=1 2/60 6/28/22, 1:50 PM Comprehensive Exam: Attempt review Question 3 Incorrect Mark 0.00 out of 1.00 The initial confguration of the queue is a,b,c,d (a is the front end). To get the confguration d,c,b,a one needs a minimum of ? a. 3 deletions and 3 additions b. 3 additions and 2 deletions c. 3 deletions and 4 additions d. 2 deletions and 3 additions The correct answer is: 3 deletions and 3 additions Question 4 Correct Mark 1.00 out of 1.00 Linked lists are not suitable data structure for which one of the following problems? a. Binary search b. Radix sort c. Insertion sort d. Polynomial manipulation The correct answer is: Binary search https://aust.mrooms.net/mod/quiz/review.php?attempt=423788&cmid=201257&showall=1 3/60 6/28/22, 1:50 PM Comprehensive Exam: Attempt review Question 5 Correct Mark 1.00 out of 1.00 Context free language can be recognized by a. Linear bounded automation and Pushdown automation b. pushdown automation c. Finite State Automation d. Linear bounded automation The correct answer is: Linear bounded automation and Pushdown automation https://aust.mrooms.net/mod/quiz/review.php?attempt=423788&cmid=201257&showall=1 4/60 6/28/22, 1:50 PM Comprehensive Exam: Attempt review Question 6 Incorrect Mark 0.00 out of 1.00 What is the output of this program? #include using namespace std; int main() { int x = 5, y = 5, z = 0; x = ++x; y = --y; z = x++ + y--; cout