final10CS08_key

final10CS08_key - PIC 10C Final Exam Key Spring 2008 Prof....

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

View Full Document Right Arrow Icon
PIC 10C Final Exam Key Spring 2008 Prof. Todd Wittman 1.) [2 points] In C#, what does the reserved word override do? When is it used? A virtual function in the base class should have a corresponding override function in the derived class. The word override tells the compiler to use the derived version of the function rather than the version in the base class. 2.) [2 points] What does the BackgroundWorker control do? A BackgroundWorker allows a block of code to run asynchronously with the main UI thread. This allows time-consuming processes to run in the background without freezing up the GUI. 3.) [2 points] What does it mean to make graphics persistent ? Describe briefly our procedure for making C# graphics persistent. Persistent graphics stay on the screen after the screen is repainted, like when a window covers up the GUI. We made our graphics persistent by drawing all graphics to a Bitmap canvas and displaying the Bitmap every time the Paint event is fired. 4.) [4 points] Suppose in C++ we have a base class B and a derived class D . Suppose b and d are objects of classes B and D, respectively. B b; D d; Explain what happens in each situation below. a.) b = d; This runs, but any extra data fields in d are sliced away. b.) d = b; This gives a compile error. 5.) [5 points] Student records at Springfield University are stored in a class Student. The registrar wants to be able to quickly look up a student record based on either the student's name or ID number. Write a block of C++ code that sets up a multi-key hash table that allows O(1) look-up of a record by name or ID. To illustrate how records are inserted into the hash table, create a record for Lisa Simpson (major="English", ID=42) and insert it into the hash table. list<Student> L;
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
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 10C taught by Professor Wittman during the Spring '10 term at UCLA.

Page1 / 4

final10CS08_key - PIC 10C Final Exam Key Spring 2008 Prof....

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

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