Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

CPE 212 Sample Exam III Page 6 of9 CPE 212-01 Spring 2018 Exam lll Problems 22-2

ID: 3717793 • Letter: C

Question

CPE 212 Sample Exam III

Page 6 of9 CPE 212-01 Spring 2018 Exam lll Problems 22-28 are based on the following Queue class code segment class QueueFull Expty exception class * CPE 212-01 Spring 2018 Exam IlIl 24. Which if any of the following code segments coerectly implements the Add0 method? Your solution must have no memory leaks!! A) void Qe::Add(int n) B) void Cueue: :Add (int n) clana Qoeuepty Fapty exception clas threw queueFullo data Noder tenp-noxt NULL if (tront f Pointer to next node in the qaeue Linkad nede irpienantation of Quee ADT tode front: Pointer to front node of ueu Pointer to last node of queue public: // Dafault constructor init.alizes Tanua to he …ty C) void Queuo: Add Cint n) void add(int n) Enqweues value ni if fuil, thows QeFul1 exception Dequues and returns next value trem the Tuese It enpty, thows eeEnpty exoeption if (IsFull) if ?IsFull()) else bool IsFullo const Returns true if queue is full return false othervise bool IEnpty onst I Returns true f quene is epty xeturn false otheise Node* temp->data // Returns naaber of data walue? stored 1n queue 22. Which iany of the following code segments correctly implements the Queue constructor? A) Queue: Qeue) B) Queue:Queue ) rear-next-tep C) Queue::Queue const D) Queue::Queue E) None of the answers providecd 25. Which if any of the following code segments correctly implements the Queue dastructor? E) None of the answers provideod dolete front doleto roar; dolete tront; 23. Which ifany of the fallowing code segments correctly implements the IsEmpty method? A) bool Quee:IsEmpty const B) bool Q:IsErpty ) C) Queue:Quoue ) D) Queue::Qoue0 return (eount 0) C) bool Qe:IsEmptyO const D) bool QuIsEnpty while IsEnpty dolote tront E) Nono of the answors providocd E) None of the answers provided CPE 212-01 Spring 2018 Exam Page 8 of 9 CPE 212-01 Spring 2018 Exam Ill Page 9 of 9 28. Which if any of the folowing code segments comecty impements the Size() method? 26. Which if any of the folowing code sogments correctly implements the IsFull0 method? A) int Qeue::Size const B) int Queue: :Sze const A) bool QeeIsFuli const B) bool QIsFul1 const caunt bile (rear NULL t) count+ t front->next; = C) bool Queue: :IsFul1 const D) bool Queue: :IsFu110 const return count ery - new Node return false count count cateh Node* tonpfront: Node tonpfront: while erp NULL) E) None of the answers provided return eount: 27. Which if any of the folowing code sogments correctly implements the Romovo0 mothod? E) None of the answers provided A) int iEpty) if IsEnpty 29. When inserting a new data value into an Unsorted Linked List, where is the least e cient positon to add the new data value? Kode frent-front-next delete tenp Node+ Eront A) Afler the last element currently stored in the container B) Before the first element currently stored in the container C) In between two elements currently stored in the container D) None of the answers provided 30. What is the complexity of the inserting a data value into an Sorted Array-Based List? C) int 00::Renove () A) 011) E) None of the answers provided if (IsEpty 31. What is the complexity of the constructor operation for a Sorted Array-Based List? A) O(1) ?) ??) C) Olo9sN) D) 0(N ) E) None of the answers provided frontfront->next; int value tenp data: delete terp: return valve: delete tomp 32. What is the complexity of the destructor operation for an Unsorted Linked List? A) O(1) B) op) C> Olo9sN) D) 0(N ) E) None of the answers provided E) None of the answers provided

Explanation / Answer

Answer;-------

22. C

23. A

24. B

25. D

26. E

27. D

28. A

29. A

30. C

31. B

32. B

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote