Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.
|
|
- Lucas Woods
- 5 years ago
- Views:
Transcription
1 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 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. The back of any page can be used for rough work. This exam is three hours long and refers exclusively to the use of the Java language. Comments are not required in the code you write. For full marks, code must be efficient as well as correct. This is a closed book exam. No computers or calculators are allowed. Student Number: Problem 1: / 15 Problem 2c: / 5 Problem 2a: / 10 Problem 2d: / 30 Problem 2b: / 10 Problem 3: / 10 TOTAL: / 80 This material is copyrighted and is for the sole use of students registered in CISC124 and writing this exam. This material shall not be distributed or disseminated. Failure to abide by these conditions is a breach of copyright and may also constitute a breach of academic integrity under the University Senate's Academic Integrity Policy Statement.
2 Student Number: Page 2 of 21 Problem 1) [15 marks]: Qualitative Java Write a T or F on the line before each of the following statements to indicate if it is True or False: 1. In an expression that does not contain any round brackets, binary boolean comparisons will be carried out before binary arithmetic operations are evaluated. 2. The operator always evaluates the expressions on both sides of the operator. 3. Casting operations have a higher precedence than arithmetic operations in any expression. 4. The ++ pre-increment operator carries out the increment after the variable is used in an expression. 5. If an expression contains a non-void method call that results in an exception being thrown by that method, the returned value from the method call can still be used to complete the evaluation of the expression. 6. Switch statements can be used with String type arguments in Java Any switch statement construct can be built using a chained if construct. 8. A for each loop must be coded to use the index value to obtain collection elements. 9. Thrown exceptions will be propagated to the main method if they are not caught in a try/catch block. 10. Passing an array into a method involves the creation of a new copy of that array and all of its elements in the method. 11. Automatic boxing can simplify the use of Wrapper classes with Generic classes. 12. The Math class contains only non-static methods and attributes. 13. Strings are immutable objects. 14. Arrays are immutable objects. 15. A object that extends JFrame inherits a frame that displays with a title bar and the normal window title bar controls.
3 Student Number: Page 3 of 21 Problem 1, Cont.) 16. Components laid down in a JPanel using FlowLayout will always be touching each other when displayed. 17. A component placed in the Center position of a BorderLayout will swell to touch the edges of that position. 18. A GridLayout type object can be instantiated using a constructor that accepts the number of rows and columns to be used in the grid. 19. The text attribute of a JLabel in a running GUI program can only be changed in code through a mutator. 20. A JTextField component can display multiple lines of text. 21. There is more than one listener class that can respond to mouse initiated events. 22. System-generated component re-draws invoke the paint(graphics g) method for that component. 23. Code-generated component re-draws can also be carried out by invoking the paint(graphics g) method directly. 24. To invoke a component s repaint() method you must supply the Graphics object associated with that component to the method. 25. Windows created in Java 7 do not have to be rectangular in shape. 26. Many listener objects can be attached to a single Timer thread. 27. Once an instance of a Thread object is started, it cannot be stopped until the application owning the thread is finished. 28. An exception is used to stop a Thread object. 29. An exception is used to stop a Timer object. 30. It is possible to speed up a Quicksort method by using the Fork/Join framework to spread the task over multiple processor cores.
4 Student Number: Page 4 of 21 Problem 2) [55 marks] Encapsulation, Polymorphism This is a multi-part problem that explores how a position dataset can be based on different coordinate systems. While not necessary, it is probably best to attempt each part of this problem in the order in which they are presented. A large testing program and its output is provided after the object specifications. You may not need to examine this program unless it would help to see an example of the specific behaviour of one of the objects you have to create. All of the specifications will be presented below, followed by the testing program and then space will be provided for your code. a) [10 marks] Create a properly encapsulated class called Point that must implement the Comparable<Point> interface. This interface requires that you implement a method with the signature: public int compareto(point otherpoint); This method returns -1 if the supplied other Point is larger than the current point, 0 if they are the same size (to within ±1e-6) and +1 if the supplied Point is smaller. For this compareto() method, size is considered to be the square root of the sum of the squares of the attributes of the class. You can only have two double type attributes in your Point class, which will be the x and y values for the position of the point. So, the size used by compareto() is the distance from the origin, (0, 0) to the (x, y) position of the point. The further away a point is from the origin, the larger it is. Note that any class that implements the Comparable<T> interface can be sorted with the static Arrays.sort() method, where the Arrays class is part of the java.util package. The Point class only constructor can accept two doubles of any magnitude, so it does not need to throw any exception. Write public mutators and accessors for both attributes. The Point object will be mutable. You will also need equals(), clone() and tostring() methods. The equals() method must override the equals() method from the base Object class, and equality is defined as supplied and current attributes being the same to within ± 1e-6 (for simplicity). The String representation of a Point is shown in the testing program. Remember that Math.abs() returns the absolute value of its argument and Math.sqrt() returns the square root of its argument. b) [10 marks] Create another properly encapsulated class called Point3D that extends the Point class described in part a). This class can only have one double type attribute, z, which will be the third dimensional coordinate, allowing Point3D to describe a position in three-dimensional space. Write one three-parameter constructor that can accept three doubles of any magnitude. A mutator and accessor for your z parameter are also required. You will also need equals(), compareto(), clone() and tostring(), as you have for your Point class. Use the same basis for equality as described in part a), but applied to all three attributes, and compareto() will use the square root of the sum of the squares of x, y and z. c) [5 marks] Write an exception class called DataException that extends the Exception class. Include the usual two constructors - one that takes a String message and another that has an empty parameter list which supplies a default message. This class will be used by the Dataset class described in part d). d) [30 marks] Write another properly encapsulated class called Dataset, which can only have a single attribute of type Point[ ]. This means that the underlying data structure of a Dataset object will be an array of Point objects. Note that this array cannot have any empty positions; it must always be exactly sized to store the supplied data.
5 Student Number: Page 5 of 21 Problem 2d, Cont.) The Dataset object will have two public constructors, one which takes two one-dimensional arrays of double, and another which takes three one-dimensional arrays of double. These arrays will hold coordinate positions. One array for x values, a second array for y values and the third array for z values. You can see that a Dataset can store coordinates as an array of Point objects (two-dimensional) or an array of Point3D objects (three-dimensional). Fortunately, the Point[ ] type attribute of your class can point to either array structure. You must throw a DataException object with an appropriate message (see the testing class output), if any of the supplied arrays are null, of a length less than 2, or of different lengths. A Dataset object will be immutable, and you must make sure there are no data leaks. This means that you must not return pointers aliased to your attributes. You will need an accessor for your Point[ ] type attribute, but no public mutator is required. You must also supply a clone() method that returns a deep copy of the current Dataset object. Write a sort() method for Dataset that employs the compareto() methods written for the Point hierarchy to sort the Point[ ] array in situ. Remember that there is an easy way to do this! Include an equals() method that overrides the equals() method of the base Object class. Two Dataset objects are equal if their Points are all equal to within ±1e-6, and in the same array positions. (Do not sort the arrays before comparing.) Include a compareto() method that compares Dataset objects on the basis of the length of their arrays only. So, a Dataset object with more points will be larger than a Dataset object with fewer points. Finally, you need to include two, overloaded append() methods in your Dataset class. The first append() method takes two doubles, an x value and a y value. The second append() method takes three doubles, an x value, a y value and a z value. Both append() methods must create the appropriate Point object and add this new Point object to the end of the Point[ ] array, without deleting any of the existing Point objects in the array. To make the append() methods more interesting, they should throw a DataException when a Dataset holding two-dimensional data is asked to append a three-dimensional Point, or when a Dataset holding three-dimensional data is asked to append a two-dimensional point. Remember that there are two ways to check object types using the instanceof keyword and using the getclass() method inherited from the base Object class. For example, invoking getclass().tostring() on an instance of a Point object would yield the String class Point. The Testing program carries out a set of tests on the Point, Point3D and Dataset objects. Your classes should provide the output shown as block comments in the body of the program: public class Testing { // Console output is shown in a block comment under each section: public static void main(string[] args) { // Testing 2D Point object: Point point1 = new Point(3.0, 4.0); Point point2 = new Point(6.0, 7.0); Point point3 = new Point( e 8, 7.0 1e 10); System.out.println("point1 is: " + point1); System.out.println("supplied is larger: " + point1.compareto(point2)); System.out.println("supplied is smaller: " + point2.compareto(point1));
6 Student Number: Page 6 of 21 System.out.println("supplied is the same: " + point2.compareto(point3)); point1 is: x = 3.0, y = 4.0 supplied is larger: 1 supplied is smaller: 1 supplied is the same: 0 System.out.println("not equals: " + point1.equals(point2)); System.out.println("equals: " + point2.equals(point3)); not equals: false equals: true Point point4 = point1.clone(); System.out.println("point4 is: " + point4); point4.setx(10.0); point4.sety(20.0); System.out.println("point4 is: " + point4); System.out.println("point1 is: " + point1); point4 is: x = 3.0, y = 4.0 point4 is: x = 10.0, y = 20.0 point1 is: x = 3.0, y = 4.0 // Testing 3D Point object: Point3D point5 = new Point3D(3.0, 4.0, 5.0); Point3D point6 = new Point3D(6.0, 7.0, 8.0); Point3D point7 = new Point3D( e 8, 7.0, 8.0); System.out.println("point5 is: " + point5); point5 is: x = 3.0, y = 4.0, z = 5.0 System.out.println("supplied is larger: " + point5.compareto(point6)); System.out.println("supplied is smaller: " + point6.compareto(point5)); System.out.println("supplied is the same: " + point6.compareto(point7)); supplied is larger: 1 supplied is smaller: 1 supplied is the same: 0 // Testing Dataset object Constructors: double[] nullarray = null; double[] toosmallarray = {1.0; double[] size3array = {1.0, 2.0, 3.0; double[] array1 = {3.0, 1.0, 4.0, 6.0; double[] array2 = {1.0, 2.0, 5.0, 8.0; double[] array3 = {0.0, 1.0, 3.0, 9.0; Dataset test = null; test = new Dataset(nullArray, size3array);
7 Student Number: Page 7 of 21 test = new Dataset(tooSmallArray, toosmallarray); test = new Dataset(array1, size3array); test = new Dataset(array1, array2); System.out.println(test); One or the other array is null. Not enough points. Array sizes do not match. Dataset contents: x = 3.0, y = 1.0 x = 1.0, y = 2.0 x = 4.0, y = 5.0 x = 6.0, y = 8.0 Dataset test3d = null; test3d = new Dataset(array1, array2, size3array); test3d = new Dataset(array1, array2, array3); System.out.println(test3D); Array sizes do not match. Dataset contents: x = 3.0, y = 1.0, z = 0.0 x = 1.0, y = 2.0, z = 1.0 x = 4.0, y = 5.0, z = 3.0 x = 6.0, y = 8.0, z = 9.0 // Testing sort method: test3d.sort(); System.out.println(test3D); Dataset contents:
8 Student Number: Page 8 of 21 x = 1.0, y = 2.0, z = 1.0 x = 3.0, y = 1.0, z = 0.0 x = 4.0, y = 5.0, z = 3.0 x = 6.0, y = 8.0, z = 9.0 // Testing clone method and getdata() accessor: Dataset test3dcopy = test3d.clone(); Point3D firstpoint = (Point3D)test3DCopy.getData()[0]; firstpoint.setx(100.0); firstpoint.sety(200.0); firstpoint.setz(300.0); System.out.println("firstPoint is: " + firstpoint); test3dcopy.getdata()[1] = new Point3D(700.0, 800.0, 900.0); System.out.println(test3DCopy); System.out.println(test3D); firstpoint is: x = 100.0, y = 200.0, z = Dataset contents: x = 1.0, y = 2.0, z = 1.0 x = 3.0, y = 1.0, z = 0.0 x = 4.0, y = 5.0, z = 3.0 x = 6.0, y = 8.0, z = 9.0 Dataset contents: x = 1.0, y = 2.0, z = 1.0 x = 3.0, y = 1.0, z = 0.0 x = 4.0, y = 5.0, z = 3.0 x = 6.0, y = 8.0, z = 9.0 // Testing equals and clone on 2D dataset: Dataset testcopy = test.clone(); System.out.println(test.equals(testCopy)); testcopy.sort(); System.out.println(testCopy); System.out.println(test.equals(testCopy)); System.out.println(test.equals(test3D)); true Dataset contents: x = 1.0, y = 2.0 x = 3.0, y = 1.0 x = 4.0, y = 5.0 x = 6.0, y = 8.0 false false // Testing compareto() with 2D dataset: double[] largerarray1 = {2.0, 3.0, 4.0, 5.0, 6.0, 7.0; double[] largerarray2 = {1.0, 0.0, 3.0, 5.0, 8.0, 9.0; Dataset testlarger = null; testlarger = new Dataset(largerArray1, largerarray2);
9 Student Number: Page 9 of 21 System.out.println("supplied is larger: " + test.compareto(testlarger)); System.out.println("supplied is smaller: " + testlarger.compareto(test)); System.out.println("supplied is the same: " + test.compareto(test)); supplied is larger: 2 supplied is smaller: 2 supplied is the same: 0 // Testing append() methods: test.append(10.0, 12.0, 14.0); test.append(10.0, 12.0); System.out.println(test); test3d.append(10.0, 12.0, 14.0); test3d.append(10.0, 12.0); System.out.println(test3D); Cannot append 3D point to 2D array. Dataset contents: x = 3.0, y = 1.0 x = 1.0, y = 2.0 x = 4.0, y = 5.0 x = 6.0, y = 8.0 x = 10.0, y = 12.0 Cannot append 2D point to 3D array. Dataset contents: x = 1.0, y = 2.0, z = 1.0 x = 3.0, y = 1.0, z = 0.0 x = 4.0, y = 5.0, z = 3.0 x = 6.0, y = 8.0, z = 9.0 x = 10.0, y = 12.0, z = 14.0 // end main // end Testing class
10 Student Number: Page 10 of 21 Problem 2a) Code the Point class:
11 Student Number: Page 11 of 21 Problem 2a) Code the Point class, Cont.:
12 Student Number: Page 12 of 21 Problem 2b) Code the Point3D class:
13 Student Number: Page 13 of 21 Problem 2b) Code the Point3D class, Cont.:
14 Student Number: Page 14 of 21 Problem 2c) Code the DataException class: Problem 2d) Code the Dataset class:
15 Student Number: Page 15 of 21 Problem 2d) Code the Dataset class, Cont.:
16 Student Number: Page 16 of 21 Problem 2d) Code the Dataset class, Cont.:
17 Student Number: Page 17 of 21 Problem 2d) Code the Dataset class, Cont.:
18 Student Number: Page 18 of 21 Problem 2d) Code the Dataset class, Cont.:
19 Student Number: Page 19 of 21 Problem 3) [10 marks] GUI Coding Here is some of the class that was used to generate the window shown above: import javax.swing.jframe; import javax.swing.jbutton; import javax.swing.jpanel; import java.awt.borderlayout; import java.awt.flowlayout; import java.awt.gridlayout; import java.awt.font; public class ExamWindow extends JFrame { private final int WIDTH = 500; private final int HEIGHT = 400; private final int LEFT = 200; private final int TOP = 100; Font f = new Font("Arial", Font.PLAIN, 18); JButton[] buttonarray; public ExamWindow() { super(); setsize(width, HEIGHT); setdefaultcloseoperation(jframe.exit_on_close); settitle("layout Problem"); setlocation(left, TOP); setlayout(); // end constructor // end ExamWindow class
20 Student Number: Page 20 of 21 Problem 3, Cont.) In the box below, write the method setlayout(), to be included in the ExamWindow class, that creates the buttons and the window layout shown on the previous page. You may use the array of JButton objects, and you cannot use any layout managers other than the three imported in the code shown on the previous page.
21 Student Number: Page 21 of 21 (Extra page)
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 informationProctors 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 informationProctors 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 informationPage 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 informationPage 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 informationProctors 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 informationProctors 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 informationProctors 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 informationProctors 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 informationProctors 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 informationProctors 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 informationProctors 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 informationProctors 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 informationProctors 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 informationProctors 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 informationProctors 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 informationProctors 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 informationPage 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 informationProctors 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 informationProctors 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, 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
More informationProctors 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 informationProctors 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 informationProctors 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 informationOverview. 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 informationLanguage 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 informationContents 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 informationObjects and Iterators
Objects and Iterators Can We Have Data Structures With Generic Types? What s in a Bag? All our implementations of collections so far allowed for one data type for the entire collection To accommodate a
More informationSubclass Gist Example: Chess Super Keyword Shadowing Overriding Why? L10 - Polymorphism and Abstract Classes The Four Principles of Object Oriented
Table of Contents L01 - Introduction L02 - Strings Some Examples Reserved Characters Operations Immutability Equality Wrappers and Primitives Boxing/Unboxing Boxing Unboxing Formatting L03 - Input and
More informationChapter 6 Introduction to Defining Classes
Introduction to Defining Classes Fundamentals of Java: AP Computer Science Essentials, 4th Edition 1 Objectives Design and implement a simple class from user requirements. Organize a program in terms of
More informationIntroduction 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 informationThis page intentionally left blank
This page intentionally left blank arting Out with Java: From Control Structures through Objects International Edition - PDF - PDF - PDF Cover Contents Preface Chapter 1 Introduction to Computers and Java
More informationCOURSE DESCRIPTION. John Lewis and William Loftus; Java: Software Solutions; Addison Wesley
COURSE DESCRIPTION Dept., Number Semester hours IS 323 Course Title 4 Course Coordinator Object Oriented Programming Catherine Dwyer and John Molluzzo Catalog Description (2004-2006) Continued development
More informationGraphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub
Lebanese University Faculty of Science Computer Science BS Degree Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub 2 Crash Course in JAVA Classes A Java
More informationJFrame In Swing, a JFrame is similar to a window in your operating system
JFrame In Swing, a JFrame is similar to a window in your operating system All components will appear inside the JFrame window Buttons, text labels, text fields, etc. 5 JFrame Your GUI program must inherit
More informationMurach s Beginning Java with Eclipse
Murach s Beginning Java with Eclipse Introduction xv Section 1 Get started right Chapter 1 An introduction to Java programming 3 Chapter 2 How to start writing Java code 33 Chapter 3 How to use classes
More informationMidterm 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 information1 Shyam sir JAVA Notes
1 Shyam sir JAVA Notes 1. What is the most important feature of Java? Java is a platform independent language. 2. What do you mean by platform independence? Platform independence means that we can write
More informationWeiss 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 informationDHANALAKSHMI 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 informationCO Java SE 8: Fundamentals
CO-83527 Java SE 8: Fundamentals Summary Duration 5 Days Audience Application Developer, Developer, Project Manager, Systems Administrator, Technical Administrator, Technical Consultant and Web Administrator
More information15CS45 : OBJECT ORIENTED CONCEPTS
15CS45 : OBJECT ORIENTED CONCEPTS QUESTION BANK: What do you know about Java? What are the supported platforms by Java Programming Language? List any five features of Java? Why is Java Architectural Neutral?
More informationMultiple 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 informationBuilding Java Programs
Building Java Programs A Back to Basics Approach Stuart Reges I Marty Stepp University ofwashington Preface 3 Chapter 1 Introduction to Java Programming 25 1.1 Basic Computing Concepts 26 Why Programming?
More informationAgenda. Objects and classes Encapsulation and information hiding Documentation Packages
Preliminaries II 1 Agenda Objects and classes Encapsulation and information hiding Documentation Packages Inheritance Polymorphism Implementation of inheritance in Java Abstract classes Interfaces Generics
More informationContents. Figures. Tables. Examples. Foreword. Preface. 1 Basics of Java Programming 1. xix. xxi. xxiii. xxvii. xxix
PGJC4_JSE8_OCA.book Page ix Monday, June 20, 2016 2:31 PM Contents Figures Tables Examples Foreword Preface xix xxi xxiii xxvii xxix 1 Basics of Java Programming 1 1.1 Introduction 2 1.2 Classes 2 Declaring
More informationJava Just in Time: Collected concepts after chapter 18
Java Just in Time: Collected concepts after chapter 18 John Latham, School of Computer Science, Manchester University, UK. April 15, 2011 Contents 1 Computer basics 18000 1.1 Computer basics: hardware
More informationProctors 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 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 informationOLLSCOIL NA héireann THE NATIONAL UNIVERSITY OF IRELAND COLÁISTE NA hollscoile, CORCAIGH UNIVERSITY COLLEGE, CORK. Summer Examination 2012
OLLSCOIL NA héireann THE NATIONAL UNIVERSITY OF IRELAND COLÁISTE NA hollscoile, CORCAIGH UNIVERSITY COLLEGE, CORK Summer Examination 2012 Computer Science CS5015 Object-oriented Software Development Prof.
More informationFirst 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 informationBuilding a GUI in Java with Swing. CITS1001 extension notes Rachel Cardell-Oliver
Building a GUI in Java with Swing CITS1001 extension notes Rachel Cardell-Oliver Lecture Outline 1. Swing components 2. Building a GUI 3. Animating the GUI 2 Swing A collection of classes of GUI components
More informationFinal 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 informationHanley s Survival Guide for Visual Applications with NetBeans 2.0 Last Updated: 5/20/2015 TABLE OF CONTENTS
Hanley s Survival Guide for Visual Applications with NetBeans 2.0 Last Updated: 5/20/2015 TABLE OF CONTENTS Glossary of Terms 2-4 Step by Step Instructions 4-7 HWApp 8 HWFrame 9 Never trust a computer
More informationThis page intentionally left blank
This page intentionally left blank Absolute Java, Global Edition Table of Contents Cover Title Page Copyright Page Preface Acknowledgments Brief Contents Contents Chapter 1 Getting Started 1.1 INTRODUCTION
More informationCS-140 Fall 2017 Test 1 Version Practice Practice for Nov. 20, Name:
CS-140 Fall 2017 Test 1 Version Practice Practice for Nov. 20, 2017 Name: 1. (10 points) For the following, Check T if the statement is true, the F if the statement is false. (a) T F : If a child overrides
More informationMyProgram m i ng Lab. get with the programming. Through the power of practice and immediate personalized
get with the programming Through the power of practice and immediate personalized feedback, MyProgrammingLab improves your performance. MyProgram m i ng Lab Learn more at www.myprogramminglab.com Preface
More informationCONTENTS. Chapter 1 Getting Started with Java SE 6 1. Chapter 2 Exploring Variables, Data Types, Operators and Arrays 13
CONTENTS Chapter 1 Getting Started with Java SE 6 1 Introduction of Java SE 6... 3 Desktop Improvements... 3 Core Improvements... 4 Getting and Installing Java... 5 A Simple Java Program... 10 Compiling
More informationTeenCoder : Java Programming (ISBN )
TeenCoder : Java Programming (ISBN 978-0-9887070-2-3) and the AP * Computer Science A Exam Requirements (Alignment to Tennessee AP CS A course code 3635) Updated March, 2015 Contains the new 2014-2015+
More informationCS 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 informationJava for Programmers Course (equivalent to SL 275) 36 Contact Hours
Java for Programmers Course (equivalent to SL 275) 36 Contact Hours Course Overview This course teaches programmers the skills necessary to create Java programming system applications and satisfies the
More informationGive one example where you might wish to use a three dimensional array
CS 110: INTRODUCTION TO COMPUTER SCIENCE SAMPLE TEST 3 TIME ALLOWED: 60 MINUTES Student s Name: MAXIMUM MARK 100 NOTE: Unless otherwise stated, the questions are with reference to the Java Programming
More informationCOP 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 informationIndex COPYRIGHTED MATERIAL
Index COPYRIGHTED MATERIAL Note to the Reader: Throughout this index boldfaced page numbers indicate primary discussions of a topic. Italicized page numbers indicate illustrations. A abstract classes
More informationSystems Programming. Bachelor in Telecommunication Technology Engineering Bachelor in Communication System Engineering Carlos III University of Madrid
Systems Programming Bachelor in Telecommunication Technology Engineering Bachelor in Communication System Engineering Carlos III University of Madrid Leganés, 21st of March, 2014. Duration: 75 min. Full
More informationWe 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 informationGraphical User Interfaces in Java - SWING
Graphical User Interfaces in Java - SWING Graphical User Interfaces (GUI) Each graphical component that the user can see on the screen corresponds to an object of a class Component: Window Button Menu...
More informationSELF-STUDY. Glossary
SELF-STUDY 231 Glossary HTML (Hyper Text Markup Language - the language used to code web pages) tags used to embed an applet. abstract A class or method that is incompletely defined,
More informationF1 A Java program. Ch 1 in PPIJ. Introduction to the course. The computer and its workings The algorithm concept
F1 A Java program Ch 1 in PPIJ Introduction to the course The computer and its workings The algorithm concept The structure of a Java program Classes and methods Variables Program statements Comments Naming
More informationGoals. Lecture 7 More GUI programming. The application. The application D&D 12. CompSci 230: Semester JFrame subclass: ListOWords
Goals By the end of this lesson, you should: Lecture 7 More GUI programming 1. Be able to write Java s with JTextField, JList, JCheckBox and JRadioButton components 2. Be able to implement a ButtonGroup
More informationData Structures (list, dictionary, tuples, sets, strings)
Data Structures (list, dictionary, tuples, sets, strings) Lists are enclosed in brackets: l = [1, 2, "a"] (access by index, is mutable sequence) Tuples are enclosed in parentheses: t = (1, 2, "a") (access
More informationJava 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 informationJava Fundamentals p. 1 The Origins of Java p. 2 How Java Relates to C and C++ p. 3 How Java Relates to C# p. 4 Java's Contribution to the Internet p.
Preface p. xix Java Fundamentals p. 1 The Origins of Java p. 2 How Java Relates to C and C++ p. 3 How Java Relates to C# p. 4 Java's Contribution to the Internet p. 5 Java Applets and Applications p. 5
More informationJava Just in Time: Collected concepts after chapter 22
Java Just in Time: Collected concepts after chapter 22 John Latham, School of Computer Science, Manchester University, UK. April 15, 2011 Contents 1 Computer basics 22000 1.1 Computer basics: hardware
More informationJava Object Oriented Design. CSC207 Fall 2014
Java Object Oriented Design CSC207 Fall 2014 Design Problem Design an application where the user can draw different shapes Lines Circles Rectangles Just high level design, don t write any detailed code
More informationCS 112 Programming 2. Lecture 10. Abstract Classes & Interfaces (1) Chapter 13 Abstract Classes and Interfaces
CS 112 Programming 2 Lecture 10 Abstract Classes & Interfaces (1) Chapter 13 Abstract Classes and Interfaces 2 1 Motivations We have learned how to write simple programs to create and display GUI components.
More informationCS 349 Midterm Exam Spring 2014
Course Title: User Interfaces Sections: All Instructor: Byron Weber Becker Exam Date: 19-June-2014 Time: 7:00-9:00p.m. Duration: 2 hours Pages: 10 CS 349 Midterm Exam Exam Type: Closed Book Permitted Aids:
More informationVALLIAMMAI ENGINEERING COLLEGE
VALLIAMMAI ENGINEERING COLLEGE SRM Nagar, Kattankulathur 60 0 DEPARTMENT OF INFORMATION TECHNOLOGY QUESTION BANK III SEMESTER CS89- Object Oriented Programming Regulation 07 Academic Year 08 9 Prepared
More informationStarting Out with Java: From Control Structures Through Objects Sixth Edition
Starting Out with Java: From Control Structures Through Objects Sixth Edition Chapter 12 A First Look at GUI Applications Chapter Topics 12.1 Introduction 12.2 Creating Windows 12.3 Equipping GUI Classes
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 information17 GUI API: Container 18 Hello world with a GUI 19 GUI API: JLabel 20 GUI API: Container: add() 21 Hello world with a GUI 22 GUI API: JFrame: setdefau
List of Slides 1 Title 2 Chapter 13: Graphical user interfaces 3 Chapter aims 4 Section 2: Example:Hello world with a GUI 5 Aim 6 Hello world with a GUI 7 Hello world with a GUI 8 Package: java.awt and
More informationIntroduction to Computing II (ITI 1121) Final Examination
Université d Ottawa Faculté de génie École de science informatique et de génie électrique University of Ottawa Faculty of Engineering School of Electrical Engineering and Computer Science Introduction
More informationB2.52-R3: INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING THROUGH JAVA
B2.52-R3: INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING THROUGH JAVA NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. 2. PART ONE
More informationObject Oriented Programming: In this course we began an introduction to programming from an object-oriented approach.
CMSC 131: Chapter 28 Final Review: What you learned this semester The Big Picture Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach. Java
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 informationIntroduction 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 informationTopic 9: Swing. Swing is a BIG library Goal: cover basics give you concepts & tools for learning more
Swing = Java's GUI library Topic 9: Swing Swing is a BIG library Goal: cover basics give you concepts & tools for learning more Assignment 5: Will be an open-ended Swing project. "Programming Contest"
More informationTopic 9: Swing. Why are we studying Swing? GUIs Up to now: line-by-line programs: computer displays text user types text. Outline. 1. Useful & fun!
Swing = Java's GUI library Topic 9: Swing Swing is a BIG library Goal: cover basics give you concepts & tools for learning more Why are we studying Swing? 1. Useful & fun! 2. Good application of OOP techniques
More informationOutline. Topic 9: Swing. GUIs Up to now: line-by-line programs: computer displays text user types text AWT. A. Basics
Topic 9: Swing Outline Swing = Java's GUI library Swing is a BIG library Goal: cover basics give you concepts & tools for learning more Assignment 7: Expand moving shapes from Assignment 4 into game. "Programming
More informationChapter 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 informationQueen 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 informationC ONTENTS PART I FUNDAMENTALS OF PROGRAMMING 1. and Java 3. Chapter 1 Introduction to Computers, Programs,
C ONTENTS PART I FUNDAMENTALS OF PROGRAMMING 1 Chapter 1 Introduction to Computers, Programs, and Java 3 1.1 Introduction 4 1.2 What Is acomputer? 4 1.3 Programs 7 1.4 Operating Systems 9 1.5 Number Systems
More informationIntroduction to the JAVA UI classes Advanced HCI IAT351
Introduction to the JAVA UI classes Advanced HCI IAT351 Week 3 Lecture 1 17.09.2012 Lyn Bartram lyn@sfu.ca About JFC and Swing JFC Java TM Foundation Classes Encompass a group of features for constructing
More informationThe Object Class. java.lang.object. Important Methods In Object. Mark Allen Weiss Copyright 2000
The Object Class Mark Allen Weiss Copyright 2000 1/4/02 1 java.lang.object All classes either extend Object directly or indirectly. Makes it easier to write generic algorithms and data structures Makes
More informationCONTENTS. PART 1 Structured Programming 1. 1 Getting started 3. 2 Basic programming elements 17
List of Programs xxv List of Figures xxix List of Tables xxxiii Preface to second version xxxv PART 1 Structured Programming 1 1 Getting started 3 1.1 Programming 3 1.2 Editing source code 5 Source code
More informationCSCI-142 Exam 1 Review September 25, 2016 Presented by the RIT Computer Science Community
CSCI-12 Exam 1 Review September 25, 2016 Presented by the RIT Computer Science Community http://csc.cs.rit.edu 1. Provide a detailed explanation of what the following code does: 1 public boolean checkstring
More informationPolymorphism. return a.doublevalue() + b.doublevalue();
Outline Class hierarchy and inheritance Method overriding or overloading, polymorphism Abstract classes Casting and instanceof/getclass Class Object Exception class hierarchy Some Reminders Interfaces
More informationCompuScholar, Inc. 9th - 12th grades
CompuScholar, Inc. Alignment to the College Board AP Computer Science A Standards 9th - 12th grades AP Course Details: Course Title: Grade Level: Standards Link: AP Computer Science A 9th - 12th grades
More informationVirtualians.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 informationNews and info. Array. Feedback. Lab 4 is due this week. It should be easy to change the size of the game grid.
Calculation Applet! Arrays! Sorting! Java Examples! D0010E! Lecture 11! The GUI Containment Hierarchy! Mergesort! News and info Lab 4 is due this week. It should be easy to change the size of the game
More informationThis 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