DOC PREVIEW
UMD CMSC 132 - Midterm #1

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

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

Unformatted text preview:

Grader Use Only 1 2 3 4 5 Total Honors CMSC132 Fall 2005 Midterm 1 21 29 21 18 11 100 10 First Name Last Name Student ID Section time TA I pledge on my honor that I have not given or received any unauthorized assistance on this examination Your signature General Rules Read This exam is closed book and closed notes If you have a question please raise your hand Total point value is 100 points Answer True False questions by circling the T or F at the end of the question Answer multiple choice questions by circling the letter e g a b at the front of each choice Answer essay questions concisely using 1 or 2 sentences Longer answers are not necessary and are discouraged WRITE NEATLY If we cannot understand your answer we will not grade it i e 0 credit 1 2 Problem 1 Software Development Testing 21 pts A 1 pt Why are large pieces of software harder to develop than small pieces of software a Larger software take much more time to write b Larger software take many more programmers to write c Larger software take much faster computers to execute d Larger software require more computer memory e Larger software are more complex B 1 pt The software life cycle is a sequence of essential operations necessary for producing quality software Which of the following operation is not part of the software life cycle a Specification b Coding c Debugging d Testing e Release C 4 pts The waterfall model of software development a Describe its basic approach b Should be used for large software projects c Is accepted as the best model for developing software T or F T or F D 4 pts The unified model of software development a Describe its basic approach b Should be used for large software projects c Is accepted as the best model for developing software T or F T or F E 5 pts Problem specification is a phase of the software life cycle a Describe its basic goal b Specifications usually never change c Specifications can describe all possible inputs d Specifications written in English are very precise 3 T or F T or F T or F F 6 pts Program testing a What is black box testing b c d e Empirical testing depends on analysis of code Empirical testing can eliminate all errors Program verification depends on calculating pre post conditions Good unit tests eliminate the need for integration tests T or F T or F T or F T or F Problem 2 Object Oriented Design 29 pts G 5 pts Procedural oriented view vs object oriented design a Describe the procedural view approach to software design b Procedural oriented view produces programs which run faster T or F c Why do modern software developers prefer object oriented design H 6 pts Abstraction and encapsulation a Why do software developers use abstraction and encapsulation b Give an example of Java support for abstraction c Give an example of Java support for encapsulation I 6 pts Inheritance a Inheritance describes a relationship between related classes b Inheritance encourages code reuse c Many forms of inheritance exist in Java d Java supports combined multiple inheritance e Provide an example of how specification is supported in Java 4 T or F T or F T or F T or F J 12 pts Given the following problem description produce an object oriented solution Include as many details as possible Draw a UML class diagram you may write code for Java classes ONLY if you don t know UML but will lose points if you do so Write a submit server for student programming projects The submit server supports two types of users students and TAs Students can submit code to the server The server must record the time and code for student submissions in a database Once submitted the server must compile code execute it using test cases as input Test cases may be public or private Scores from executing code for each test case must be recorded and saved in the database Students may get their scores for each test case from the server TAs can also obtain test scores for all student submissions In addition TAs can also examine code from all student submissions 5 Problem 3 Unified Modeling Language 21 pts K 6 pts UML a Provides a software blueprint for object oriented software systems b Can describes both the static and dynamic behavior of a software system c Name two types of UML diagrams excluding class diagrams T or F T or F d Name four types of relationships between classes in a UML class diagram L 8 pts Given the following Java code draw its UML class diagram you may write code for Java classes ONLY if you don t know UML Include as much information as possible in the UML class diagram public interface Device public void setPower double power public class Speaker int volume 1 public void setVolume int volume this volume volume public String toString return Volume volume public class TV protected Speaker speaker public TV speaker new Speaker 2 speaker 0 new Speaker speaker 1 new Speaker public Speaker getSpeaker int number return speaker number 1 public class HDTV extends TV implements Device private double power public HDTV speaker 0 setVolume 10 speaker 1 setVolume 20 power 120 public void setPower double power this power power public String toString String res speaker 0 speaker 1 return res Power power 6 7 M 7 pts Consider the UML diagram below a Which class contains class F b Which class uses class B c Which class may change if class E changes d How many instances of class F does class E have e How many instances of class B does class E have f Class D may be used wherever Class A is used g Class C may be used wherever Class F is used A B 1 D T or F T or F E C 2 F Problem 4 Java Programming 18 pts N 7 pts Java Language Features a Static initialization blocks are all executed before constructors b Non static initialization blocks are all executed before constructors c Visibility modifiers determine which variables may be used where in Java d List the four types of visibility modifiers in Java 8 T or F T or F T or F O The class Laptop is defined as follows public class Laptop implements Comparable static ArrayList allLaptops new ArrayList private int id public Laptop int id this id id allLaptops add this public String toString return id a 4 pts Write code for the class Laptop so that it implements the Comparable interface in a way that larger id numbers are considered to be larger public int compareTo Object o b 4 pts Write code for a new method for class Laptop that will shuffle Laptop objects present in the ArrayList object associated with the static reference variable allLaptops hint use a method available in the


View Full Document

UMD CMSC 132 - Midterm #1

Documents in this Course
Notes

Notes

8 pages

Recursion

Recursion

12 pages

Sorting

Sorting

31 pages

HTML

HTML

7 pages

Trees

Trees

19 pages

HTML

HTML

18 pages

Trees

Trees

19 pages

Honors

Honors

19 pages

Lecture 1

Lecture 1

11 pages

Quiz #3

Quiz #3

2 pages

Hashing

Hashing

21 pages

Load more
Loading Unlocking...
Login

Join to view Midterm #1 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 Midterm #1 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?