首页 > > 详细

代写SENG201代写Java课程设计

Mid-year Examinations, 2019 SENG201-19S1 (C) 
No electronic/communication devices are permitted. 
No exam materials may be removed from the exam room. 
 
Computer Science and Software Engineering 
EXAMINATION 
Mid-year Examinations, 2019 
SENG201-19S1 (C) Software Engineering I 
 
Examination Duration: 120 minutes 
Exam Conditions: 
Open Book exam: Students may bring in any written or printed materials. 
Any scientific/graphics/basic calculator is permitted. 
Materials Permitted in the Exam Venue: 
Open Book exam: Students may bring in any written or printed materials. 
Materials to be Supplied to Students: 
1 x Write-on question paper/answer book 
Instructions to Students: 
Mark or write in the spaces allocated to each answer. Do not write close to the margins, 
as the answer books will be scanned, and writing very close to the margin may not be 
picked up. If you require extra room there are space at the end of this booklet. 
You should clearly indicate in the appropriate space that the answer is 
continued/provided elsewhere. 
Questions Start on Page 3 
 
Mid-year Examinations, 2019 SENG201-19S1 (C) 
Page 3 of 17 
1. [8 marks for whole question] Do the following Java code fragments compile? If they do not compile, explain 
why a fragment does not compile. If they do compile, what is their output? Note that we expect the exact 
output (e.g., if the output is a string then the printed string needs to be exact, including punctuation). 
Assume that fragments are taken from within a method of a Java class. Also, you can assume that all 
relevant classes are imported. (a) to (d) are not related (i.e., a variable in one question is independent 
from the same variable in another question). 
 
a. [2 marks] 
while (true || 5/0 > 1) { 
System.out.println("I'm not sure of this one!"); 
break; 
Compiles: Yes/no (circle answer) 
Output (if statement compiles): _________________________________________________ 
Reason if statement does not compile: ____________________________________________ 
 
b. [2 marks] 
Integer try = 0; 
do { 
double rand = Math.random(); 
if (rand * 10 < 5) { 
System.out.println("You won!"); 
} else { 
System.out.println("Try again."); 
try++; 
while (try < 2); 
 
Compiles: Yes/no (circle answer) 
Output (if statement compiles): _________________________________________________ 
Reason if statement does not compile: ____________________________________________ 
 
c. [2 marks] 
String s1 = "true"; 
String s2 = "TRUE"; 
Boolean s3 = s2 == s1; 
System.out.println(s2 s3); 
 
Compiles: Yes/no (circle answer) 
Output (if statement compiles): _________________________________________________ 
Reason if statement does not compile: ____________________________________________ 
 
d. [2 marks] 
char nine = '\uffff'; 
char three = '\uffff'; 
System.out.println(nine/three); 
 
Compiles: Yes/no (circle answer) 
Output (if statement compiles): _________________________________________________ 
Reason if statement does not compile: ____________________________________________ 
 
Student ID ____________________ 
Student Number |__|__|__|__|__|__|__|__| 
Mid-year Examinations, 2019 SENG201-19S1 (C) 
Page 4 of 17 
2. [16 marks for whole question] Study the following program (line numbers are provided for your 
convenience; they are not part of the program). You can assume that class Flight is implemented in file 
Flight.java 
c. [11 marks] Using the two design patterns identified in (b), redraw the redesigned UML class 
diagram. Your redesigned UML class diagram should include at least three different types of 
relationships. 

联系我们 - QQ: 99515681 微信:codinghelp2
© 2014 www.7daixie.com
程序代写网!