Quiz 4 - GradeDetailView GradingSummary resultsofyourexam.Gradesforessay questions,andcommentsfromyour instructor,areinthe\"Details\"section below

Quiz 4 - GradeDetailView GradingSummary...

  • Test Prep
  • 6
  • 100% (40) 40 out of 40 people found this document helpful

This preview shows page 1 out of 6 pages.

You've reached the end of your free preview.

Want to read all 6 pages?

Unformatted text preview: 7/18/2015 Grade Detail View Grading Summary These are the automatically computed results of your exam. Grades for essay questions, and comments from your instructor, are in the "Details" section below. Question Type: Date Taken: Time Spent: Points Received: 6/27/2015 26 min , 58 secs 36 / 40 (90%) # Of Questions: # Correct: Multiple Choice 2 2 Short 8 N/A Grade Details ­ All Questions 1. Question : What is the output from the following sequence of instructions? int arr = {5, 9, 2, 7}; int arrSize = sizeof(arr)/sizeof(int); list alist(arr, arr+arrSize); alist.pop_front(); cout << alist.back(); // Output: __________ Student Answer: 7 Instructor Explanation: output = 7 Points Received: Comments: 2. Question : 4 of 4 What is the output from the following sequence of instructions? int arr = {5, 9, 2, 7}; int arrSize = sizeof(arr)/sizeof(int); list alist(arr, arr+arrSize); alist.pop_front(); cout << alist.front(); // Output: __________ Student Answer: 9 Instructor Explanation: output = 9 Points Received: Comments: 3. Question : 4 of 4 What is the output from the following sequence of instructions? int arr = {5, 9, 2, 7}; int arrSize = sizeof(arr)/sizeof(int); list alist(arr, arr+arrSize); alist.pop_front(); data:text/html;charset=utf­8,%3Ch2%20class%3D%22headertitle%22%20style%3D%22margin%3A%200px%3B%20padding%3A%200px%3B%20font­size%… 1/6 7/18/2015 Grade Detail View alist.pop_back(); cout << alist.back(); // Output: __________ Student Answer: 2 Instructor Explanation: output = 2 Points Received: Comments: 4. Question : 4 of 4 What is the output from the following sequence of instructions? int arr = {5, 9, 2, 7}; int arrSize = sizeof(arr)/sizeof(int); list alist(arr, arr+arrSize); alist.pop_front(); alist.pop_back(); alist.pop_front(); alist.push_front(7); alist.back() = alist.front(); writeList(alist); Output: ______ ______ Student Answer: 7 7 Instructor Explanation: Output = 7, 7 Points Received: Comments: 5. Question : 4 of 4 The object alist is a list object. Identify the sequence of operations (a, b, c, or d) that would store the following elements in the object alist. 8 6 2 5 7 Student Answer: (a) alist.push_front(2) alist.push_front(8); alist.push_front(6); alist.push_back(5); alist.push_back(7); (b) alist.push_back(2) alist.push_back(7); alist.push_front(8); data:text/html;charset=utf­8,%3Ch2%20class%3D%22headertitle%22%20style%3D%22margin%3A%200px%3B%20padding%3A%200px%3B%20font­size%… 2/6 7/18/2015 Grade Detail View alist.push_front(6); alist.push_back(5); (c) alist.push_front(2) alist.push_back(5); alist.push_front(6); alist.push_front(8); alist.push_back(7); (d) alist.push_front(6) alist.push_back(7); alist.push_back(5); alist.push_back(2); alist.push_front(8); Points Received: Comments: 6. Question : 4 of 4 After executing the following statements, what is the resulting list? list alist list::iterator iter; alist.push_front("tom"); alist.push_front("sue"); iter = alist.begin(); iter++; alist.insert(iter,"dave"); alist.insert(iter,"bill"); alist: __________ __________ __________ __________ Student Answer: sue bill dave tom Instructor Explanation: alist: sue dave bill tom Points Received: Comments: 7. Question : 2 of 4 What is the action of the function f()? data:text/html;charset=utf­8,%3Ch2%20class%3D%22headertitle%22%20style%3D%22margin%3A%200px%3B%20padding%3A%200px%3B%20font­size%… 3/6 7/18/2015 Grade Detail View template <typename T> void f(list<T>& alist, const T& item) { list<T>::iterator iter; for(iter = alist.begin(); iter != alist.end(); iter++) if (*iter == item) return; alist.push_back(item); } Student Answer: inserts duplicate elements in a list reorder duplicate elements to occupy successive places in the list updates the item if it already exists in the list inserts an item only if it is not already in the list Points Received: Comments: 8. Question : 4 of 4 Assume the following declarations: list<int> intList; list<int>::iterator intIter; and that the list already has the elements 2 8 5 What are the contents of the list after statements below? Note: The statements are cumulative. intIter = intList.begin(); intList.insert(intIter,4); list: ____________________________ Student Answer: Instructor Explanation: Points Received: 4 2 8 5 list: 4 2 8 5 4 of 4 Comments: data:text/html;charset=utf­8,%3Ch2%20class%3D%22headertitle%22%20style%3D%22margin%3A%200px%3B%20padding%3A%200px%3B%20font­size%… 4/6 7/18/2015 Grade Detail View 9. Question : Assume the following declarations: list<int> intList; list<int>::iterator intIter; and that the list already has the elements 2 8 5 What are the contents of the list after statements? Note: The statements are cumulative. intIter = intList.end(); intList.insert(intIter,15); list: ____________________________ Student Answer: 2 8 15 5 Instructor Explanation: list: 4 2 8 5 15 Points Received: Comments: 10. Question : 4 of 4 Assume the following declarations: list<int> intList; list<int>::iterator intIter; and that the list already has the elements 2 8 5 What are the contents of the list after statements? Note: The statements are cumulative. intIter = intList.begin(); intIter++; intIter++; intList.erase(intIter++); intList.insert(intIter,3); list: ____________________________ data:text/html;charset=utf­8,%3Ch2%20class%3D%22headertitle%22%20style%3D%22margin%3A%200px%3B%20padding%3A%200px%3B%20font­size%… 5/6 7/18/2015 Grade Detail View Student Answer: 2 8 3 Instructor Explanation: list: 4 2 3 5 15 Points Received: 2 of 4 Comments: data:text/html;charset=utf­8,%3Ch2%20class%3D%22headertitle%22%20style%3D%22margin%3A%200px%3B%20padding%3A%200px%3B%20font­size%… 6/6 ...
View Full Document

  • Spring '14
  • Cigas,John
  • Data Structures, Student Answer, 6th Marine Regiment

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes