Department of Civil and Environmental Engineering, Spring Semester, ENCE 688R: Final Exam: 2 Hours, Open Book and Open Notes
|
|
- Gerard Logan
- 5 years ago
- Views:
Transcription
1 Department of Civil and Environmental Engineering, Spring Semester, 2017 ENCE 688R: Final Exam: 2 Hours, Open Book and Open Notes Name : Question Points Score Total 100 1
2 Question 1: 50 points This question builds upon the many-to-many association example given in Chapter 11 of the class notes, and adds constraints on the number of entities that can participate in the student-department association relationship. Student TinyDepartment Figure 1: Association relationship between students and a tiny department. Figure 1 is a graphical representation of the constrained association relationship. The constraints are as follows: 1. A student can belong to at most 2 departments. 2. The minimum number of students that can be enrolled in a department is one. 3. The maximum number of students that can be enrolled in a department is three. Now let s suppose that you are experimenting with the following set of source code files: build.xml, Student.java, TinyDepartment.java, The test program is TestTinyUniversity.java. Details of the java source code files are as follows: File: Student.java source code /* * =========================================================== * Student.java: Students can enroll in up to two departments. * * Written by: Mark Austin May 2017 * =========================================================== */ package school; import java.util.collection; import java.util.arraylist; import java.util.iterator; public class Student { private int id; private String name; private int MaximumDepartments = 2; 2
3 // Collection of departments in which the student enrols. private Collection<TinyDepartment> departments; // Constuctor method... public Student() { departments = new ArrayList<TinyDepartment>(); // Setup student Ids... public int getid() { return id; public void setid(int id) { this.id = id; // Set student name... public String getname() { return name; public void setname(string name) { this.name = name; // Student enrols in a department... public void add( TinyDepartment department ) { // Check to see if enrollment limit has been reached... if ( getdepartments().size() == MaximumDepartments ) { System.out.println("*** Enrollment limit exceeded!! "); return; // Add new department to students resume.. if ( getdepartments().contains(department) == false ) { getdepartments().add(department); // Update list of students enrolled in the department.. if ( department.getstudents().contains(this) == false ) { department.getstudents().add(this); 3
4 // Student drops-out of a department... public void remove( TinyDepartment department ) { // Remove department from students resume.. if ( getdepartments().contains(department) == true ) { getdepartments().remove(department); // Update list of students enrolled in the department.. if ( department.getstudents().contains(this) == true ) { department.getstudents().remove(this); // Return collection of departments... public Collection<TinyDepartment> getdepartments() { return departments; public void setdepartment( Collection <TinyDepartment> departments) { this.departments = departments; // Create String representation of student object... public String tostring() { String s = "Student: " + name + "\n"; s = s + "Departments: "; if ( departments.size() == 0 ) s = s + " none \n"; else { Iterator iterator1 = departments.iterator(); while ( iterator1.hasnext()!= false ) { TinyDepartment dept = (TinyDepartment) iterator1.next(); s = s + dept.getname() + " "; s = s + "\n"; return s; File: TinyDepartment.java source code 4
5 /* * ================================================================= * TinyDepartment.java; Simple model of a small academic department. * * Written by: Mark Austin May 2017 * ================================================================= */ package school; import java.util.arraylist; import java.util.collection; import java.util.iterator; public class TinyDepartment { private int id; private String name; private int MinimumStudents = 1; private int MaximumStudents = 3; // Setup collection of students... private Collection<Student> students; // Constructor method... public TinyDepartment(){ students = new ArrayList<Student>(); // Set/get the department Id. public int getid() { return id; public void setid(int id) { this.id = id; // Methods to deal with the department name... public String getname() { return name; public void setname(string deptname) { this.name = deptname; // ========================================================= // Add a student to department... // ========================================================= public void add (Student student) { 5
6 // Department is full. Reject application... if ( students.size() == MaximumStudents ) { System.out.printf("*** Department %s is full... \n", getname() ); System.out.printf("*** Applicant rejected: %s... \n\n", student.getname() ); return; // Add student to department... if ( getstudents().contains(student) == false ) { System.out.printf("*** Adding student: %s to %s... \n\n", student.getname(), getname() ); getstudents().add(student); // Update departments on the student side... if ( student.getdepartments().contains(this) == false ) { student.getdepartments().add(this); // ========================================================= // Remove a student from department... // ========================================================= public void remove ( Student student ) { // Remove student from department... if ( getstudents().contains( student ) == true ) { getstudents().remove( student ); // Remove department from student s record... student.remove (this); public Collection<Student> getstudents() { return students; public void setstudent( Collection<Student> students ) { this.students = students; // Create a String representation for the department... public String tostring() { StringBuffer buf = new StringBuffer(); 6
7 buf.append( String.format("Academic Department: %s...\n", getname() ) ); buf.append( String.format("Current enrollment = %2d...\n", students.size() ) ); buf.append( String.format("Maximum enrollment = %2d...\n", MaximumStudents ) ); buf.append( "Students: " ); if ( students.size() == 0 ) buf.append( " none \n" ); else { Iterator iterator1 = students.iterator(); while ( iterator1.hasnext()!= false ) { Student student = (Student) iterator1.next(); buf.append( String.format(" %s ", student.getname() ) ); buf.append( "\n" ); return buf.tostring(); File: TestTinyUniversity.java source code /* * ====================================================================== * TestTinyUniversity.java: Simulate many-to-many relationships between * students and the departments in which they enroll in a tiny university. * * Two constraints are placed on the student-department association * relationship: * * 1. Students can only enrol in one department. * 2. AcademicDepartments must have a least one student, but no more * than three. * * Written by: Mark Austin May 2017 * ====================================================================== */ package demo; import school.*; public class TestTinyUniversity { public static void main( String[] args ) { System.out.println( "Part 1: Create academic departments and students" ); System.out.println( "================================================" ); // Create academic department objects... 7
8 TinyDepartment civil = new TinyDepartment(); civil.setname("cee"); TinyDepartment eecs = new TinyDepartment(); eecs.setname("ece"); // Create student objects... Student student01 = new Student(); student01.setname("arash"); Student student02 = new Student(); student02.setname("mingxi"); Student student03 = new Student(); student03.setname("linyu"); Student student04 = new Student(); student04.setname("xi"); Student student05 = new Student(); student05.setname("tingzhen"); System.out.println( "Part 2: Add students to engineering departments" ); System.out.println( "===============================================" ); // Add student to civil engineering... civil.add( student01 ); // Add students to electrical engineering... eecs.add( student02 ); eecs.add( student03 ); eecs.add( student04 ); eecs.add( student05 ); System.out.println( "Part 3: Plan B: Tingzhen applies to Civil Engineering..." ); System.out.println( "=========================================================" ); civil.add( student05 ); System.out.println( "Part 4: Summary of Department-Student Associations" ); System.out.println( "==================================================" ); System.out.println( civil ); System.out.println( eecs ); System.out.println( "Part 5: Linyu switches from Electrical to Civil..." ); System.out.println( "===================================================" ); student03.remove( eecs ); student03.add( civil ); 8
9 System.out.println( "Part 6: Validate Linyu s enrollment in CEE and ECE..." ); System.out.println( "======================================================" ); System.out.println( student03 ); System.out.println( civil ); System.out.println( eecs ); System.out.println( "Part 7: Linyu graduates, congratulations!!..." ); System.out.println( "======================================================" ); civil.remove( student03 ); System.out.println( civil ); System.out.println( "======================================================" ); System.out.println( "Finished!!..." ); The script of program input and output is as follows: prompt >> ant run05 Buildfile: /Users/austin/ence688r.d/exam-code.d/build.xml compile: run05: [java] Part 1: Create academic departments and students [java] ================================================ [java] Part 2: Add students to engineering departments [java] =============================================== [java] *** Adding student: Arash to CEE... [java] [java] *** Adding student: Mingxi to ECE... [java] [java] *** Adding student: Linyu to ECE... [java] [java] *** Adding student: Xi to ECE... [java] [java] *** Department ECE is full... [java] *** Applicant rejected: Tingzhen... [java] [java] Part 3: Plan B: Tingzhen applies to Civil Engineering... [java] ========================================================= [java] *** Adding student: Tingzhen to CEE... [java] [java] Part 4: Summary of Department-Student Associations [java] ================================================== [java] Academic Department: CEE... [java] Current enrollment = 2... [java] Maximum enrollment = 3... [java] Students: Arash Tingzhen 9
10 [java] [java] Academic Department: ECE... [java] Current enrollment = 3... [java] Maximum enrollment = 3... [java] Students: Mingxi Linyu Xi [java] [java] Part 5: Linyu switches from Electrical to Civil... [java] =================================================== [java] Part 6: Validate Linyu s enrollment in CEE and ECE... [java] ====================================================== [java] Student: Linyu [java] Departments: CEE [java] [java] Academic Department: CEE... [java] Current enrollment = 3... [java] Maximum enrollment = 3... [java] Students: Arash Tingzhen Linyu [java] [java] Academic Department: ECE... [java] Current enrollment = 2... [java] Maximum enrollment = 3... [java] Students: Mingxi Xi [java] [java] Part 7: Linyu graduates, congratulations!!... [java] ====================================================== [java] Academic Department: CEE... [java] Current enrollment = 2... [java] Maximum enrollment = 3... [java] Students: Arash Tingzhen [java] [java] ====================================================== [java] Finished!!... BUILD SUCCESSFUL Total time: 0 seconds prompt >> exit Please look at the source code carefully and answer the questions that follow: [1a] (5 pts). Draw and label a diagram that shows the organizational arrangement of java packages and user-defined java source code files. 10
11 [1b] (10 pts). Draw and label a diagram that shows the relationship among the Student, Tiny- Department and TestTinyUniversity classes. [1c] (10 pts). Draw and label a diagram showing the layout of memory generated by the statements: TinyDepartment civil = new TinyDepartment(); civil.setname("cee"); 11
12 [1d] (5 pts). In Part 02, the first student to be added to a department is Arash. Draw and label a diagram showing the layout of memory immediately after the statement: civil.add( student01 ); [1e] (5 pts). Draw and label a diagram showing the layout of memory immediately after the statements: // Add students to electrical engineering... eecs.add( student02 ); eecs.add( student03 ); eecs.add( student04 ); eecs.add( student05 ); 12
13 [1f] (5 pts). In Student.java, departments is declared; private Collection<TinyDepartment> departments; Briefly explain each term... [1g] (5 pts). Then, a little bit later on in Student.java, memory for departments is created with: public Student() { departments = new ArrayList<TinyDepartment>(); Briefly explain how the relationship between the classes Collection and ArrayList works. 13
14 [1h] (5 pts). Draw and label a diagram showing the layout of memory at the conclusion of Part 07 (i.e., after Linyu graduates). 14
15 Question 2: 30 points An alias is used to indicate that a named entity is also known by another specified name. For example, in Java, the full name for the math classes is java.lang.math. The short name (or alias) is Math. In this question we explore the use of aliases to access state capitals, first using the complete state name (e.g., Maryland), and then using a short name (e.g., MD). We will say that MD is an alias for Maryland, which in turn, will be mapped to the state capital (e.g. Annapolis). The source code is organized into two files: Alias.java and a test program TestAliasMap.java. File: Alias.java source code /* * ============================================================== * AliasMap.java * ============================================================== */ package alias; import java.util.*; public class AliasMap<T> { public class Key { private Map<T, Key> aliases = new HashMap<T, Key>(); public Key addkey(t alias) { Key key = new Key(); aliases.put(alias, key); return key; public void addalias(t orig, T alias) { aliases.put(alias, aliases.get(orig)); public Key lookup(t alias) { return aliases.get(alias); File: TestAliasMap.java 15
16 source code /** * ====================================================================== * TestAliasMap.java: * * Written by: Mark Austin May 2017 * ====================================================================== */ package demo; import java.util.*; import alias.*; public class TestAliasMap { Map<AliasMap<String>.Key, String> map01; AliasMap<String> aliaser; // ============================================================ // Constructor methods to store object map relationships... // ============================================================ public TestAliasMap() { map01 = new HashMap< AliasMap<String>.Key, String >(); aliaser = new AliasMap<String>(); // ============================================================ // Exercise alias map capabilities... // ============================================================ public static void main ( String args[] ) throws Exception { TestAliasMap test = new TestAliasMap(); // Part 01: Play with alias <String, String> map... System.out.println( "*** Part 01: Create <String, String> map for state capitals..."); System.out.println( "*** =========================================================== "); test.map01.put( test.aliaser.addkey("california"), "Sacramento"); test.map01.put( test.aliaser.addkey("maryland"), "Annapolis"); test.map01.put( test.aliaser.addkey("virginia"), "Richmond"); System.out.println( "*** Maryland -> " + test.map01.get( test.aliaser.lookup("maryland")) ); System.out.println( "*** Virginia -> " + test.map01.get( test.aliaser.lookup("virginia")) ); System.out.println( "*** California -> " + test.map01.get( test.aliaser.lookup("california")) ); // Create and print alias map entries... System.out.println( "*** "); 16
17 System.out.println( "*** Part 02: Add aliases for states..."); System.out.println( "*** =========================================================== "); System.out.println( "*** Alias MD for Maryland, VA for Virginia, etc..."); test.aliaser.addalias( "California", "CA" ); test.aliaser.addalias( "Maryland", "MD" ); test.aliaser.addalias( "Virginia", "VA" ); System.out.printf( "*** State Capital of CA is: %s... \n", test.map01.get( test.aliaser.lookup("ca") ) ); System.out.printf( "*** State Capital of MD is: %s... \n", test.map01.get( test.aliaser.lookup("md") ) ); System.out.printf( "*** State Capital of VA is: %s... \n", test.map01.get( test.aliaser.lookup("va") ) ); System.out.println( "*** =========================================================== "); The script of program input and output is as follows: Buildfile: /Users/austin/ence688r.d/exam-code.d/build.xml compile: run04: [java] *** Part 01: Create <String, String> map for state capitals... [java] *** =========================================================== [java] *** Maryland -> Annapolis [java] *** Virginia -> Richmond [java] *** California -> Sacramento [java] *** [java] *** Part 02: Add aliases for states... [java] *** =========================================================== [java] *** Alias MD for Maryland, VA for Virginia, etc... [java] *** State Capital of CA is: Sacramento... [java] *** State Capital of MD is: Annapolis... [java] *** State Capital of VA is: Richmond... [java] *** =========================================================== BUILD SUCCESSFUL Total time: 0 seconds 17
18 [2a]. (5 pts). Briefly explain the purpose of the Java Generics in: private Map<T, Key> aliases = new HashMap<T, Key>(); [2b]. (10 pts). Draw and label a diagram for the layout of memory at the conclusion of Part
19 [2c]. (10 pts). Draw and label a diagram for the layout of memory generated by the fragment of code test.aliaser.addalias( "California", "CA" ); test.aliaser.addalias( "Maryland", "MD" ); test.aliaser.addalias( "Virginia", "VA" ); All reasonable answers will be accepted. [2d]. (5 pts). Briefly explain what is happening in the statement: System.out.printf( "*** State Capital of CA is: %s... \n", test.map01.get( test.aliaser.lookup("ca") ) ); 19
20 Question 3: 20 points This question covers use of the Java collections framework and software design patterns for the implementation of a two-dimensional plotting library. To see the kinds of features that such a library might support, consider the two-dimensional plot of voltage measurements (Volts) versus time (sec) shown in Figure 2. Figure 2: A simple matlab-like plot. Thetwo dimensinal plot contains multiple curves, a title, and labels for the x- andy- axes, labels for individual curves, and a dashed-line grid. Standard optional features would include the ability to draw curves in specific colors (e.g., blue, green, red) and a legend of symbols displayed in the figure (not shown in Figure 2). An advanced implementation would allow for multiple plots, automatically relabel the plot when the figure is resized and/or provide users with the ability to zoom in on a small portion of a figure. 20
21 [3a] (10 pts.) Draw and label a diagram (or series of diagrams) that shows how you would use the composite design pattern to layout the contents of Figure 2. Clearly indicate the various types of leaf node that will be supported in your plotting package. 21
22 [3b] (10 pts.) Develop a few ideas for how HashSets and HashMaps might beused in your plotting application. All reasonable answers will be accepted. 22
Department of Civil and Environmental Engineering, Spring Semester, ENCE 688R: Midterm Exam: 1 1/2 Hours, Open Book and Open Notes
Department of Civil and Environmental Engineering, Spring Semester, 2016 ENCE 688R: Midterm Exam: 1 1/2 Hours, Open Book and Open Notes Name : Question Points Score 1 30 2 40 3 30 Total 100 1 Question
More informationDepartment of Civil and Environmental Engineering, Spring Semester, ENCE 688R: Final Exam: 2 Hours, Open Book and Open Notes
Department of Civil and Environmental Engineering, Spring Semester, 2016 ENCE 688R: Final Exam: 2 Hours, Open Book and Open Notes Name : Question Points Score 1 100 Total 100 1 Question 1: 100 points Let
More informationDepartment of Civil and Environmental Engineering, Spring Semester, ENCE 688R: Midterm Exam: 1 1/2 Hours, Open Book and Open Notes
Department of Civil and Environmental Engineering, Spring Semester, 2013 ENCE 688R: Midterm Exam: 1 1/2 Hours, Open Book and Open Notes Name : Question Points Score 1 30 2 30 3 40 Total 100 1 Question
More informationDepartment of Civil and Environmental Engineering, Spring Semester, ENCE 688R: Midterm Exam: 1 1/2 Hours, Open Book and Open Notes
Department of Civil and Environmental Engineering, Spring Semester, 2012 ENCE 688R: Midterm Exam: 1 1/2 Hours, Open Book and Open Notes Name : Question Points Score 1 30 2 50 Total 80 1 Question 1: 30
More informationSCHOOL OF COMPUTING, ENGINEERING AND MATHEMATICS SEMESTER 2 EXAMINATIONS 2013/2014 CI101/CI101H. Programming
s SCHOOL OF COMPUTING, ENGINEERING AND MATHEMATICS SEMESTER 2 EXAMINATIONS 2013/2014 CI101/CI101H Programming Time allowed: THREE hours Answer: ALL questions Items permitted: Items supplied: There is no
More informationMODULE 6q - Exceptions
MODULE 6q - Exceptions THE TRY-CATCH CONSTRUCT Three different exceptions are referred to in the program below. They are the ArrayIndexOutOfBoundsException which is built-into Java and two others, BadLuckException
More informationWES-CS GROUP MEETING #9
WES-CS GROUP MEETING #9 Exercise 1: Practice Multiple-Choice Questions 1. What is output when the following code executes? String S1 = new String("hello"); String S2 = S1 +! ; S1 = S1 + S1; System.out.println(S1);
More informationObject Oriented Programming
Object Oriented Programming Debapriyo Majumdar Programming and Data Structure Lab M Tech CS I Semester I Indian Statistical Institute Kolkata August 7 and 14, 2014 Objects Real world objects, or even people!
More informationHighlights of Previous Lecture
Highlights of Previous Lecture Inheritance vs. Composition IS-A-KIND-OF vs. HAS-A relationships Java vs. C++: differences in ability to access base class behavior Interfaces as contracts, as types, supporting
More informationF I N A L E X A M I N A T I O N
Faculty Of Computer Studies M257 Putting Java to Work F I N A L E X A M I N A T I O N Number of Exam Pages: (including this cover sheet( Spring 2011 April 4, 2011 ( 5 ) Time Allowed: ( 1.5 ) Hours Student
More informationPASS4TEST IT 인증시험덤프전문사이트
PASS4TEST IT 인증시험덤프전문사이트 http://www.pass4test.net 일년동안무료업데이트 Exam : 1z0-809 Title : Java SE 8 Programmer II Vendor : Oracle Version : DEMO Get Latest & Valid 1z0-809 Exam's Question and Answers 1 from
More information(a) Write the signature (visibility, name, parameters, types) of the method(s) required
1. (6 pts) Is the final comprehensive? 1 2. (6 pts) Java has interfaces Comparable and Comparator. As discussed in class, what is the main advantage of Comparator? 3. (6 pts) We can use a comparator in
More information1) Consider the following code segment, applied to list, an ArrayList of Integer values.
Advanced Computer Science Unit 7 Review Part I: Multiple Choice (12 questions / 4 points each) 1) What is the difference between a regular instance field and a static instance field? 2) What is the difference
More informationSCHOOL OF COMPUTING, ENGINEERING AND MATHEMATICS SEMESTER 1 EXAMINATIONS 2015/2016 CI101 / CI177. Programming
s SCHOOL OF COMPUTING, ENGINEERING AND MATHEMATICS SEMESTER 1 EXAMINATIONS 2015/2016 CI101 / CI177 Programming Time allowed: THREE hours: Answer: ALL questions Items permitted: Items supplied: There is
More informationM257 Putting Java to work
Arab Open University Faculty of Computer Studies Course Examination Spring 2010 M257 Putting Java to work Exam date: May 2010 Time allowed: 2.5 hours Form: X A B Student name/ Section number: Tutor Name:
More informationSPRING 13 CS 0007 FINAL EXAM V2 (Roberts) Your Name: A pt each. B pt each. C pt each. D or 2 pts each
Your Name: Your Pitt (mail NOT peoplesoft) ID: Part Question/s Points available Rubric Your Score A 1-6 6 1 pt each B 7-12 6 1 pt each C 13-16 4 1 pt each D 17-19 5 1 or 2 pts each E 20-23 5 1 or 2 pts
More informationUniversity of Massachusetts Amherst, Electrical and Computer Engineering
University of Massachusetts Amherst, Electrical and Computer Engineering ECE 122 Midterm Exam 1 Makeup Answer key March 2, 2018 Instructions: Closed book, Calculators allowed; Duration:120 minutes; Write
More informationSample Examination Paper Programming and Software Development
THE UNIVERSITY OF MELBOURNE DEPARTMENT OF COMPUTER SCIENCE AND SOFTWARE ENGINEERING Sample Examination Paper 2008 433-520 Programming and Software Development Exam Duration: 2 hours Total marks for this
More informationCSCI 136 Written Exam #0 Fundamentals of Computer Science II Spring 2015
CSCI 136 Written Exam #0 Fundamentals of Computer Science II Spring 2015 Name: This exam consists of 6 problems on the following 7 pages. You may use your single-sided handwritten 8 ½ x 11 note sheet during
More informationDistributed Systems Recitation 1. Tamim Jabban
15-440 Distributed Systems Recitation 1 Tamim Jabban Office Hours Office 1004 Tuesday: 9:30-11:59 AM Thursday: 10:30-11:59 AM Appointment: send an e-mail Open door policy Java: Object Oriented Programming
More informationCS 1331 Exam 1. Fall Failure to properly fill in the information on this page will result in a deduction of up to 5 points from your exam score.
CS 1331 Exam 1 Fall 2016 Name (print clearly): GT account (gpburdell1, msmith3, etc): Section (e.g., B1): Signature: Failure to properly fill in the information on this page will result in a deduction
More informationHighlights of Last Week
Highlights of Last Week Refactoring classes to reduce coupling Passing Object references to reduce exposure of implementation Exception handling Defining/Using application specific Exception types 1 Sample
More informationLast Name: Circle One: OCW Non-OCW
First Name: AITI 2004: Exam 1 June 30, 2004 Last Name: Circle One: OCW Non-OCW Read Instructions Carefully! This is a 3 hour closed book exam. No calculators are allowed. Please write clearly if we cannot
More informationCS 1331 Fall 2016 Exam 3 Part 1 ANSWER KEY
CS 1331 Fall 2016 Exam 3 Part 1 Fall 2016 ANSWER KEY Failure to properly fill in the information on this page will result in a deduction of up to 5 points from your exam score. Signing signifies you are
More informationCSE 331 Summer 2017 Final Exam. The exam is closed book and closed electronics. One page of notes is allowed.
Name Solution The exam is closed book and closed electronics. One page of notes is allowed. The exam has 6 regular problems and 1 bonus problem. Only the regular problems will count toward your final exam
More information1. ArrayList and Iterator in Java
1. ArrayList and Iterator in Java Inserting elements between existing elements of an ArrayList or Vector is an inefficient operation- all element after the new one must be moved out of the way which could
More informationCS 110 Practice Final Exam originally from Winter, Instructions: closed books, closed notes, open minds, 3 hour time limit.
Name CS 110 Practice Final Exam originally from Winter, 2003 Instructions: closed books, closed notes, open minds, 3 hour time limit. There are 4 sections for a total of 49 points. Part I: Basic Concepts,
More informationCS1083 Week 2: Arrays, ArrayList
CS1083 Week 2: Arrays, ArrayList mostly review David Bremner 2018-01-08 Arrays (1D) Declaring and using 2D Arrays 2D Array Example ArrayList and Generics Multiple references to an array d o u b l e prices
More informationEngineering Software Development in Java
Engineering Software Development in Java Lecture Notes for ENCE 688R, Civil Information Systems Spring Semester, 2016 Mark Austin, Department of Civil and Enviromental Engineering, University of Maryland,
More informationAssignment 8B SOLUTIONS
CSIS 10A Assignment 8B SOLUTIONS Read: Chapter 8 Choose and complete any 10 points from the problems below, which are all included in the download file on the website. Use BlueJ to complete the assignment,
More informationAL GHURAIR UNIVERSITY College of Computing. Objectives: Examples: if Single-Selection Statement CSC 209 JAVA I. week 3- Control Statements: Part I
AL GHURAIR UNIVERSITY College of Computing CSC 209 JAVA I week 3- Control Statements: Part I Objectives: To use the if and if...else selection statements to choose among alternative actions. To use the
More informationFinal Exam. COMP Summer I June 26, points
Final Exam COMP 14-090 Summer I 2000 June 26, 2000 200 points 1. Closed book and closed notes. No outside material allowed. 2. Write all answers on the test itself. Do not write any answers in a blue book
More informationCOMP 202. More on OO. CONTENTS: static revisited this reference class dependencies method parameters variable scope method overloading
COMP 202 CONTENTS: static revisited this reference class dependencies method parameters variable scope method overloading More on OO COMP 202 - Week 7 1 Static member variables So far: Member variables
More informationChapter 12: Inheritance
Chapter 12: Inheritance Objectives Students should Understand the concept and role of inheritance. Be able to design appropriate class inheritance hierarchies. Be able to make use of inheritance to create
More informationNATIONAL UNIVERSITY OF SINGAPORE
NATIONAL UNIVERSITY OF SINGAPORE SCHOOL OF COMPUTING TERM TEST #1 Semester 1 AY2006/2007 CS1101X/Y/Z PROGRAMMING METHODOLOGY 16 September 2006 Time Allowed: 60 Minutes INSTRUCTIONS 1. This question paper
More informationCS 101 Exam 2 Spring Id Name
CS 101 Exam 2 Spring 2005 Email Id Name This exam is open text book and closed notes. Different questions have different points associated with them. Because your goal is to maximize your number of points,
More informationExploring the Java API, Packages & Collections
6.092 - Introduction to Software Engineering in Java Lecture 7: Exploring the Java API, Packages & Collections Tuesday, January 29 IAP 2008 Cite as: Evan Jones, Olivier Koch, and Usman Akeju, course materials
More informationInstance Method Development Demo
Instance Method Development Demo Write a class Person with a constructor that accepts a name and an age as its argument. These values should be stored in the private attributes name and age. Then, write
More informationCollections. Collections Collection types Collection wrappers Composite classes revisited Collection classes Hashtables Enumerations
References: Beginning Java Objects, Jacquie Barker; The Java Programming Language, Ken Arnold and James Gosling; IT350 Internet lectures 9/16/2003 1 Collections Collection types Collection wrappers Composite
More informationCSCI 355 LAB #2 Spring 2004
CSCI 355 LAB #2 Spring 2004 More Java Objectives: 1. To explore several Unix commands for displaying information about processes. 2. To explore some differences between Java and C++. 3. To write Java applications
More informationCS 1331 Exam 1 ANSWER KEY
CS 1331 Exam 1 Fall 2016 ANSWER KEY Failure to properly fill in the information on this page will result in a deduction of up to 5 points from your exam score. Signing signifies you are aware of and in
More informationAL GHURAIR UNIVERSITY College of Computing. Objectives: Examples: Text-printing program. CSC 209 JAVA I
AL GHURAIR UNIVERSITY College of Computing CSC 209 JAVA I week 2- Arithmetic and Decision Making: Equality and Relational Operators Objectives: To use arithmetic operators. The precedence of arithmetic
More informationCS 113 MIDTERM EXAM 2 SPRING 2013
CS 113 MIDTERM EXAM 2 SPRING 2013 There are 18 questions on this test. The value of each question is: 1-15 multiple choice (3 pts) 17 coding problem (15 pts) 16, 18 coding problems (20 pts) You may get
More informationCITS1001 week 6 Libraries
CITS1001 week 6 Libraries Arran Stewart April 12, 2018 1 / 52 Announcements Project 1 available mid-semester test self-assessment 2 / 52 Outline Using library classes to implement some more advanced functionality
More informationFirst Exam Computer Programming 326 Dr. St. John Lehman College City University of New York Thursday, 7 October 2010
First Exam Computer Programming 326 Dr. St. John Lehman College City University of New York Thursday, 7 October 2010 NAME (Printed) NAME (Signed) E-mail Exam Rules Show all your work. Your grade will be
More informationCS 132 Midterm Exam Fall 2004
Date:1-Nov-2004 Time:7:00-9:00p.m. Permitted Aids:None CS 132 Midterm Exam Fall 2004 Please complete this page in ink. Last Name: Signature: First Name: ID: Please check off your Practicum Section: Dana
More informationCS111: PROGRAMMING LANGUAGE II. Lecture 1: Introduction to classes
CS111: PROGRAMMING LANGUAGE II Lecture 1: Introduction to classes Lecture Contents 2 What is a class? Encapsulation Class basics: Data Methods Objects Defining and using a class In Java 3 Java is an object-oriented
More informationPractice Questions for Final Exam: Advanced Java Concepts + Additional Questions from Earlier Parts of the Course
: Advanced Java Concepts + Additional Questions from Earlier Parts of the Course 1. Given the following hierarchy: class Alpha {... class Beta extends Alpha {... class Gamma extends Beta {... In what order
More informationTutorial 6 CSC 201. Java Programming Concepts مبادئ الربجمة باستخدام اجلافا
Tutorial 6 CSC 201 Java Programming Concepts مبادئ الربجمة باستخدام اجلافا Chapter 6: Classes and Objects 1. Classes & Objects What is an object? Real Objects Java Objects Classes Defining a class and
More informationCSCI 355 Lab #2 Spring 2007
CSCI 355 Lab #2 Spring 2007 More Java Objectives: 1. To explore several Unix commands for displaying information about processes. 2. To explore some differences between Java and C++. 3. To write Java applications
More informationCMSC 132: Object-Oriented Programming II. Inheritance
CMSC 132: Object-Oriented Programming II Inheritance 1 Mustang vs Model T Ford Mustang Ford Model T 2 Interior: Mustang vs Model T 3 Frame: Mustang vs Model T Mustang Model T 4 Compaq: old and new Price:
More informationCS 132 Midterm Exam Spring 2004
Date:22-Jun-2004 Time:7:00-9:00p.m. Permitted Aids:None CS 132 Midterm Exam Spring 2004 Please complete this page in ink. Last Name: Signature: First Name: ID: Please check off your Practicum Section:
More informationCS100M November 30, 2000
CS00M November 30, 2000 Makeup Solutions 7:30 PM 9:30 PM (Print last name, first name, middle initial/name) (Student ID) Statement of integrity: I did not, and will not, break the rules of academic integrity
More informationCollections. Collections. Collections - Arrays. Collections - Arrays
References: Beginning Java Objects, Jacquie Barker; The Java Programming Language, Ken Arnold and James Gosling; IT350 Internet lectures Collections Collection types Collection wrappers Composite classes
More informationSCHOOL OF COMPUTING, ENGINEERING AND MATHEMATICS SEMESTER 2 EXAMINATIONS 2014/2015 CI101/CI101H. Programming
s SCHOOL OF COMPUTING, ENGINEERING AND MATHEMATICS SEMESTER 2 EXAMINATIONS 2014/2015 CI101/CI101H Programming Time allowed: THREE hours Answer: ALL questions Items permitted: Items supplied: There is no
More informationBSc. (Hons.) Software Engineering. Examinations for / Semester 2
BSc. (Hons.) Software Engineering Cohort: BSE/04/PT Examinations for 2005-2006 / Semester 2 MODULE: OBJECT ORIENTED PROGRAMMING MODULE CODE: BISE050 Duration: 2 Hours Reading Time: 5 Minutes Instructions
More informationMore sophisticated behaviour Lecture 09
More sophisticated behaviour Lecture 09 Waterford Institute of Technology February 22, 2016 John Fitzgerald Waterford Institute of Technology, More sophisticated behaviour Lecture 09 1/42 Presentation
More informationCreate a Java project named week10
Objectives of today s lab: Through this lab, students will examine how casting works in Java and learn about Abstract Class and in Java with examples. Create a Java project named week10 Create a package
More informationGetter and Setter Methods
Example 1 namespace ConsoleApplication14 public class Student public int ID; public string Name; public int Passmark = 50; class Program static void Main(string[] args) Student c1 = new Student(); Console.WriteLine("please..enter
More informationCS 113 PRACTICE FINAL
CS 113 PRACTICE FINAL There are 13 questions on this test. The value of each question is: 1-10 multiple choice (4 pt) 11-13 coding problems (20 pt) You may get partial credit for questions 11-13. If you
More informationUniversity of Cape Town ~ Department of Computer Science. Computer Science 1015F ~ 2007
Name: Please fill in your Student Number and Name. Student Number : Student Number: University of Cape Town ~ Department of Computer Science Computer Science 1015F ~ 2007 Supplementary Examination Question
More informationThe ArrayList class CSC 123 Fall 2018 Howard Rosenthal
The ArrayList class CSC 123 Fall 2018 Howard Rosenthal Lesson Goals Describe the ArrayList class Discuss important methods of this class Describe how it can be used in modeling Much of the information
More informationTutorial 12. Exercise 1: Exercise 2: CSC111 Computer Programming I
College of Computer and Information Sciences CSC111 Computer Programming I Exercise 1: Tutorial 12 Arrays: A. Write a method add that receives an array of integers arr, the number of the elements in the
More informationMID-SEMESTER TEST 2014
MID-SEMESTER TEST 2014 CITS1001 Object-Oriented Programming and Software Engineering School of Computer Science and Software Engineering The University of Western Australia First Name Family Name Student
More informationCMSC131. Creating a Datatype Class Continued Exploration of Memory Model. Reminders
CMSC131 Creating a Datatype Class Continued Exploration of Memory Model Reminders The name of the source code file needs to match the name of the class. The name of the constructor(s) need(s) to match
More informationDo not turn over this examination paper until instructed to do so. Answer all questions.
IB Computer Science SL Paper 2 - Mock Exam - Dec 2013 (1/6) COMPUTER SCIENCE STANDARD LEVEL PAPER 2 MOCK EXAM 1 hour INSTRUCTIONS TO CANDIDATES Do not turn over this examination paper until instructed
More informationCS 2334: Programming Structures and Abstractions: Exam 1 October 3, 2016
General instructions: CS 2334: Programming Structures and Abstractions: Exam 1 October 3, 2016 Please wait to open this exam booklet until you are told to do so. This examination booklet has 13 pages.
More informationLecture 9: Lists. MIT-AITI Kenya 2005
Lecture 9: Lists MIT-AITI Kenya 2005 1 In this lecture we will learn. ArrayList These are re-sizeable arrays LinkedList brief overview Differences between Arrays and ArrayLists Casting Iterator method
More informationUNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division. P. N. Hilfinger.
UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division CS61B Fall 2009 P. N. Hilfinger Test #1 READ THIS PAGE FIRST. Please do not discuss this exam
More informationPractice Midterm 1. Problem Points Score TOTAL 50
CS 120 Software Design I Spring 2019 Practice Midterm 1 University of Wisconsin - La Crosse February 25 NAME: Do not turn the page until instructed to do so. This booklet contains 10 pages including the
More informationProblem Grade Total
CS 101, Prof. Loftin: Final Exam, May 11, 2009 Name: All your work should be done on the pages provided. Scratch paper is available, but you should present everything which is to be graded on the pages
More information1. Which of the following is the correct expression of character 4? a. 4 b. "4" c. '\0004' d. '4'
Practice questions: 1. Which of the following is the correct expression of character 4? a. 4 b. "4" c. '\0004' d. '4' 2. Will System.out.println((char)4) display 4? a. Yes b. No 3. The expression "Java
More informationThe Final One. Case Study: Adding a GUI to the Student Data Base. Graphical Use Interfaces: the student database example. Assignments.
The Final One Graphical Use Interfaces: the student database example. Assignments. Module questionnaire. Looking back... 1 2-1 Case Study: Adding a GUI to the Student Data Base Problem. We want to add
More informationUniversity of Cape Town ~ Department of Computer Science Computer Science 1015F ~ June Exam
Name: Please fill in your Student Number and Name. Student Number : Student Number: University of Cape Town ~ Department of Computer Science Computer Science 1015F ~ 2009 June Exam Question Max Internal
More informationThe FacebookPerson Example. Dr. Xiaolin Hu CSC 2310, Spring 2015
The FacebookPerson Example Dr. Xiaolin Hu CSC 2310, Spring 2015 Motivation Whenever you are happy, update your facebook! Start from Simple A Facebook Person Class A test class public class FacebookPerson{
More informationBirkbeck (University of London) Software and Programming 1 In-class Test Mar 2018
Birkbeck (University of London) Software and Programming 1 In-class Test 2.1 22 Mar 2018 Student Name Student Number Answer ALL Questions 1. What output is produced when the following Java program fragment
More informationSystem Modelling. Lecture
System Modelling Lecture 02.10.2012 Lecture Objectives Storyboards as a base Objects to Classes GUI design with Story-Driven Modelling Intro to the project: 25pts Story-Driven Modeling 1. Concrete behavior
More information1 Inheritance (8 minutes, 9 points)
Name: Career Account ID: Recitation#: 1 CS180 Spring 2011 Exam 2, 6 April, 2011 Prof. Chris Clifton Turn Off Your Cell Phone. Use of any electronic device during the test is prohibited. Time will be tight.
More informationGet started with the Java Collections Framework By Dan Becker
Get started with the Java Collections Framework By Dan Becker JavaWorld Nov 1, 1998 COMMENTS JDK 1.2 introduces a new framework for collections of objects, called the Java Collections Framework. "Oh no,"
More informationFinal Exam CS 152, Computer Programming Fundamentals December 5, 2014
Final Exam CS 152, Computer Programming Fundamentals December 5, 2014 Name: NetID: Answer all questions in the space provided. Write clearly and legibly, you will not get credit for illegible or incomprehensible
More informationCS Week 14. Jim Williams, PhD
CS 200 - Week 14 Jim Williams, PhD This Week 1. Final Exam: Conflict Alternatives Emailed 2. Team Lab: Object Oriented Space Game 3. BP2 Milestone 3: Strategy 4. Lecture: More Classes and Additional Topics
More informationClasses and Objects 3/28/2017. How can multiple methods within a Java class read and write the same variable?
Peer Instruction 8 Classes and Objects How can multiple methods within a Java class read and write the same variable? A. Allow one method to reference a local variable of the other B. Declare a variable
More informationThe University of Nottingham
The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, SPRING SEMESTER OBJECT-ORIENTED METHODS Time allowed TWO hours Candidates may complete the front cover of their answer book and
More informationif (x == 0); System.out.println( x=0 ); if (x = 0) System.out.println( x=0 );
Sample Final Exam 1. Evaluate each of the following expressions and show the result and data type of each: Expression Value Data Type 14 % 5 1 / 2 + 1 / 3 + 1 / 4 4.0 / 2.0 Math.pow(2.0, 3.0) (double)(2
More informationObject Oriented Programming 2014/15. Final Exam July 3, 2015
Object Oriented Programming 2014/15 Final Exam July 3, 2015 Directions (read carefully): CLEARLY print your name and ID on every page. The exam contains 8 pages divided into 4 parts. Make sure you have
More informationFirst Name: AITI 2004: Exam 2 July 19, 2004
First Name: AITI 2004: Exam 2 July 19, 2004 Last Name: JSP Track Read Instructions Carefully! This is a 3 hour closed book exam. No calculators are allowed. Please write clearly if we cannot understand
More informationCreate a Java project named week9
Objectives of today s lab: Through this lab, students will explore a hierarchical model for object-oriented design and examine the capabilities of the Java language provides for inheritance and polymorphism.
More informationFundamental Java Methods
Object-oriented Programming Fundamental Java Methods Fundamental Java Methods These methods are frequently needed in Java classes. You can find a discussion of each one in Java textbooks, such as Big Java.
More informationOracle 1Z0-851 Java Standard Edition 6 Programmer Certified Professional Exam
Oracle 1Z0-851 Java Standard Edition 6 Programmer Certified Professional Exam 1 QUESTION: 1 Given a pre-generics implementation of a method: 11. public static int sum(list list) { 12. int sum = 0; 13.
More informationFinal Exam. Name: Student ID Number: Signature:
Washington University Kenneth J. Goldman Final Exam CSE 132. Computer Science II May 7, 2007 Name: Student ID Number: Signature: Directions: This exam is closed book. You may use one 8 ½ x 11 inch page
More information1. [3 pts] What is your section number, the period your discussion meets, and the name of your discussion leader?
CIS 3022 Prog for CIS Majors I October 4, 2007 Exam I Print Your Name Your Section # Total Score Your work is to be done individually. The exam is worth 104 points (four points of extra credit are available
More informationCMSC 433 Section 0101 Fall 2012 Midterm Exam #1
Name: CMSC 433 Section 0101 Fall 2012 Midterm Exam #1 Directions: Test is closed book, closed notes. Answer every question; write solutions in spaces provided. Use backs of pages for scratch work. Good
More informationANSWER KEY First Exam Computer Programming 326 Dr. St. John Lehman College City University of New York Thursday, 7 October 2010
ANSWER KEY First Exam Computer Programming 326 Dr. St. John Lehman College City University of New York Thursday, 7 October 2010 1. True or False: (a) T An algorithm is a a set of directions for solving
More informationProblem 8.1: Model rectangles with Vertices...
------------------------------------------------------------------------- ENCE 688R: Solutions to Homework 2 March 2016 ------------------------------------------------------------------------- -------------------------------------------------------------------------
More informationMYBATIS - ANNOTATIONS
MYBATIS - ANNOTATIONS http://www.tutorialspoint.com/mybatis/mybatis_annotations.htm Copyright tutorialspoint.com In the previous chapters, we have seen how to perform curd operations using MyBatis. There
More informationIntroduction to Object-Oriented Programming
Introduction to Object-Oriented Programming Arrays, Part 2 of 2 Christopher Simpkins chris.simpkins@gatech.edu Chris Simpkins (Georgia Tech) CS 1331 Arrays, Part 2 of 2 1 / 16 A few more array topics Variable
More informationUniversity of Cape Town ~ Department of Computer Science. Computer Science 1015F ~ 2007
Name: Please fill in your Student Number and Name. Student Number : Student Number: University of Cape Town ~ Department of Computer Science Computer Science 1015F ~ 2007 Final Examination Question Max
More informationSelected Questions from by Nageshwara Rao
Selected Questions from http://way2java.com by Nageshwara Rao Swaminathan J Amrita University swaminathanj@am.amrita.edu November 24, 2016 Swaminathan J (Amrita University) way2java.com (Nageshwara Rao)
More informationI pledge by honor that I will not discuss this exam with anyone until my instructor reviews the exam in the class.
Name: Covers Chapters 1-3 50 mins CSCI 1301 Introduction to Programming Armstrong Atlantic State University Instructor: Dr. Y. Daniel Liang I pledge by honor that I will not discuss this exam with anyone
More informationObjects as a programming concept
Objects as a programming concept IB Computer Science Content developed by Dartford Grammar School Computer Science Department HL Topics 1-7, D1-4 1: System design 2: Computer Organisation 3: Networks 4:
More information