S09_10C_key1 - Midterm Exam, 5/4/09 PIC 10C, Spring 2009...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Midterm Exam, 5/4/09 PIC 10C, Spring 2009 KEY You have 50 minutes to complete this exam. This exam is open book, open notes. Write your answers carefully. Incomplete, unintelligible, or illegible answers will receive little or no credit. When you are asked to write a program, it is not necessary to comment your code but you are expected to indent appropriately to make your code easier to follow. There are a total of 50 points on this exam. PAGE SCORE POSSIBLE 1 10 2 8 3 7 4 25 TOTAL 50
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
1 WRITTEN PART 1.) [2 points] In C#, what does the GroupBox control do and when is it used? The GroupBox control tells the program that a collection of controls are associated with each other in a group. This is useful for setting up groups of radio buttons, because only one radio button in a group can be checked at a time. 2.) [2 points] Mr. Burns stores the names of all his employees in a C++ list L<string> , sorted from most valuable to the least valuable employee. Mr. Burns wants to know who to fire next, so he tries the following code to print out his worst employee. cout << L.end(); Unfortunately, this code gives a run-time error. Explain what the error is and show how to fix it. The node at L.end() is a NULL sentinel node, so there is no data to print. To fix it, he should set the iterator at the end() and back up one. list<string>::iterator iter = L.end(); iter--; cout << *iter; 3.) [6 points] Write the single line of C++ code that accomplishes the following tasks. You may use the <algorithm> library and the STL constainers.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/18/2010 for the course PIC 157052201 taught by Professor Wittman during the Spring '10 term at UCLA.

Page1 / 6

S09_10C_key1 - Midterm Exam, 5/4/09 PIC 10C, Spring 2009...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online