This preview shows page 1-2-3 out of 10 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 10 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 10 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 10 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 10 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

6.893 User Interface Design & Implementation Fall 2003 Quiz 2 This quiz is closed book, closed notes. You have 80 minutes to complete it. Your name: ___________________________________________________ 1. (3 points) Which of the following problems is most likely to be found by a user test of a horizontal computer prototype? a. Response time is too slow. b. One dialog box uses a different font than another dialog box. c. A dialog box covers up information that the user needs from the main window. d. Color choices are bad for blue-yellow color-blind users. 2. (4 points) Name the two main categories of computer prototyping tools, and give one advantage that each category has over the other. 3. (3 points) Which of the following is an advantage of the model-view-controller pattern? a. Models can be put inside other models. b. Multiple views can display the same model. c. Views and controllers are often tightly coupled. d. The controller separates the model from the view, so they don’t have to know about each other.4. (3 points) Which of the following is the least related to the view hierarchy? a. Input handling b. Clipping c. Models d. Automatic layout 5. (4 points) Give 2 reasons why the view and the controller are often tightly coupled. 6. (4 points) List 4 kinds of translated input events. 7. (4 points) The observer pattern is typically used in MVC as a way for the controller to receive input events. How else is the observer pattern used in MVC? 8. (4 points) Louis Reasoner wants to use mouse triple-clicks in his application. He decides to measure the time between clicks by checking the system clock with System.currentTimeMillis(). What’s wrong with this approach?9. (4 points) Alyssa Hacker is designing a checkers game in which the user makes moves by dragging checkers around the board with the mouse. She’s wrestling with a strange bug: if the user is dragging a checker and moves the mouse quickly, the checker sometimes stops following the mouse, even though the user hasn’t released the mouse button. The checker freezes in place until the user moves the mouse pointer back over it, at which point it starts moving with the mouse again. (You don’t know what UI toolkit Alyssa is using, but it isn’t Swing.) From this behavior, describe: a. the output model she’s using to represent the checkers; b. how she’s handling the mouse input for checker dragging; c. what’s causing the bug, and how it might be fixed. 10. (4 points) Give one advantage and one disadvantage of using components for output, as compared to strokes.11. (4 points) Louis Reasoner is writing a Swing widget. He figures he can improve its responsiveness by saving the Graphics object passed to paint(), so that he can draw to it immediately whenever the model changes. Here’s some of his code: public class LouisWidget extends JComponent { Graphics savedGraphics; ... void paint (Graphics g) { savedGraphics = g; // save Graphics object for later use g.drawLine (...); // draw widget as usual ... } void modelChanged () { if (savedGraphics != null) { // draw changes on the screen right away savedGraphics.drawLine (...); ... } } } Although Ben Bitdiddle thinks Louis’s optimization is unnecessary, he’s more concerned that Louis has implemented it incorrectly. What is it about the Graphics object – and analogous objects in other UI toolkits – that makes it a bad idea to save it like this?12. (3 points) In the HSV color model, what color is the fully unsaturated counterpart of pure red (i.e., identical on all components except S = 0)? a. Black b. White c. Pink d. Green 13. (3 points) RGB and HSV color models are both three-dimensional – i.e., each color has three components. RGB is represented by a cube, logically enough. But HSV isn’t. How is HSV represented, and why? 14. (4 points) Give 2 reasons to use your platform’s native button widget rather than implementing your own -- 1 reason related to software engineering, and 1 reason related to usability. 15. (3 points) List 3 kinds of user tests. 16. (3 points) The double-buffering technique is used for: a. Coalescing mouse movements b. Preventing screen flicker c. Capturing the mouse d. Transforming coordinate systems17. (4 points) In this problem, you will implement an output effect called a drop shadow. A drop shadow makes it look like a screen object is casting a shadow by drawing an identical copy of the object shifted slightly in both x and y directions. Here are some examples of drop shadows: For the purposes of this problem, a drop shadow is gray and shifted 4 pixels in the positive x and y direction. Create a drawing surface ShadowGraphics that automatically draws a drop shadow for every drawn stroke. ShadowGraphics is a wrapper around a Graphics object that does the actual drawing. Here’s an example of using ShadowGraphics: void paint (Graphics g) { ShadowGraphics sg = new ShadowGraphics (g); sg.drawText (0, 0, “This text has a drop shadow”); g.drawText (0, 50, “This text has no shadow”); } Here’s what might appear on the screen for this code: For this problem, we’ll use a simplified version of Graphics that only draws text: interface Graphics { void drawText (int x, int y, String text); void setColor (Color color); Color getColor (); void setFont (Font font); Font getFont (); } So you don’t need to worry about lines, rectangles, circles, etc. Fill in the skeleton of ShadowGraphics on the next page so that it automatically draws a drop shadow for every drawText() drawing call.    class ShadowGraphics implements Graphics { Graphics g; ShadowGraphics (Graphics g) { this.g = g; } void drawText(int x, int y, String text) { } void setColor (Color color) { } Color getColor () { } void setFont (Font font) { } Font getFont () { } }18. (4 points) Ben Bitdiddle proposes implementing drop shadows for the component model: a container class ShadowContainer that draws


View Full Document

MIT 6 831 - Quiz 2

Documents in this Course
Output

Output

15 pages

Quiz 2

Quiz 2

8 pages

Input

Input

9 pages

Load more
Download Quiz 2
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Quiz 2 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Quiz 2 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?