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

CPE 212 Sample Exam III This is just one part of a sample exam I am working to s

ID: 3717789 • Letter: C

Question

CPE 212 Sample Exam III

This is just one part of a sample exam I am working to study for my final at 3PM today, I have posted the others as well, I put "CPE 212 Sample Exam III" in each post so it's easy to find the others.

CPE 212-01 Spring 2018 Exam lII 00. Which if any of the ollawing code segments correctly implements the method Push? 10. Which if any of the sollawing code segments correctly implements the method Available? A) void stack: :Available cost B) int Stack::Available) const int Peek(int n) eonst: / Retuens th value n poaitions dovn fros top elezent C) int Stack: Available) const D) int Stack::Available) const int Available oonst: 1/ Return the nunber of unused array elements 08. Which if any of the following code segments correcty implements the constructor for Stack? 11. Which if any af the follawing code segments correctly impiements the method -Stack 12. Which if ary of the following code segments correctly implements the mathod Pop? 15. Suppose that a queue object contains the fo lowing values Front (1,3, 5, 7) Rear 16. Suppose that a queue object contains the folowing valuas Front 1, 3,5, 7 Rear What is the contents of the queue after the fo lowing operation (x is int)? Dequeuelx) 17, Suppose that a queue object contains the folowing value8 Front 1, 3, 5,7 Rear What is the contents of the queue after the fo lowing sequence of operations are executed 18. Suppose that a qucue object contains the following values Front (1, 3, 5,7) Rear, 13. Which if any of the following code segments corectly implements the method Peek? const What is the contents of the queue after the fo lowing sequence of operations are executed A) ?nt Stack: ;Peek { int n? B) int stack; :Peek(int n} const 19. Suppose the dient code wishes to create a Queue object named Q Which of the following code C) void Stack: :Peek(int n) const D) void Stack: Peek (int n) const 20. Suppose the dient code indludes a Queue object named Q. Which of the following code segments successfully uses the Enqueue method to add the integer value 3 to the object Q? 21. Suppose the dient code includes a Queue object named Q. Which of the following code segments successfully uses the Dequeue method to remove the next integer value shored in Q and place that integer into the integer variable W 14. Assuming that the Stack object named s has been declared correctly in the cient program, which of the following code segments correctly adds the integer value 5 to the top of stack s

Explanation / Answer

Answers:

8) C

9) D

10) B

11) A

12) C

13) D

14) C

15) A

16) C

17) C

18) C

19) C

20) B

21) C