Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Quiz 4 Worksheet - Object Oriented Programming I | CMSC 132, Quizzes of Computer Science

Material Type: Quiz; Professor: Padua-Perez; Class: OBJECT-ORIENTED PROG II; Subject: Computer Science; University: University of Maryland; Term: Unknown 1989;

Typology: Quizzes

Pre 2010

Uploaded on 02/13/2009

koofers-user-n1p
koofers-user-n1p 🇺🇸

10 documents

1 / 2

Toggle sidebar

Related documents


Partial preview of the text

Download Quiz 4 Worksheet - Object Oriented Programming I | CMSC 132 and more Quizzes Computer Science in PDF only on Docsity!

CMSC 132 Quiz 4 Worksheet

The fourth quiz of the course will be on Monday, Nov 24 during your lab (discussion) session. The following list provides additional information about the quiz:

 The quiz will be a written quiz (no computer).  Closed book, closed notes quiz.  Answers must be neat and legible. We recommend that you use pencil and eraser.

The following exercises cover the material to be included in this quiz. Solutions to these exercises will not be provided, but you are welcome to discuss your solutions with TAs and instructors.

UML Design

  1. Write an UML class diagram for a system that allows you to keep track of the DVDs your friends have borrowed.
  2. Many cable companies offer a service called DVR (Digital Video Recording). In this service a hard- drive (around 120 Gigabytes) is used to store shows a user wants to record. Write an UML class diagram for the software that will control such a system.
  3. Write an UML class diagram for a system that accepts electronic submissions of computer programs similar to the submit server used in this course.

Graphs

Use the following graph for the questions below.

1. DFS/BFS

For each of the following exercises, specify the order nodes are visited when performing the appropriate traversal. Pick nodes to visit using alphabetical order (when multiple choices are possible).

a. Apply DFS with A as the start node. b. Apply DFS with C as the start node (assuming edges are undirected). c. Apply BFS with D as the start node. d. Apply BFS with F as the start node (assuming edges are undirected).

B

C D A F E 2

2. Single Source Shortest Path

For each of the following exercises, assume that all edges are undirected. Apply Dijkstra’s algorithm. Indicate the cost (for lowest weight path) and predecessor for each node in the graph after completing the algorithm. Also list the order nodes are added to the set of processed nodes.

For instance, applying Djikstra’s algorithm with C as the start node yields (after C is processed):

Node A B C D E F Cost ∞ 1 0 25 ∞ 8 Predecessor none C none C none C Order added 1

And after all nodes are processed:

Node A B C D E F Cost 10 1 0 5 7 8 Predecessor E C none B D C Order added 6 2 1 3 4 5

The shortest path to A from C is thus C→B→D→E→A, with a cost of 10.

a. Apply Dijkstra’s algorithm with A as the start node. List shortest path to F. b. Apply Dijkstra’s algorithm with B as the start node. List shortest path to F. c. Apply Dijkstra’s algorithm with E as the start node. List shortest path to C.