Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Size: px
Start display at page:

Download "Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written."

Transcription

1 QUEEN'S UNIVERSIY SCHOOL O COMPUING CISC124, WINER ERM, 2011 INAL EXAMINAION 7pm to 10pm, 26 APRIL 2011, Ross Gym HAND IN Answers Are Recorded on Question Paper SOLUION Instructor: Alan McLeod If the instructor is unavailable in the examination room and if doubt exists as to the interpretation of any problem, the candidate is urged to submit with the answer paper a clear statement of any assumptions made. Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written. Please write your answers in the boxes provided. Extra space is available on the last page of the exam. he back of any page can be used for rough work. his exam is three hours long and refers exclusively to the use of the Java language. Comments are not required in the code you write. or full marks, code must be efficient as well as correct. his is a closed book exam. No computers or calculators are allowed. Student Number: Problem 1: / 10 Problem 4: / 10 Problem 2: / 35 Problem 5: / 15 Problem 3: / 10 Problem 6: / 10 OAL: / 90

2 Student Number: Page 2 of 17 Problem 1) [10 marks] undamental Java he following complete program runs without errors. Indicate the output of each println() statement in the box beside the statement: public class Problem1 { public static void main (String[] args) { // end main // end Problem1 System.out.println( * 7 ); System.out.println( (1 + 4) * 7 ); System.out.println( 2-3 * 4-5 ); System.out.println( 18 % 5 ); System.out.println( 2 * Math.pow(2, 3) ); System.out.println( 60 / 3 / ); System.out.println( 60 / 3 / (2 + 3) ); System.out.println( 99 / 100 ); System.out.println( 100 / 99 ); System.out.println( 99 / 100 ); System.out.println( 99 / ); System.out.println( (float)(5 / 20) ); System.out.println( (float)5 / 20 ); System.out.println( 5.5E3 / 1000 ); System.out.println( " toes" ); System.out.println( 5 + " toes " ); System.out.println( 5 > 3 && 3!= 2 ); System.out.println(!(5 > 3)!(3!= 2) ); System.out.println( 'a' - 'c' ); System.out.println( "No more\nideas!" ); toes 5 toes 23 true false -2 No more ideas!

3 Student Number: Page 3 of 17 Problem 2) [35 marks] undamental Java, ext ile Input, Encapsulation ext ile Input Syntax: You must import java.io.* and java.util.*. Instantiate a ilereader object with a String filename. he constructor can throw a ilenotoundexception if the file is not found or cannot be opened. You will need the close() method of the ilereader object, which can throw an IOException in the unlikely event that the file cannot be closed. Supply the ilereader object to the constructor of a Scanner object. he Scanner object owns several useful methods including hasnextint() and nextint(). he former returns a boolean and the latter an int. he Scanner class and its methods can be used without having to worry about catching exceptions. Problem Summary: A soda bottling plant has been having problems with the exact volume of soda in their 2L bottles. hey have installed an optical device which is supposed to measure the exact volume in each bottle. he volume should be in-between 1950 and 2050 ml, inclusive, but sometimes the device spits out numbers that are far outside this range. he device saves its measurements of volume in a text file, with one number per line in the file. Here are examples of the contents of two of these data files: Data1.txt Data2.txt Data files can be of any length, but only contain integer numbers, one per line in the file. You must create a class called Volumes that stores and summarizes a set of data from a single file. o be a legal object an instance of your Volume class cannot contain any data values that do not lie between 1950 and 2050 inclusive. A legal object must also contain a minimum of 10 valid volume measurements, but there is no upper limit to the number of measurements. So, your Volume class must have a single public constructor that accepts a single parameter, which is the data filename as a String. he constructor must throw a NoDataException object if the file contains less than 10 valid volume measurements. Accessors in the Volume class will return: he volumes array, consisting of only legal measurements. he size, or number of legal measurements. he minimum legal volume. he maximum legal volume. he average of all legal volumes as a double.

4 Student Number: Page 4 of 17 Problem 2, Cont.) Your class cannot have any mutators. You must also write a tostring(), an equals(), a compareo() and a clone() method for your class, using the conventions you have been taught. Equality is defined as both Volumes objects being exactly equal. heir arrays should have the same size and the exact same measurements in the same order. Comparison, for compareo(), is based only on the average volume. If compareo() is supplied with a Volumes object which has a higher average volume, it would return -1. If supplied an object with a smaller average volume, then it would return +1 and if the average volumes are exactly equal, it would return 0. You can see the output of the tostring() method in the sample testing program below. As usual, clone() should return a deep copy of the current object. If you code your Volumes class properly, it will produce the same output as that shown appended to the following testing program, which was run using the two data files shown on the previous page. import java.io.ilenotoundexception; public class estvolumes { public static void main(string[] args) { Volumes vols1 = null; try { vols1 = new Volumes("Data1.txt"); catch (ilenotoundexception e) { System.out.println(e.getMessage()); catch (NoDataException e) { System.out.println(e.getMessage()); System.out.println("Data set 1:"); int[] cleandata = vols1.getvolumes(); for (int i = 0; i < cleandata.length; i++) System.out.print(cleanData[i] + " "); System.out.println("\nSize = " + vols1.getsize()); System.out.println("Min = " + vols1.getminvol()); System.out.println("Max = " + vols1.getmaxvol()); System.out.printf("Average = %.1f", vols1.getavgvol()); Volumes vols2 = null; try { vols2 = new Volumes("Data2.txt"); catch (ilenotoundexception e) { System.out.println(e.getMessage()); catch (NoDataException e) { System.out.println(e.getMessage()); System.out.println("\n\nData set 2:"); cleandata = vols2.getvolumes(); for (int i = 0; i < cleandata.length; i++) System.out.print(cleanData[i] + " "); System.out.println("\nSize = " + vols2.getsize());

5 Student Number: Page 5 of 17 Problem 2, Cont.) System.out.println("Min = " + vols2.getminvol()); System.out.println("Max = " + vols2.getmaxvol()); System.out.printf("Average = %.1f", vols2.getavgvol()); System.out.println("\n\nesting tostring:"); System.out.println(vols1); System.out.println(vols2); System.out.println("\nesting compareo:"); System.out.println(vols1.compareo(vols2)); System.out.println(vols2.compareo(vols1)); System.out.println("\nesting equals, clone & compareo:"); System.out.println(vols1.equals(vols2)); Volumes vols1clone = vols1.clone(); System.out.println(vols1.equals(vols1Clone)); System.out.println(vols1.compareo(vols1Clone)); // end main // end estvolumes /* OUPU: Data set 1: Size = 13 Min = 1956 Max = 2015 Average = Data set 2: Size = 15 Min = 1985 Max = 2034 Average = esting tostring: 13 volumes, average = volumes, average = esting compareo: -1 1 esting equals, clone & compareo: false true 0 */ Starting on the next page, write the NoDataException class and then write the Volumes class on the following 3 pages.

6 Student Number: Page 6 of 17 Problem 2, Cont.) he exception class: public class NoDataException extends Exception { public NoDataException(String message) { super(message); he Volumes class: import java.io.*; import java.util.*; public class Volumes { private int[] vols; private int size; private double average; private int minvol; private int maxvol; private void setattr() { double sum = 0; minvol = 2050; maxvol = 0; int vol; for (int i = 0; i < size; i++) { vol = vols[i]; sum += vol; if (vol < minvol) minvol = vol; if (vol > maxvol) maxvol = vol; average = sum / size; // end setattr

7 Student Number: Page 7 of 17 Problem 2, Cont.) private Volumes() { // Only used by clone() method public Volumes(String filename) throws ilenotoundexception, NoDataException { int vol, count; ilereader input = null; input = new ilereader(filename); Scanner readvols = new Scanner(input); size = 0; while (readvols.hasnextint()) { vol = readvols.nextint(); if (vol >= 1950 && vol <= 2050) size++; readvols.close(); try { input.close(); catch (IOException e) { if (size < 10) throw new NoDataException("Not enough legal data in file."); vols = new int[size]; input = new ilereader(filename); readvols = new Scanner(input); count = 0; while (readvols.hasnextint()) { vol = readvols.nextint(); if (vol >= 1950 && vol <= 2050) { vols[count] = vol; count++; readvols.close(); try { input.close(); catch (IOException e) { setattr(); // end constructor

8 Student Number: Page 8 of 17 Problem 2, Cont.) public int getsize() { return size; public int[] getvolumes() { return vols.clone(); public int getminvol() { return minvol; public int getmaxvol() { return maxvol; public double getavgvol() { return average; public boolean equals (Object othervols) { if (othervols instanceof Volumes) { Volumes ov = (Volumes)otherVols; if (ov.size == size) { for (int i = 0; i < size; i++) if (ov.vols[i]!= vols[i]) return false; return true; return false; // end equals public int compareo(volumes ov) { if (average < ov.average) return -1; if (average > ov.average) return 1; return 0; public String tostring() { String out = size + " volumes, average = " + Math.round(average * 10) / 10f; return out; public Volumes clone() { Volumes ov = new Volumes(); ov.vols = vols.clone(); ov.size = size; ov.minvol = minvol; ov.maxvol = maxvol; ov.average = average; return ov; // end Volumes

9 Student Number: Page 9 of 17 Problem 2, Cont.)

10 Student Number: Page 10 of 17 Problem 3) [10 marks] undamental Java, Methods and Parameters he following complete program runs without errors. Indicate the output of each println() statement in the box beside the statement: public class Problem3 { public static int method1(int[] array) { array[0] += 10; return array[0]; // Note that the parameter list for method2 is on two lines: public static int method2(int anum, String astr, int[] array1, float[] array2, int[] array3) { anum = 5000; astr = "Goodbye!"; array1[0] = 100; float[] fnums = {1.5, 2.5; array2 = fnums; array3[0] += 10; return 10 + method1(array3); public static void main(string[] args) { int num = 1000; String astr = "Hello!"; int[] arr1 = {1, 2, 3; float[] arr2 = {0.5, 1.5; int[] arr3 = {5, 6, 7; int retnum = method2(num, astr, arr1, arr2, arr3); System.out.println(num); System.out.println(aStr); System.out.println(arr1[0]); System.out.println(arr2[0]); System.out.println(arr3[0]); System.out.println(retNum); 1000 Hello! // end main // end Problem3

11 Student Number: Page 11 of 17 Problem 4) [10 marks] Generic Methods Here is a version of binary search written to accept int values: public static int binsearch (int[] a, int key) { int lo = 0; int hi = a.length - 1; int mid = (lo + hi) / 2; while (lo <= hi) { if (key < a[mid]) hi = mid - 1; else if (a[mid] < key) lo = mid + 1; else return mid; mid = (lo + hi) / 2; // end while return -1; // end binsearch Write a generic version of the same method designed to operate on arrays of objects of type. Objects of type will implement the Comparable<> interface, which means that objects of type will have a compareo() method that returns a negative number if the supplied object is greater than the object used to invoke compareo(). public static < extends Comparable<>> int binsearch ([] a, key) { int lo = 0; int hi = a.length - 1; int mid = (lo + hi) / 2; while (lo <= hi) { if (key.compareo(a[mid]) < 0) hi = mid - 1; else if (key.compareo(a[mid]) > 0) lo = mid + 1; else return mid; mid = (lo + hi) / 2; // end while return -1; // end binsearch

12 Student Number: Page 12 of 17 Problem 5) [15 marks] Qualitative Java Write a or on the line before each of the following statements to indicate if it is rue or alse: 1. All Boolean comparisons must be carried out before arithmetic operators are evaluated in a Java expression. 2. he && operator always evaluates the expressions on both sides of the operator. 3. Casting operations have the highest precedence in any expression. 4. he ++ post increment operator carries out the increment after the variable is used in an expression. 5. If an expression contains a method call that results in an exception, the assignment operation will still be carried out as the last operation in the expression. 6. Unfortunately the current Java version does not contain the syntax for a for each loop. 7. Switch statements can be used with floating point values to see if they lie in certain, predefined value ranges. 8. Any switch statement construct can be built using a chained if construct. 9. hrown exceptions will be propagated to the main method if they are not caught in a try/catch block. 10. Random file I/O can only be used to read data from very large files. 11. Storing numeric data in ASCII text format will usually produce a larger file than if the data is stored in Binary format. 12. Random file I/O can be slower than any other file I/O technique. 13. Passing an array into a method involves the creation of a new copy of that array in the activation frame for that method. 14. Automatic un-boxing can simplify the use of Wrapper classes with Generic classes. 15. Wrapper classes only contain static methods and attributes.

13 Student Number: Page 13 of 17 Problem 5, Cont.) 16. he process of functional decomposition helps to reduce the number of methods contained in a program. 17. Proper JUnit tests can be carried out in any order. 18. he rules of DD describe how you should write your unit tests to ensure test coverage of methods you have already written. 19. A object that extends Jrame inherits a frame with a title bar and the normal window title bar controls. 20. Components laid down in a JPanel using lowlayout will always be touching each other. 21. he text attribute of a JLabel in a running GUI program can only be changed in code. 22. here is more than one listener class that can respond to mouse initiated events. 23. System-generated component re-draws invoke the paint(graphics g) method for that component. 24. Code-generated component re-draws can also be carried out by invoking the paint(graphics g) method directly. 25. o invoke a component s repaint() method you must supply the Graphics object associated with that component to the repaint() method. 26. Java is not capable of associating a transparency level with a Color object. 27. You should not attach a window s animation code to a imer thread since it is a daemon thread. 28. Many listener objects can be attached to a imer thread. 29. Once an instance of a hread object is started, it cannot be stopped until the application is finished. 30. It is impossible to convert a Java application into an applet. Applets must be written from scratch.

14 Student Number: Page 14 of 17 Problem 6) [10 marks] GUI Programming Starting on this page and continuing on the next is a complete GUI class that displays a window without error, when run: import javax.swing.*; import java.awt.*; public class Problem6 extends Jrame { public Problem6() { super(); setsize(540, 600); setdefaultcloseoperation(jrame.exi_on_close); setitle("problem 6"); setlocation(20, 20); int rows = 2; int cols = 4; JPanel jpanel1 = new JPanel(new GridLayout(rows, cols)); JButton[] buttons = new JButton[rows * cols]; for (int i = 0; i < rows * cols; i++) { buttons[i] = new JButton("Button " + i); buttons[i].setont(new ont("arial", ont.bold, 18)); jpanel1.add(buttons[i]); JPanel jpanel2 = new JPanel(new lowlayout(lowlayout.cener)); JLabel[] labels = new JLabel[rows * cols]; for (int i = 0; i < rows * cols; i++) { labels[i] = new JLabel("Label " + i); labels[i].setont(new ont("arial", ont.bold, 18)); if (i % 2 == 0) labels[i].setvisible(false); jpanel2.add(labels[i]); add(jpanel1, BorderLayout.NORH); APanel jpanel3 = new APanel(new BorderLayout()); jpanel3.add(jpanel2, BorderLayout.SOUH); add(jpanel3, BorderLayout.CENER); // end constructor

15 Student Number: Page 15 of 17 Problem 6, Cont.) private class APanel extends JPanel { public APanel(LayoutManager lm) { super(lm); public void paint(graphics g) { super.paint(g); int strokesize = 5; int width = getwidth(); int height = getheight(); int gap = 50; BasicStroke stroke = new BasicStroke(strokeSize); Graphics2D g2d = (Graphics2D)g; g2d.setstroke(stroke); g2d.setcolor(color.black); g2d.drawoval(0 + gap, 0 + gap, width - 2 * gap, height - 2 * gap); // end paint(g) // end APanel class public static void main(string[] args) { Problem6 prob6 = new Problem6(); prob6.setvisible(true); // end main // end Problem6 On the next page, draw the appearance of this window when it is first displayed. Other than for the font size, all numeric dimensions are in pixels. Don t worry about what the font looks like. Use the following key to draw your components, changing the text where necessary: A Label A Button

16 Student Number: Page 16 of 17 Problem 6, Cont.)

17 Student Number: Page 17 of 17 (Extra page)

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written. QUEEN'S UNIVERSITY SCHOOL OF COMPUTING HAND IN Answers Are Recorded on Question Paper CISC124, WINTER TERM, 2011 FINAL EXAMINATION 7pm to 10pm, 26 APRIL 2011, Ross Gym Instructor: Alan McLeod If the instructor

More information

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written. QUEEN'S UNIVERSITY SCHOOL OF COMPUTING HAND IN Answers Are Recorded on Question Paper CISC124, WINTER TERM, 2012 FINAL EXAMINATION 9am to 12pm, 26 APRIL 2012 Instructor: Alan McLeod If the instructor is

More information

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written. QUEEN'S UNIVERSIY SCHOOL O COMPUING CMPE212, ALL ERM, 2011 INAL EXAMINAION 15 December 2011, 2pm, Grant Hall Instructor: Alan McLeod HAND IN Answers Are Recorded on Question Paper SOLUION If the instructor

More information

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written. HAND IN Answers Are Recorded on Question Paper QUEEN'S UNIVERSITY SCHOOL OF COMPUTING CISC212, FALL TERM, 2006 FINAL EXAMINATION 7pm to 10pm, 19 DECEMBER 2006, Jeffrey Hall 1 st Floor Instructor: Alan

More information

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written. SOLUTION HAND IN Answers Are Recorded on Question Paper QUEEN'S UNIVERSITY SCHOOL OF COMPUTING CISC212, FALL TERM, 2006 FINAL EXAMINATION 7pm to 10pm, 19 DECEMBER 2006, Jeffrey Hall 1 st Floor Instructor:

More information

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written. QUEEN'S UNIVERSITY SCHOOL OF COMPUTING HAND IN Answers Are Recorded on Question Paper CISC124, FALL TERM, 2013 FINAL EXAMINATION 7pm to 10pm, 18 DECEMBER 2013 Instructor: Alan McLeod If the instructor

More information

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written. Solution HAND IN Answers Are Recorded on Question Paper QUEEN'S UNIVERSITY SCHOOL OF COMPUTING CISC124, WINTER TERM, 2010 FINAL EXAMINATION 2pm to 5pm, 19 APRIL 2010, Dunning Hall Instructor: Alan McLeod

More information

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written. QUEEN'S UNIVERSIY SCHOOL O COMPUING HAND IN Answers Are Recorded on Exam Paper CMPE212, WINER ERM, 2016 INAL EXAMINAION 9am to 12pm, 19 APRIL 2016 Instructor: Alan McLeod If the instructor is unavailable

More information

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written. QUEEN'S UNIVERSITY SCHOOL OF COMPUTING HAND IN Answers Are Recorded on Question Paper CMPE212, FALL TERM, 2012 FINAL EXAMINATION 18 December 2012, 2pm Instructor: Alan McLeod If the instructor is unavailable

More information

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written. HAND IN Answers Are Recorded on Question Paper QUEEN'S UNIVERSITY SCHOOL OF COMPUTING CISC124, WINTER TERM, 2009 FINAL EXAMINATION 7pm to 10pm, 18 APRIL 2009, Dunning Hall Instructor: Alan McLeod If the

More information

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written. Solution HAND IN Answers Are Recorded on Question Paper QUEEN'S UNIVERSITY SCHOOL OF COMPUTING CISC212, FALL TERM, 2007 FINAL EXAMINATION 7pm to 10pm, 10 DECEMBER 2007, Jeffery Hall Instructor: Alan McLeod

More information

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written. QUEEN'S UNIVERSITY SCHOOL OF COMPUTING HAND IN Answers Are Recorded on Exam Paper CMPE212, WINTER TERM, 2016 FINAL EXAMINATION 9am to 12pm, 19 APRIL 2016 Instructor: Alan McLeod If the instructor is unavailable

More information

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written. HAND IN Answers Are Recorded on Question Paper QUEEN'S UNIVERSITY SCHOOL OF COMPUTING CISC212, FALL TERM, 2007 FINAL EXAMINATION 7pm to 10pm, 10 DECEMBER 2007, Jeffery Hall Instructor: Alan McLeod If the

More information

Page 1 of 16. Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Page 1 of 16. Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written. Page 1 of 16 SOLUTION HAND IN Answers Are Recorded on Question Paper QUEEN'S UNIVERSITY SCHOOL OF COMPUTING CISC212, FALL TERM, 2005 FINAL EXAMINATION 9am to 12noon, 19 DECEMBER 2005 Instructor: Alan McLeod

More information

Page 1 of 16. Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Page 1 of 16. Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written. Page 1 of 16 HAND IN Answers Are Recorded on Question Paper QUEEN'S UNIVERSITY SCHOOL OF COMPUTING CISC212, FALL TERM, 2005 FINAL EXAMINATION 9am to 12noon, 19 DECEMBER 2005 Instructor: Alan McLeod If

More information

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written. QUEEN'S UNIVERSITY SCHOOL OF COMPUTING HAND IN Answers Are Recorded on Question Paper CISC124, FALL TERM, 2015 FINAL EXAMINATION 7pm to 10pm, 15 DECEMBER 2015 Instructor: Alan McLeod If the instructor

More information

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written. QUEEN'S UNIVERSIY SCHOOL O COMPUING CISC124, ALL ERM, 2015 INAL EXAMINAION 7pm to 10pm, 15 DECEMBER 2015 Instructor: Alan McLeod HAND IN Answers Are Recorded on Question Paper SOLUION If the instructor

More information

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written. HAND IN Answers Are Recorded on Question Paper QUEEN'S UNIVERSITY SCHOOL OF COMPUTING CISC212, FALL TERM, 2009 FINAL EXAMINATION 14 DECEMBER 2009 Instructor: Alan McLeod If the instructor is unavailable

More information

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written. SOLUTION HAND IN Answers Are Recorded on Question Paper QUEEN'S UNIVERSITY SCHOOL OF COMPUTING CISC212, FALL TERM, 2008 FINAL EXAMINATION 7pm to 10pm, 17 DECEMBER 2008, Grant Hall Instructor: Alan McLeod

More information

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written. QUEEN'S UNIVERSITY SCHOOL OF COMPUTING CISC212, FALL TERM, 2010 FINAL EXAMINATION 11 DECEMBER 2010, 9am SOLUTION HAND IN Answers Are Recorded on Question Paper Instructor: Alan McLeod If the instructor

More information

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written. SOLUTION HAND IN Answers Are Recorded on Question Paper QUEEN'S UNIVERSITY SCHOOL OF COMPUTING CISC124, WINTER TERM, 2009 FINAL EXAMINATION 7pm to 10pm, 18 APRIL 2009, Dunning Hall Instructor: Alan McLeod

More information

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written. QUEEN'S UNIVERSITY SCHOOL OF COMPUTING CISC124, FALL TERM, 2013 FINAL EXAMINATION 7pm to 10pm, 18 DECEMBER 2013 Instructor: Alan McLeod HAND IN Answers Are Recorded on Question Paper SOLUTION If the instructor

More information

Page 1 of 16. Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Page 1 of 16. Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written. Page 1 of 16 SOLUTION HAND IN Answers Are Recorded on Question Paper QUEEN'S UNIVERSITY SCHOOL OF COMPUTING CISC212, FALL TERM, 2004 FINAL EXAMINATION 9am to 12noon, 22 DECEMBER 2004 Instructors: Alan

More information

1 Short Answer (10 Points Each)

1 Short Answer (10 Points Each) Name: Write all of your responses on these exam pages. 1 Short Answer (10 Points Each) 1. What is the difference between a compiler and an interpreter? Also, discuss how Java accomplishes this task. 2.

More information

CSC 1214: Object-Oriented Programming

CSC 1214: Object-Oriented Programming CSC 1214: Object-Oriented Programming J. Kizito Makerere University e-mail: jkizito@cis.mak.ac.ug www: http://serval.ug/~jona materials: http://serval.ug/~jona/materials/csc1214 e-learning environment:

More information

Chapter 3 Syntax, Errors, and Debugging. Fundamentals of Java

Chapter 3 Syntax, Errors, and Debugging. Fundamentals of Java Chapter 3 Syntax, Errors, and Debugging Objectives Construct and use numeric and string literals. Name and use variables and constants. Create arithmetic expressions. Understand the precedence of different

More information

Queen s University Faculty of Arts and Science School of Computing CISC 124 Final Examination December 2004 Instructor: M. Lamb

Queen s University Faculty of Arts and Science School of Computing CISC 124 Final Examination December 2004 Instructor: M. Lamb Queen s University Faculty of Arts and Science School of Computing CISC 124 Final Examination December 2004 Instructor: M. Lamb HAND IN Answers recorded on Examination paper This examination is THREE HOURS

More information

Lecture 3: Java Graphics & Events

Lecture 3: Java Graphics & Events Lecture 3: Java Graphics & Events CS 62 Fall 2017 Kim Bruce & Alexandra Papoutsaki Text Input Scanner class Constructor: myscanner = new Scanner(System.in); can use file instead of System.in new Scanner(new

More information

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written. HAND IN Answers Are Recorded on Question Paper QUEEN'S UNIVERSITY SCHOOL OF COMPUTING CISC212, FALL TERM, 2009 FINAL EXAMINATION 14 DECEMBER 2009 SOLUTION Instructor: Alan McLeod If the instructor is unavailable

More information

CS 180 Final Exam Review 12/(11, 12)/08

CS 180 Final Exam Review 12/(11, 12)/08 CS 180 Final Exam Review 12/(11, 12)/08 Announcements Final Exam Thursday, 18 th December, 10:20 am 12:20 pm in PHYS 112 Format 30 multiple choice questions 5 programming questions More stress on topics

More information

This exam is open book. Each question is worth 3 points.

This exam is open book. Each question is worth 3 points. This exam is open book. Each question is worth 3 points. Page 1 / 15 Page 2 / 15 Page 3 / 12 Page 4 / 18 Page 5 / 15 Page 6 / 9 Page 7 / 12 Page 8 / 6 Total / 100 (maximum is 102) 1. Are you in CS101 or

More information

CS1083 Week 2: Arrays, ArrayList

CS1083 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 information

5/3/2006. Today! HelloWorld in BlueJ. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont.

5/3/2006. Today! HelloWorld in BlueJ. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. Today! Build HelloWorld yourself in BlueJ and Eclipse. Look at all the Java keywords. Primitive Types. HelloWorld in BlueJ 1. Find BlueJ in the start menu, but start the Select VM program instead (you

More information

Multiple Choice Questions: Identify the choice that best completes the statement or answers the question. (15 marks)

Multiple Choice Questions: Identify the choice that best completes the statement or answers the question. (15 marks) M257 MTA Spring2010 Multiple Choice Questions: Identify the choice that best completes the statement or answers the question. (15 marks) 1. If we need various objects that are similar in structure, but

More information

Overview. Lecture 7: Inheritance and GUIs. Inheritance. Example 9/30/2008

Overview. Lecture 7: Inheritance and GUIs. Inheritance. Example 9/30/2008 Overview Lecture 7: Inheritance and GUIs Written by: Daniel Dalevi Inheritance Subclasses and superclasses Java keywords Interfaces and inheritance The JComponent class Casting The cosmic superclass Object

More information

RAIK 183H Examination 2 Solution. November 10, 2014

RAIK 183H Examination 2 Solution. November 10, 2014 RAIK 183H Examination 2 Solution November 10, 2014 Name: NUID: This examination consists of 5 questions and you have 110 minutes to complete the test. Show all steps (including any computations/explanations)

More information

Binghamton University. CS-140 Fall Problem Solving. Creating a class from scratch

Binghamton University. CS-140 Fall Problem Solving. Creating a class from scratch Problem Solving Creating a class from scratch 1 Recipe for Writing a Class 1. Write the class boilerplate stuff 2. Declare Fields 3. Write Creator(s) 4. Write accessor methods 5. Write mutator methods

More information

Practice Midterm 1. Problem Points Score TOTAL 50

Practice 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 information

1. An operation in which an overall value is computed incrementally, often using a loop.

1. An operation in which an overall value is computed incrementally, often using a loop. Practice Exam 2 Part I: Vocabulary (10 points) Write the terms defined by the statements below. 1. An operation in which an overall value is computed incrementally, often using a loop. 2. The < (less than)

More information

Fall 2017 CISC124 9/16/2017

Fall 2017 CISC124 9/16/2017 CISC124 Labs start this week in JEFF 155: Meet your TA. Check out the course web site, if you have not already done so. Watch lecture videos if you need to review anything we have already done. Problems

More information

DHANALAKSHMI SRINIVASAN COLLEGE OF ENGINEERING AND TECHNOLOGY ACADEMIC YEAR (ODD SEM)

DHANALAKSHMI SRINIVASAN COLLEGE OF ENGINEERING AND TECHNOLOGY ACADEMIC YEAR (ODD SEM) DHANALAKSHMI SRINIVASAN COLLEGE OF ENGINEERING AND TECHNOLOGY ACADEMIC YEAR 2018-19 (ODD SEM) DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING SUB: OBJECT ORIENTED PROGRAMMING SEM/YEAR: III SEM/ II YEAR

More information

5/24/2006. Last Time. Announcements. Today. Method Overloading. Method Overloading - Cont. Method Overloading - Cont. (Midterm Exam!

5/24/2006. Last Time. Announcements. Today. Method Overloading. Method Overloading - Cont. Method Overloading - Cont. (Midterm Exam! Last Time Announcements (Midterm Exam!) Assn 2 due tonight. Before that methods. Spring 2006 CISC101 - Prof. McLeod 1 Spring 2006 CISC101 - Prof. McLeod 2 Today Look at midterm solution. Review method

More information

Java for Non Majors. Final Study Guide. April 26, You will have an opportunity to earn 20 extra credit points.

Java for Non Majors. Final Study Guide. April 26, You will have an opportunity to earn 20 extra credit points. Java for Non Majors Final Study Guide April 26, 2017 The test consists of 1. Multiple choice questions 2. Given code, find the output 3. Code writing questions 4. Code debugging question 5. Short answer

More information

McGill University School of Computer Science COMP-202A Introduction to Computing 1

McGill University School of Computer Science COMP-202A Introduction to Computing 1 McGill University School of Computer Science COMP-202A Introduction to Computing 1 Midterm Exam Thursday, October 26, 2006, 18:00-20:00 (6:00 8:00 PM) Instructors: Mathieu Petitpas, Shah Asaduzzaman, Sherif

More information

Lecture 5: Java Graphics

Lecture 5: Java Graphics Lecture 5: Java Graphics CS 62 Spring 2019 William Devanny & Alexandra Papoutsaki 1 New Unit Overview Graphical User Interfaces (GUI) Components, e.g., JButton, JTextField, JSlider, JChooser, Containers,

More information

University of Cape Town ~ Department of Computer Science. Computer Science 1015F ~ 2007

University 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 information

CMSC 331 Second Midterm Exam

CMSC 331 Second Midterm Exam 1 20/ 2 80/ 331 First Midterm Exam 11 November 2003 3 20/ 4 40/ 5 10/ CMSC 331 Second Midterm Exam 6 15/ 7 15/ Name: Student ID#: 200/ You will have seventy-five (75) minutes to complete this closed book

More information

I pledge by honor that I will not discuss this exam with anyone until my instructor reviews the exam in the class.

I 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 information

Come & Join Us at VUSTUDENTS.net

Come & Join Us at VUSTUDENTS.net Come & Join Us at VUSTUDENTS.net For Assignment Solution, GDB, Online Quizzes, Helping Study material, Past Solved Papers, Solved MCQs, Current Papers, E-Books & more. Go to http://www.vustudents.net and

More information

Full file at

Full file at Java Programming: From Problem Analysis to Program Design, 3 rd Edition 2-1 Chapter 2 Basic Elements of Java At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class

More information

Language Features. 1. The primitive types int, double, and boolean are part of the AP

Language Features. 1. The primitive types int, double, and boolean are part of the AP Language Features 1. The primitive types int, double, and boolean are part of the AP short, long, byte, char, and float are not in the subset. In particular, students need not be aware that strings are

More information

First Name: AITI 2004: Exam 2 July 19, 2004

First 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 information

We are on the GUI fast track path

We are on the GUI fast track path We are on the GUI fast track path Chapter 13: Exception Handling Skip for now Chapter 14: Abstract Classes and Interfaces Sections 1 9: ActionListener interface Chapter 15: Graphics Skip for now Chapter

More information

COP 3330 Final Exam Review

COP 3330 Final Exam Review COP 3330 Final Exam Review I. The Basics (Chapters 2, 5, 6) a. comments b. identifiers, reserved words c. white space d. compilers vs. interpreters e. syntax, semantics f. errors i. syntax ii. run-time

More information

Lab & Assignment 1. Lecture 3: ArrayList & Standard Java Graphics. Random Number Generator. Read Lab & Assignment Before Lab Wednesday!

Lab & Assignment 1. Lecture 3: ArrayList & Standard Java Graphics. Random Number Generator. Read Lab & Assignment Before Lab Wednesday! Lab & Assignment 1 Lecture 3: ArrayList & Standard Java Graphics CS 62 Fall 2015 Kim Bruce & Michael Bannister Strip with 12 squares & 5 silver dollars placed randomly on the board. Move silver dollars

More information

CSE wi Final Exam 3/12/18. Name UW ID#

CSE wi Final Exam 3/12/18. Name UW ID# Name UW ID# There are 13 questions worth a total of 100 points. Please budget your time so you get to all of the questions. Keep your answers brief and to the point. The exam is closed book, closed notes,

More information

Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.

Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved. Assoc. Prof. Dr. Marenglen Biba Before writing a program to solve a problem, have a thorough understanding of the problem and a carefully planned approach to solving it. Understand the types of building

More information

CS 101 Fall 2006 Midterm 3 Name: ID:

CS 101 Fall 2006 Midterm 3 Name:  ID: You only need to write your name and e-mail ID on the first page. This exam is CLOSED text book, closed-notes, closed-calculator, closed-neighbor, etc. Questions are worth different amounts, so be sure

More information

Virtualians.ning.pk. 2 - Java program code is compiled into form called 1. Machine code 2. native Code 3. Byte Code (From Lectuer # 2) 4.

Virtualians.ning.pk. 2 - Java program code is compiled into form called 1. Machine code 2. native Code 3. Byte Code (From Lectuer # 2) 4. 1 - What if the main method is declared as private? 1. The program does not compile 2. The program compiles but does not run 3. The program compiles and runs properly ( From Lectuer # 2) 4. The program

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

Selected Questions from by Nageshwara Rao

Selected 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 information

1. Java is a... language. A. moderate typed B. strogly typed C. weakly typed D. none of these. Answer: B

1. Java is a... language. A. moderate typed B. strogly typed C. weakly typed D. none of these. Answer: B 1. Java is a... language. A. moderate typed B. strogly typed C. weakly typed D. none of these 2. How many primitive data types are there in Java? A. 5 B. 6 C. 7 D. 8 3. In Java byte, short, int and long

More information

1.00 Introduction to Computers and Engineering Problem Solving. Quiz 1 March 7, 2003

1.00 Introduction to Computers and Engineering Problem Solving. Quiz 1 March 7, 2003 1.00 Introduction to Computers and Engineering Problem Solving Quiz 1 March 7, 2003 Name: Email Address: TA: Section: You have 90 minutes to complete this exam. For coding questions, you do not need to

More information

Practice Midterm 1 Answer Key

Practice Midterm 1 Answer Key CS 120 Software Design I Fall 2018 Practice Midterm 1 Answer Key University of Wisconsin - La Crosse Due Date: October 5 NAME: Do not turn the page until instructed to do so. This booklet contains 10 pages

More information

CS506 Web Design & Development Final Term Solved MCQs with Reference

CS506 Web Design & Development Final Term Solved MCQs with Reference with Reference I am student in MCS (Virtual University of Pakistan). All the MCQs are solved by me. I followed the Moaaz pattern in Writing and Layout this document. Because many students are familiar

More information

Review Chapters 1 to 4. Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013

Review Chapters 1 to 4. Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013 Review Chapters 1 to 4 Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013 Introduction to Java Chapters 1 and 2 The Java Language Section 1.1 Data & Expressions Sections 2.1 2.5 Instructor:

More information

IT101. Graphical User Interface

IT101. Graphical User Interface IT101 Graphical User Interface Foundation Swing is a platform-independent set of Java classes used for user Graphical User Interface (GUI) programming. Abstract Window Toolkit (AWT) is an older Java GUI

More information

F I N A L E X A M I N A T I O N

F 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 information

First Name: AITI 2004: Exam 2 July 19, 2004

First Name: AITI 2004: Exam 2 July 19, 2004 First Name: AITI 2004: Exam 2 July 19, 2004 Last Name: Standard Track Read Instructions Carefully! This is a 3 hour closed book exam. No calculators are allowed. Please write clearly if we cannot understand

More information

Chapter 9. Exception Handling. Copyright 2016 Pearson Inc. All rights reserved.

Chapter 9. Exception Handling. Copyright 2016 Pearson Inc. All rights reserved. Chapter 9 Exception Handling Copyright 2016 Pearson Inc. All rights reserved. Last modified 2015-10-02 by C Hoang 9-2 Introduction to Exception Handling Sometimes the best outcome can be when nothing unusual

More information

Java Programming Lecture 6

Java Programming Lecture 6 Java Programming Lecture 6 Alice E. Fischer Feb 15, 2013 Java Programming - L6... 1/32 Dialog Boxes Class Derivation The First Swing Programs: Snow and Moving The Second Swing Program: Smile Swing Components

More information

Contents Chapter 1 Introduction to Programming and the Java Language

Contents Chapter 1 Introduction to Programming and the Java Language Chapter 1 Introduction to Programming and the Java Language 1.1 Basic Computer Concepts 5 1.1.1 Hardware 5 1.1.2 Operating Systems 8 1.1.3 Application Software 9 1.1.4 Computer Networks and the Internet

More information

+! Today. Lecture 3: ArrayList & Standard Java Graphics 1/26/14! n Reading. n Objectives. n Reminders. n Standard Java Graphics (on course webpage)

+! Today. Lecture 3: ArrayList & Standard Java Graphics 1/26/14! n Reading. n Objectives. n Reminders. n Standard Java Graphics (on course webpage) +! Lecture 3: ArrayList & Standard Java Graphics +! Today n Reading n Standard Java Graphics (on course webpage) n Objectives n Review for this week s lab and homework assignment n Miscellanea (Random,

More information

Inheritance Systems. Merchandise. Television Camcorder Shirt Shoe Dress 9.1.1

Inheritance Systems. Merchandise. Television Camcorder Shirt Shoe Dress 9.1.1 Merchandise Inheritance Systems Electronics Clothing Television Camcorder Shirt Shoe Dress Digital Analog 9.1.1 Another AcademicDisciplines Hierarchy Mathematics Engineering Algebra Probability Geometry

More information

CISC-124. Passing Parameters. A Java method cannot change the value of any of the arguments passed to its parameters.

CISC-124. Passing Parameters. A Java method cannot change the value of any of the arguments passed to its parameters. CISC-124 20180215 These notes are intended to summarize and clarify some of the topics that have been covered recently in class. The posted code samples also have extensive explanations of the material.

More information

Learning the Java Language. 2.1 Object-Oriented Programming

Learning the Java Language. 2.1 Object-Oriented Programming Learning the Java Language 2.1 Object-Oriented Programming What is an Object? Real world is composed by different kind of objects: buildings, men, women, dogs, cars, etc. Each object has its own states

More information

Computer Science II (20082) Week 1: Review and Inheritance

Computer Science II (20082) Week 1: Review and Inheritance Computer Science II 4003-232-08 (20082) Week 1: Review and Inheritance Richard Zanibbi Rochester Institute of Technology Review of CS-I Syntax and Semantics of Formal (e.g. Programming) Languages Syntax

More information

AP CS Unit 11: Graphics and Events

AP CS Unit 11: Graphics and Events AP CS Unit 11: Graphics and Events This packet shows how to create programs with a graphical interface in a way that is consistent with the approach used in the Elevens program. Copy the following two

More information

Java for Non Majors Spring 2018

Java for Non Majors Spring 2018 Java for Non Majors Spring 2018 Final Study Guide The test consists of 1. Multiple choice questions - 15 x 2 = 30 points 2. Given code, find the output - 3 x 5 = 15 points 3. Short answer questions - 3

More information

Introduction to Visual Basic and Visual C++ Introduction to Java. JDK Editions. Overview. Lesson 13. Overview

Introduction to Visual Basic and Visual C++ Introduction to Java. JDK Editions. Overview. Lesson 13. Overview Introduction to Visual Basic and Visual C++ Introduction to Java Lesson 13 Overview I154-1-A A @ Peter Lo 2010 1 I154-1-A A @ Peter Lo 2010 2 Overview JDK Editions Before you can write and run the simple

More information

Recitation 02/02/07 Defining Classes and Methods. Chapter 4

Recitation 02/02/07 Defining Classes and Methods. Chapter 4 Recitation 02/02/07 Defining Classes and Methods 1 Miscellany Project 2 due last night Exam 1 (Ch 1-4) Thursday, Feb. 8, 8:30-9:30pm PHYS 112 Sample Exam posted Project 3 due Feb. 15 10:00pm check newsgroup!

More information

Programming: You will have 6 files all need to be located in the dir. named PA4:

Programming: You will have 6 files all need to be located in the dir. named PA4: PROGRAMMING ASSIGNMENT 4: Read Savitch: Chapter 7 and class notes Programming: You will have 6 files all need to be located in the dir. named PA4: PA4.java ShapeP4.java PointP4.java CircleP4.java RectangleP4.java

More information

This exam is closed textbook(s) and closed notes. Use of any electronic device (e.g., for computing and/or communicating) is NOT permitted.

This exam is closed textbook(s) and closed notes. Use of any electronic device (e.g., for computing and/or communicating) is NOT permitted. York University AS/AK/ITEC 2610 3.0 All Sections OBJECT-ORIENTED PROGRAMMING Midterm Test Duration: 90 Minutes This exam is closed textbook(s) and closed notes. Use of any electronic device (e.g., for

More information

UNIT 3 ARRAYS, RECURSION, AND COMPLEXITY CHAPTER 11 CLASSES CONTINUED

UNIT 3 ARRAYS, RECURSION, AND COMPLEXITY CHAPTER 11 CLASSES CONTINUED UNIT 3 ARRAYS, RECURSION, AND COMPLEXITY CHAPTER 11 CLASSES CONTINUED EXERCISE 11.1 1. static public final int DEFAULT_NUM_SCORES = 3; 2. Java allocates a separate set of memory cells in each instance

More information

Midterm assessment - MAKEUP Fall 2010

Midterm assessment - MAKEUP Fall 2010 M257 MTA Faculty of Computer Studies Information Technology and Computing Date: /1/2011 Duration: 60 minutes 1-Version 1 M 257: Putting Java to Work Midterm assessment - MAKEUP Fall 2010 Student Name:

More information

Program Fundamentals

Program Fundamentals Program Fundamentals /* HelloWorld.java * The classic Hello, world! program */ class HelloWorld { public static void main (String[ ] args) { System.out.println( Hello, world! ); } } /* HelloWorld.java

More information

Operators and Expressions

Operators and Expressions Operators and Expressions Conversions. Widening and Narrowing Primitive Conversions Widening and Narrowing Reference Conversions Conversions up the type hierarchy are called widening reference conversions

More information

Do not turn to the next page until the start of the exam.

Do not turn to the next page until the start of the exam. Principles of Java Language with Applications, PIC20a E. Ryu Winter 2017 Final Exam Monday, March 20, 2017 3 hours, 8 questions, 100 points, 11 pages While we don t expect you will need more space than

More information

CS506 Web Programming and Development Solved Subjective Questions With Reference For Final Term Lecture No 1

CS506 Web Programming and Development Solved Subjective Questions With Reference For Final Term Lecture No 1 P a g e 1 CS506 Web Programming and Development Solved Subjective Questions With Reference For Final Term Lecture No 1 Q1 Describe some Characteristics/Advantages of Java Language? (P#12, 13, 14) 1. Java

More information

Fall 2017 CISC124 10/1/2017

Fall 2017 CISC124 10/1/2017 CISC124 Today First onq quiz this week write in lab. More details in last Wednesday s lecture. Repeated: The quiz availability times will change to match each lab as the week progresses. Useful Java classes:

More information

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

Weiss Chapter 1 terminology (parenthesized numbers are page numbers) Weiss Chapter 1 terminology (parenthesized numbers are page numbers) assignment operators In Java, used to alter the value of a variable. These operators include =, +=, -=, *=, and /=. (9) autoincrement

More information

Practice Questions for Final Exam: Advanced Java Concepts + Additional Questions from Earlier Parts of the Course

Practice 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 information

CS Exam 3 - Spring 2010

CS Exam 3 - Spring 2010 CS 1316 - Exam 3 - Spring 2010 Name: Grading TA: Section: INTEGRITY: By taking this exam, you pledge that this is your work and you have neither given nor received inappropriate help during the taking

More information

3. Java - Language Constructs I

3. Java - Language Constructs I Educational Objectives 3. Java - Language Constructs I Names and Identifiers, Variables, Assignments, Constants, Datatypes, Operations, Evaluation of Expressions, Type Conversions You know the basic blocks

More information

Introduction This assignment will ask that you write a simple graphical user interface (GUI).

Introduction This assignment will ask that you write a simple graphical user interface (GUI). Computing and Information Systems/Creative Computing University of London International Programmes 2910220: Graphical Object-Oriented and Internet programming in Java Coursework one 2011-12 Introduction

More information

Java Programming. MSc Induction Tutorials Stefan Stafrace PhD Student Department of Computing

Java Programming. MSc Induction Tutorials Stefan Stafrace PhD Student Department of Computing Java Programming MSc Induction Tutorials 2011 Stefan Stafrace PhD Student Department of Computing s.stafrace@surrey.ac.uk 1 Tutorial Objectives This is an example based tutorial for students who want to

More information

For example, here is a code snippet that supplies a legal data set to the constructor:

For example, here is a code snippet that supplies a legal data set to the constructor: Problem 1) [This problem is longer than what you will see on the quiz. You would not be asked to write as many methods, just one or two of them. This is still good practice, however!] For this problem

More information

1 Epic Test Review 2 Epic Test Review 3 Epic Test Review 4. Epic Test Review 5 Epic Test Review 6 Epic Test Review 7 Epic Test Review 8

1 Epic Test Review 2 Epic Test Review 3 Epic Test Review 4. Epic Test Review 5 Epic Test Review 6 Epic Test Review 7 Epic Test Review 8 Epic Test Review 1 Epic Test Review 2 Epic Test Review 3 Epic Test Review 4 Write a line of code that outputs the phase Hello World to the console without creating a new line character. System.out.print(

More information

CPSC 219 Extra review and solutions

CPSC 219 Extra review and solutions CPSC 219 Extra review and solutions Multiple choice questions: Unless otherwise specified assume that all necessary variable declarations have been made. For Questions 1 6 determine the output of the print()

More information

Final Examination Semester 2 / Year 2010

Final Examination Semester 2 / Year 2010 Southern College Kolej Selatan 南方学院 Final Examination Semester 2 / Year 2010 COURSE : JAVA PROGRAMMING COURSE CODE : PROG1114 TIME : 2 1/2 HOURS DEPARTMENT : COMPUTER SCIENCE LECTURER : LIM PEI GEOK Student

More information