DOC PREVIEW
UMD CMSC 132 - Midterm 1 Solutions

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:

Create complete, accurate, and unambiguous statement of problem to be solvedTest behavior in response to inputs with no knowledge of codeView the problem as a series of actions to be abstracted into proceduresIt provides data abstraction and encapsulationReduce complexity of softwareClasses, methods, APIs …Classes with private data, class libraries with APIAbstract methods & classesSequence, use-case, state, activityAssociation, dependency, generalization, implementationEA, CB, F0 or more0Private, public, protected, none/default/packageEverything except class HandlerClass HandlerGeneralizationAssociationDependencyAny Java code with a while loopCMSC 132 Fall 2005 Midterm 1 SolutionsProblem 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 writeb. Larger software take many more programmers to writec. Larger software take much faster computers to executed. 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. Specificationb. Codingc. Debuggingd. Testinge. ReleaseC. (4 pts) The waterfall model of software development…a. Describe its basic approachProceed from each component of software life cycle to the next b. Can be used for large software projects T or Fc. Is accepted as the best model for developing software T or FD. (4 pts) The unified model of software development…a. Describe its basic approachIteratively add incremental improvements in phasesb. Can be used for large software projects T or Fc. Is accepted as the best model for developing software T or FE. (5 pts) Problem specification is a phase of the software life cyclea. Describe its basic goalCreate complete, accurate, and unambiguous statement of problem to be solvedb. Specifications usually never change T or Fc. Specifications can describe all possible inputs T or Fd. Specifications written in English are very precise T or F1F. (6 pts) Program testinga. What is “black box” testing?Test behavior in response to inputs with no knowledge of codeb. Empirical testing depends on analysis of code T or Fc. Empirical testing can eliminate all errors T or Fd. Program verification depends on calculating pre & post-conditions T or Fe. Good unit tests eliminate the need for integration tests T or FProblem 2 Object-Oriented Design (29 pts)G. (5 pts) Procedural-oriented view vs. object-oriented design a. Describe the procedural-view approach to software designView the problem as a series of actions to be abstracted into proceduresb. Procedural-oriented view produces programs with less overhead T or Fc. Why do modern software developers prefer object-oriented design?It provides data abstraction and encapsulationH. (6 pts) Abstraction and encapsulation a. Why do software developers use abstraction and encapsulation?Reduce complexity of softwareb. Give an example of Java support for abstractionClasses, methods, APIs …c. Give an example of Java support for encapsulationClasses with private data, class libraries with APII. (6 pts) Inheritancea. Inheritance describes a relationship between related classes T or Fb. Inheritance encourages code reuse T or Fc. Many forms of inheritance exist in Java T or Fd. Java supports combined (multiple) inheritance T or Fe. Provide an example of how specification is supported in JavaAbstract methods & classes2J. (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 Javaclasses 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 twotypes of users, students and TAs. Students can submit code to the server. The server mustrecord the time and code for student submissions in a database. Once submitted, the servermust compile code & execute it using test cases as input. Test cases may be public orprivate. Scores from executing code for each test case must be recorded and saved in thedatabase. Students may get their scores for each test case from the server. TAs can alsoobtain test scores for all student submissions. In addition TAs can also examine code fromall student submissions.Nouns: Server, User, Student, TA, Time, Code, Submissions, Database, Test Cases, ScoresVerbs: Submit, Record, Compile, Execute, Get (Scores), Examine (Code) 3ServermyDB : DatabasemyCode : Code [ ]myTests : Test [ ]recordSubmission()UsergetScore()Studentsubmit(Code)TAexamine(Code)DatabaseTime [ ]Scores [ ]CodeCompile( )Execute(Test)TestTypeServermyDB : DatabasemyCode : Code [ ]myTests : Test [ ]recordSubmission()UsergetScore()Studentsubmit(Code)TAexamine(Code)DatabaseTime [ ]Scores [ ]CodeCompile( )Execute(Test)TestTypeProblem 3 Unified Modeling Language (21 pts)K. (6 pts) UML …a. Provides a software blueprint for object-oriented software systems T or Fb. Can describes both the static and dynamic behavior of a software system T or Fc. Name two types of UML diagrams (excluding class diagrams)Sequence, use-case, state, activityd. Name four types of relationships between classes in a UML class diagramAssociation, dependency, generalization, implementationL. (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);} }4DevicesetPower(double) : voidSpeakervolume : inttoString() : StringTVSpeaker : Speaker [


View Full Document

UMD CMSC 132 - Midterm 1 Solutions

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
Download Midterm 1 Solutions
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 Midterm 1 Solutions 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 Solutions 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?