Sample Midterm CS INSTRUCTIONS: The real exam will be closed books and closed notes. public void foo() throws Up, Fit {... }
|
|
- Caroline Barber
- 7 years ago
- Views:
Transcription
1 Sample Midterm CS 3230 Name: INSTRUCTIONS: The real exam will be closed books and closed notes. 1. Complete the method definition by filling in the blank: public void foo() throws Up, Fit... public void callsfoo() try foo(); catch (Up u) catch (Fit f) throws f; ans: throws Fit General: Method foo can potentially throw two exceptions: Up and Fit. Both of these are caught but Fit is rethrown in the second catch-block and so must be announced. 2. A Java program contains the following method: int square(int s) s = s * s; return s; What does the following code print out? int length = 5; int area = square(length); System.out.println(length + " " + area); ans: 5 25 General: Java passes all method parameters by value: each method has a local copy of parameter. 1
2 3. What happens here (assume all necessary constructors and note that the line numbers are not part of the code)? 1. public class Fraction private int num; 4. private int denom; public Fraction mult(fraction f) return new Fraction(num * f.num, denom * f.denom); Foo f1 = new fraction(); 12. Foo f2 = new fraction(); 13. f1.bar(f2); a. Compiler error on line 8; one object may not access the private features of another object b. Compiler error on line 13; one object may not access the private features of another object c. Compiles but generates a runtime error on line 8 d. Compiles but generates a runtime error on line 13 e. Compiles and runs without error ans: e General: Access control modifiers (e.g., public, private, and protected) are defined at the class level not at the object level. This implies that private does not prevent one instance of a class from accessing the instance variables of another instance of the same class. 4. Upon which class relationship does object casting rely? a. Association b. Aggregation c. Composition d. Inheritance e. Dependency ans: d General: Objects may only be converted or cast if the original and destination classes are related by inheritance (aka generalization). An up-cast is one of three things necessary for polymorphism; the other two are method overriding and inheritance itself. 2
3 5. A program contains the following definitions and statements: public class Employee private String name; public Employee(String name) this.name = name; public String tostring() return name; public static void change(employee temp) temp.name = "Wally"; Employee e = new Employee("Dilbert"); Employee.change(e); System.out.println(e); What is printed? a. Wally b. Dilbert c. The statement temp.name = "Wally"; will not compile d. The statement System.out.println(e); will not compile ans: a temp points to the same object as does e (it becomes an alias for the object). When the object is modified through temp, it modifies the original object. 3
4 6. A program contains the following definitions and statements: public class Employee private String name; public Employee(String name) this.name = name; public String tostring() return name; public static void change(employee temp) temp = new Employee("Wally"); Employee e = new Employee("Dilbert"); Employee.change(e); System.out.println(e); What is printed? a. Wally b. Dilbert c. The statement temp = new Employee("Wally"); will not compile d. The statement System.out.println(e); will not compile ans: b temp initially points to the same object as e, but the statement temp = new Employee("Wally"); causes temp to point to a new object. e is not changed and continues to point to the original object. 4
5 7. Examine the following two Java classes, the method definition, and the method call: public class Foo... public class Bar extends Foo... mymethod(foo f)... mymethod(new Bar()); Choose the statement below that is the most accurate and the most complete: a. mymethod(new Bar()); will not compile nor will it run. b. mymethod(new Bar()); will compile but it will not run. c. mymethod(new Bar()); causes an object up-cast. d. mymethod(new Bar()); causes an object down-cast. ans: c General: This is the most common syntax resulting in an object up-cast. 8. What gets printed out by the Java code listed below the classes (i.e., below the line; note that the line numbers are not part of the code)? class Animal public String whoareyou() return an Animal ; class Insect extends Animal public String whoareyou() return an Insect ; class Spider extends Insect public String whoareyou() return a Spider ; Animal a0 = new Insect(); 2. Insect i = new Spider(); 3. Animal a1 = new Spider(); 4. System.out.println(a0.whoAreYou()); 5. System.out.println(i.whoAreYou()); 6. System.out.println(a1.whoAreYou()); a. an Animal, an Insect, a Spider b. an Insect, a Spider, a Spider c. Compile error on line 4. d. Compile error on line 5. e. Compile error on line 6. f. Runtime error on line 4. g. Runtime error on line 5. h. Runtime error on line 6. 5
6 ans: b General: Java methods are polymorphic by default. The object (on the right of the assignment operator) and not the reference variable (on the left of the assignment operator) determines which method is ultimately called. 9. Examine the classes and the object instantiation below. ans: a,b public class Alpha public int counter; public class Beta extends Alpha public int total; public class Gamma extends Beta public int max; Beta mybeta = new Gamma(); Which of the following statements are valid? Check all that represent a valid instance variable access (note that all instance variables are public): a. mybeta.counter = 0; b. mybeta.total = 100; c. mybeta.max = 200; General: Although mybeta refers to a Gamma object (which does have a max instance variable), mybeta is of type Beta (which does not have a max instance variable). mybeta may access public or protected instance variables that are defined in the classes that are above it in the inheritance hierarchy but not in those classes below it. 6
7 10. An abstract class may have final methods. Choose the most accurate, relevant, and complete response to this assertion. a. The statement is correct; an abstract class may have concrete methods, which may be final, and which are inheritable. b. The statement is correct; an abstract class may have concrete methods because the final keyword takes precedence over the abstract keyword. c. The statement is INcorrect; abstract classes may not have final methods because final methods may not be overridden. d. The statement is INcorrect; abstract classes may not have final methods because abstract classes may not be instantiated. e. The statement is INcorrect; abstract classes may not have final methods because its methods must be overridden in a subclass. f. The statement is INcorrect; abstract classes may not have final methods because the abstract and final keywords are incompatible. ans: a General: All methods in a final class are final, but an abstract class may contain concrete methods. So what about a final class with abstract methods? Incorrect: The correct answer is (a). b: There are no precedence rules for keywords. c: Final methods may not be overridden, but an abstract class may also have concrete methods, which do not need to be overridden. d: Abstract classes cannot be instantiated but their concrete subclasses may be. e: Only the abstract methods must be overridden in the subclasses; concrete methods do not need to be overridden. f. Abstract and final may not describe the same feature or class; however, in this problem abstract describes a class and final describes one or concrete methods within the class. 7
8 11. Examine the following class definitions: class Insect public void sting(int howhard)... class Spider extends Insect public int sting(int howhard)... Method sting is a. a correctly overridden method b. a correctly overloaded method c. an erroneously overridden method d. an erroneously overloaded method ans: c General: Overloading takes place within a single class where two or more methods have the same name. This is an example of overriding: two classes related by inheritance define methods with the same name. Overloaded methods may have different return types but overridden methods must have the same return type. 12. What is the relationship between class A and class F illustrated by the UML class diagram? a. Inheritance b. Association c. Aggregation d. Composition e. Dependency ans: d General: This is basically a memorization problem, but do notice some of the similarities and differences. Inheritance and aggregation are both hollow symbols. Aggregation and composition are both four-sided diamonds. The similarity in the shape of the aggregation and composition symbols suggests that the relations are similar. The association symbol is the only one that is not decorated at one end (both ends are the same) and is the only relation that is bidirectional. 8
9 13. Identify the class relationships illustrated by the following code fragment. class Foo class Bar final Foo f; a. Inheritance b. Association c. Aggregation d. Composition e. Dependency ans: c;d General: In C++ it is possible to distinguish between aggregation and composition. Aggregation is implemented with pointers and composition is implemented with embedded objects (created by static instantiation). In Java, all objects are manipulated by references: there are no static objects. In some cases a Java program can mark the distinction by using the final keyword for an composition. In general, however, the distinction between aggregation and composition in a Java program exists only in the intension of the class designer. The other four relationships are not so ambiguous. 14. Class Bar overrides the Object equals method to test two Bar objects for equality. Choose the correct signature for the Bar equals method. a. public boolean equals(bar other) b. public boolean equals(object other) c. public boolean equals(object other1, Object other2) d. public boolean equals(bar other1, Bar other2) ans: b General: To make a correct override, the overriding method defined in the sub-class must have the same signature (method name, return type, and argument list - number of arguments and corresponding data types) as the overridden method in the super class. Furthermore, the access specifier (i.e., public, protected, private, or default/friendly - no specifier) may not be more restrictive than the method in the super class (though it can be same or less restrictive). The signature of the Object equals method is public boolean equals(object other). 9
10 15. A programmer wishes to use the Collections.sort method to sort the elements of a list. Each element of the list has both a name (implemented as a String) and an ID number (implemented as an int). In some cases the sort will be by name and in other cases by ID. Which library mechanism should the programmer choose? a. Comparable b. Comparator ans: b See the feedback for the following question. 16. A programmer wishes to use the sort(object[] a) method defined in the Arrays class to sort an array of Foo objects. Choose the best definition for class Foo: a. public class Foo implements Comparator<Foo>... b. public class Foo implements Comparable<Foo>... c. public class Foo extends Comparator<Foo>... d. public class Foo extends Comparable<Foo>... e. public class Foo extends Sortable<Foo>... f. public class Foo... ans: b General: Comparator and Comparable are interfaces that must be implemented, not extended. A class that implements the Comparable interface must define the compareto method, which the Arrays sort method uses to order two objects as a part of the sorting operation. The Comparator interface is used when creating a helper class. An instances of the helper is passed as the second parameter to an overloaded version of the sort method. The first technique is less complex but also less flexible: Use Comparable when you need to sort by one instance variable and use Comparator when you need to do multiple sorts based on two or more instance variables. 17. Given that polymorphism allows a programmer to easily call the methods of a subclass that has been upcast, why is it necessary, as a part of overriding the equals method, to down cast the argument? Choose the most correct and the most complete answer: a. Polymorphism applies only to methods and not to data. b. The statement is incorrect: a down-cast is not necessary. c. The down-cast is necessary to insure that both objects are instances of the same class. d. The down-cast is necessary to insure that one object is not null. ans: a 10
11 (Goes with the question below) The following two classes are defined in a Java program: public class Employee private String name; private float salary; public Employee(String name, float salary) this.name = name; this.salary = salary; public float calcpay() return salary / 24; // Employee public class Sales extends Employee private float commission; private float totalsales; public Sales(String name) ; public Sales (String name, float salary, float commission, float totalsales) ; public float calcpay() return ; // Sales 18. Choose the best sequence of statements to complete the second Sales constructor? a. super(name, salary); commission = commission; this.commission = commission; this.totalsales = totalsales; b. commission = commission; this.commission = commission; this.totalsales = totalsales; super(name, salary); c. super.name = name; super.salary = salary; this.commission = commission; this.totalsales = totalsales; d. this.name = name; this.salary = salary; this.commission = commission; this.totalsales = totalsales; e. The argument names must be changed so that they are not the same as the instance variable names before the program will compile. 11
12 ans: a General: name and salary are private instance variables of class Employee so they may not be accessed directly (this rules out c. and d.). The this keyword operates within a class and does not access the super class (this also rules out d.). name and salary must be initialized by the Employee constructor, which is called as super(name, salary) in Sales, but this call must be the first statement in the Employee constructor (this rules out b.). By using the this keyword, instance and local variables may have the same name (this rules out e.). 19. (Note: this is a very difficult question; if used on the midterm, it will be simplified.) Examine the two classes and the object instantiation below. abstract public class Stuff abstract public void firstmethod(); public void secondmethod()... public void thirdmethod()... public class MoreStuff extends Stuff public void firstmethod()... Public void secondmethod()... Public void lastmethod() Stuff more = new MoreStuff(); Check all valid method calls: a. more.firstmethod(); b. more.secondmethod(); c. more.thirdmethod(); d. more.lastmethod(); ans: a,b,c General: The compiler locates instance variables and method names in the symbol table based on the type of the reference variable (i.e., Stuff more); it locates method bodies (i.e., instructions) based on the type of the instantiated object (i.e., new MoreStuff). a. class Stuff defines an abstract method named firstmethod and although it does not have a body, its name is in the Stuff symbol table and polymorphism locates the overridden body defined in class MoreStuff. b. class Stuff defines a method named secondmethod and polymorphism locates the overridden body defined in class MoreStuff. c. MoreStuff inherits method thirdmethod from Stuff, which is called here. d. Stuff does not have a method named lastmethod, which is required for polymorphism - this statement will not compile let alone run. 12
13 20. Given the following method definition: public void foo(void) throws Bar... If class Bar extends class RuntimeException, must a method calling foo either catch or claim (with the throws keyword) exception Bar? a. Yes b. No ans: b General: Exceptions that extend class Exception or a subclasses of Exception are checked (i.e., they must be caught or claimed with the throws keyword. RuntimeException, a subclass of Exception, is (sorry) an exception: RuntimeException and its subclasses are not checked and so it is not necessary to catch or claim them. Class Error is also an exception (in both senses used here) and although it is not a subclass of RuntimeException, it is also not checked. 21. Consider the following fragments of code and choose the most accurate, relevant, and complete description. (Note that the line numbers are not a part of the code.) 1. public class Foo implements ActionListener, MouseListener public class Bar 4. private Foo f = new Foo(); 5. private JButton button = new JButton( Open ); 6. private JPanel panel = new JPanel(); button.addactionlistener(f); 9. panel.addmouselistener(f); 10. a. There will be a compile error on line 9 because panels may not be a mouse event source. b. There will be a compile error on line 9 as the Foo object f is already listening to button. c. The code will compile and run but the Foo object f will only respond to panel because it registered last and overwrote button. d. It will compile and run without error because is it possible for Foo object f to be a listener to both the button and the panel at the same time. ans: d General: In general, a listener object can listen to multiple event sources and a single event source can send its event to multiple listeners (i.e., the connection between event sources and 13
14 listeners can be a many-to-many relation). 22. layout managers place components in one of five predefined locations. a. BoarderLayout b. FlowLayout c. GridLayout d. GridBagLayout ans: a General: Different layout managers organize the components they contain in different ways. The BorderLayout organizes them into four narrow border areas around the edges of a frame and into one (generally) larger central area. It s important to know how the four basic AWT managers organize components. 23. layout managers never honor any component s preferred size (i.e., all of the components are stretched to fit the layout manager). a. BoarderLayout b. FlowLayout c. GridLayout d. GridBagLayout ans: c General: The tallest component in the layout manager determines the row height and the widest component determines the column width - all components are stretched to this size. The FlowLayout honors all preferred sizes (i.e., it doesn t stretch any component). BorderLayout honors the preferred height (but stretches the width) of components in the north and south; honors the preferred width (but stretches the height) of components in the east and west; it stretches both the height and width of components in the center. GridBagLayout managers can be configured to honor both height and width, height only, width only, or neither. 24. What is the default layout manager for a JFrame? For a JDialog? For a JApplet? a. FlowLayout, FlowLayout, and BorderLayout b. BorderLayout, BorderLayout, and FlowLayout c. BorderLayout, BorderLayout, and BorderLayout d. FlowLayout, FlowLayout, and FlowLayout ans: c General: The default layout managers of four containers are important: JFrame, JDialog, JApplet, and JPanel. All except JPanel have a BorderLayout by default; a JPanel has a FlowLayout manager by default. 14
15 25. Describe how to draw a blank Mah Jong tile. Focus on the drawing methods (syntax in not important) and on how the coordinates are identified. What object supports gradient painting and how do you get the object? 26. Describe very generally how to center a picture on the Mah Jong picture tile. 15
Fundamentals of Java Programming
Fundamentals of Java Programming This document is exclusive property of Cisco Systems, Inc. Permission is granted to print and copy this document for non-commercial distribution and exclusive use by instructors
More informationGUIs with Swing. Principles of Software Construction: Objects, Design, and Concurrency. Jonathan Aldrich and Charlie Garrod Fall 2012
GUIs with Swing Principles of Software Construction: Objects, Design, and Concurrency Jonathan Aldrich and Charlie Garrod Fall 2012 Slides copyright 2012 by Jeffrey Eppinger, Jonathan Aldrich, William
More informationCS 111 Classes I 1. Software Organization View to this point:
CS 111 Classes I 1 Software Organization View to this point: Data Objects and primitive types Primitive types operators (+, /,,*, %). int, float, double, char, boolean Memory location holds the data Objects
More informationJava Interview Questions and Answers
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 and compile the java
More informationwww.virtualians.pk CS506 Web Design and Development Solved Online Quiz No. 01 www.virtualians.pk
CS506 Web Design and Development Solved Online Quiz No. 01 Which of the following is a general purpose container? JFrame Dialog JPanel JApplet Which of the following package needs to be import while handling
More informationJava Application Developer Certificate Program Competencies
Java Application Developer Certificate Program Competencies After completing the following units, you will be able to: Basic Programming Logic Explain the steps involved in the program development cycle
More informationINTRODUCTION TO COMPUTER PROGRAMMING. Richard Pierse. Class 7: Object-Oriented Programming. Introduction
INTRODUCTION TO COMPUTER PROGRAMMING Richard Pierse Class 7: Object-Oriented Programming Introduction One of the key issues in programming is the reusability of code. Suppose that you have written a program
More informationSyllabus for CS 134 Java Programming
- Java Programming Syllabus Page 1 Syllabus for CS 134 Java Programming Computer Science Course Catalog 2000-2001: This course is an introduction to objectoriented programming using the Java language.
More informationAP Computer Science Java Subset
APPENDIX A AP Computer Science Java Subset The AP Java subset is intended to outline the features of Java that may appear on the AP Computer Science A Exam. The AP Java subset is NOT intended as an overall
More informationThe Abstract Windowing Toolkit. Java Foundation Classes. Swing. In April 1997, JavaSoft announced the Java Foundation Classes (JFC).
The Abstract Windowing Toolkit Since Java was first released, its user interface facilities have been a significant weakness The Abstract Windowing Toolkit (AWT) was part of the JDK form the beginning,
More informationComputing Concepts with Java Essentials
2008 AGI-Information Management Consultants May be used for personal purporses only or by libraries associated to dandelon.com network. Computing Concepts with Java Essentials 3rd Edition Cay Horstmann
More informationHistory OOP languages Year Language 1967 Simula-67 1983 Smalltalk
History OOP languages Intro 1 Year Language reported dates vary for some languages... design Vs delievered 1957 Fortran High level programming language 1958 Lisp 1959 Cobol 1960 Algol Structured Programming
More informationJava (12 Weeks) Introduction to Java Programming Language
Java (12 Weeks) Topic Lecture No. Introduction to Java Programming Language 1 An Introduction to Java o Java as a Programming Platform, The Java "White Paper" Buzzwords, Java and the Internet, A Short
More informationJava Programming Language
Lecture 1 Part II Java Programming Language Additional Features and Constructs Topics in Quantitative Finance: Numerical Solutions of Partial Differential Equations Instructor: Iraj Kani Subclasses and
More informationCohort: BCA/07B/PT - BCA/06/PT - BCNS/06/FT - BCNS/05/FT - BIS/06/FT - BIS/05/FT - BSE/05/FT - BSE/04/PT-BSE/06/FT
BSc (Hons) in Computer Applications, BSc (Hons) Computer Science with Network Security, BSc (Hons) Business Information Systems & BSc (Hons) Software Engineering Cohort: BCA/07B/PT - BCA/06/PT - BCNS/06/FT
More informationYosemite National Park, California. CSE 114 Computer Science I Inheritance
Yosemite National Park, California CSE 114 Computer Science I Inheritance Containment A class contains another class if it instantiates an object of that class HAS-A also called aggregation PairOfDice
More informationThe Sun Certified Associate for the Java Platform, Standard Edition, Exam Version 1.0
The following applies to all exams: Once exam vouchers are purchased you have up to one year from the date of purchase to use it. Each voucher is valid for one exam and may only be used at an Authorized
More informationMouse Event Handling (cont.)
GUI Components: Part II Mouse Event Handling (cont.) Each mouse event-handling method receives a MouseEvent object that contains information about the mouse event that occurred, including the x- and y-coordinates
More informationAgenda. What is and Why Polymorphism? Examples of Polymorphism in Java programs 3 forms of Polymorphism
Polymorphism 1 Agenda What is and Why Polymorphism? Examples of Polymorphism in Java programs 3 forms of Polymorphism 2 What is & Why Polymorphism? 3 What is Polymorphism? Generally, polymorphism refers
More informationDuring the process of creating ColorSwitch, you will learn how to do these tasks:
GUI Building in NetBeans IDE 3.6 This short tutorial guides you through the process of creating an application called ColorSwitch. You will build a simple program that enables you to switch the color of
More informationObject-Oriented Design Lecture 4 CSU 370 Fall 2007 (Pucella) Tuesday, Sep 18, 2007
Object-Oriented Design Lecture 4 CSU 370 Fall 2007 (Pucella) Tuesday, Sep 18, 2007 The Java Type System By now, you have seen a fair amount of Java. Time to study in more depth the foundations of the language,
More informationDesigning with Exceptions. CSE219, Computer Science III Stony Brook University http://www.cs.stonybrook.edu/~cse219
Designing with Exceptions CSE219, Computer Science III Stony Brook University http://www.cs.stonybrook.edu/~cse219 Testing vs. Debugging Testing Coding Does the code work properly YES NO 2 Debugging Testing
More informationHow To Write A Program For The Web In Java (Java)
21 Applets and Web Programming As noted in Chapter 2, although Java is a general purpose programming language that can be used to create almost any type of computer program, much of the excitement surrounding
More informationInheritance, overloading and overriding
Inheritance, overloading and overriding Recall with inheritance the behavior and data associated with the child classes are always an extension of the behavior and data associated with the parent class
More informationJava SE 8 Programming
Oracle University Contact Us: 1.800.529.0165 Java SE 8 Programming Duration: 5 Days What you will learn This Java SE 8 Programming training covers the core language features and Application Programming
More informationCSCI 253. Object Oriented Programming (OOP) Overview. George Blankenship 1. Object Oriented Design: Java Review OOP George Blankenship.
CSCI 253 Object Oriented Design: Java Review OOP George Blankenship George Blankenship 1 Object Oriented Programming (OOP) OO Principles Abstraction Encapsulation Abstract Data Type (ADT) Implementation
More informationProgramming with Java GUI components
Programming with Java GUI components Java includes libraries to provide multi-platform support for Graphic User Interface objects. The multi-platform aspect of this is that you can write a program on a
More informationChapter 13 - Inheritance
Goals Chapter 13 - Inheritance To learn about inheritance To understand how to inherit and override superclass methods To be able to invoke superclass constructors To learn about protected and package
More informationJava 6 'th. Concepts INTERNATIONAL STUDENT VERSION. edition
Java 6 'th edition Concepts INTERNATIONAL STUDENT VERSION CONTENTS PREFACE vii SPECIAL FEATURES xxviii chapter i INTRODUCTION 1 1.1 What Is Programming? 2 J.2 The Anatomy of a Computer 3 1.3 Translating
More informationMasters programmes in Computer Science and Information Systems. Object-Oriented Design and Programming. Sample module entry test xxth December 2013
Masters programmes in Computer Science and Information Systems Object-Oriented Design and Programming Sample module entry test xxth December 2013 This sample paper has more questions than the real paper
More informationPreet raj Core Java and Databases CS4PR. Time Allotted: 3 Hours. Final Exam: Total Possible Points 75
Preet raj Core Java and Databases CS4PR Time Allotted: 3 Hours Final Exam: Total Possible Points 75 Q1. What is difference between overloading and overriding? 10 points a) In overloading, there is a relationship
More informationThe Java Series. Java Essentials I What is Java? Basic Language Constructs. Java Essentials I. What is Java?. Basic Language Constructs Slide 1
The Java Series Java Essentials I What is Java? Basic Language Constructs Slide 1 What is Java? A general purpose Object Oriented programming language. Created by Sun Microsystems. It s a general purpose
More informationPART-A Questions. 2. How does an enumerated statement differ from a typedef statement?
1. Distinguish & and && operators. PART-A Questions 2. How does an enumerated statement differ from a typedef statement? 3. What are the various members of a class? 4. Who can access the protected members
More informationMultichoice Quetions 1. Atributes a. are listed in the second part of the class box b. its time is preceded by a colon. c. its default value is
Multichoice Quetions 1. Atributes a. are listed in the second part of the class box b. its time is preceded by a colon. c. its default value is preceded by an equal sign d. its name has undereline 2. Associations
More informationLAYOUT MANAGERS. Layout Managers Page 1. java.lang.object. java.awt.component. java.awt.container. java.awt.window. java.awt.panel
LAYOUT MANAGERS A layout manager controls how GUI components are organized within a GUI container. Each Swing container (e.g. JFrame, JDialog, JApplet and JPanel) is a subclass of java.awt.container and
More informationMoving from CS 61A Scheme to CS 61B Java
Moving from CS 61A Scheme to CS 61B Java Introduction Java is an object-oriented language. This document describes some of the differences between object-oriented programming in Scheme (which we hope you
More informationcore. Volume I - Fundamentals Seventh Edition Sun Microsystems Press A Prentice Hall Title ULB Darmstadt
core. 2008 AGI-Information Management Consultants May be used for personal purporses only or by libraries associated to dandelon.com network. Volume I - Fundamentals Seventh Edition CAY S. HORSTMANN GARY
More informationException Handling. Overloaded methods Interfaces Inheritance hierarchies Constructors. OOP: Exception Handling 1
Exception Handling Error handling in general Java's exception handling mechanism The catch-or-specify priciple Checked and unchecked exceptions Exceptions impact/usage Overloaded methods Interfaces Inheritance
More informationClasses and Objects in Java Constructors. In creating objects of the type Fraction, we have used statements similar to the following:
In creating objects of the type, we have used statements similar to the following: f = new (); The parentheses in the expression () makes it look like a method, yet we never created such a method in our
More informationGUI Components: Part 2
GUI Components: Part 2 JComboBox and Using an Anonymous Inner Class for Event Handling A combo box (or drop-down list) enables the user to select one item from a list. Combo boxes are implemented with
More informationSpecialized Programme on Web Application Development using Open Source Tools
Specialized Programme on Web Application Development using Open Source Tools Objective: At the end of the course, Students will be able to: Understand various open source tools(programming tools and databases)
More informationDescription of Class Mutation Mutation Operators for Java
Description of Class Mutation Mutation Operators for Java Yu-Seung Ma Electronics and Telecommunications Research Institute, Korea ysma@etri.re.kr Jeff Offutt Software Engineering George Mason University
More informationPrinciples of Software Construction: Objects, Design and Concurrency. GUIs with Swing. toad 15-214. Spring 2013
Principles of Software Construction: Objects, Design and Concurrency GUIs with Swing 15-214 toad Spring 2013 Christian Kästner Charlie Garrod School of Computer Science 2012-13 C Garrod, C Kästner, J Aldrich,
More informationChapter 1 Java Program Design and Development
presentation slides for JAVA, JAVA, JAVA Object-Oriented Problem Solving Third Edition Ralph Morelli Ralph Walde Trinity College Hartford, CT published by Prentice Hall Java, Java, Java Object Oriented
More informationC++FA 5.1 PRACTICE MID-TERM EXAM
C++FA 5.1 PRACTICE MID-TERM EXAM This practicemid-term exam covers sections C++FA 1.1 through C++FA 1.4 of C++ with Financial Applications by Ben Van Vliet, available at www.benvanvliet.net. 1.) A pointer
More informationProgrammation 2. Introduction à la programmation Java
Programmation 2 Introduction à la programmation Java 1 Course information CM: 6 x 2 hours TP: 6 x 2 hours CM: Alexandru Costan alexandru.costan at inria.fr TP: Vincent Laporte vincent.laporte at irisa.fr
More informationSpecialized Programme on Web Application Development using Open Source Tools
Specialized Programme on Web Application Development using Open Source Tools A. NAME OF INSTITUTE Centre For Development of Advanced Computing B. NAME/TITLE OF THE COURSE C. COURSE DATES WITH DURATION
More informationLaboratory Assignments of OBJECT ORIENTED METHODOLOGY & PROGRAMMING (USING C++) [IT 553]
Laboratory Assignments of OBJECT ORIENTED METHODOLOGY & PROGRAMMING (USING C++) [IT 553] Books: Text Book: 1. Bjarne Stroustrup, The C++ Programming Language, Addison Wesley 2. Robert Lafore, Object-Oriented
More information15-214: Principles of Software Construction 8 th March 2012
15-214 Midterm Exam Andrew ID: SOLUTIONS 1 / 13 15-214: Principles of Software Construction 8 th March 2012 Name: SOLUTIONS Recitation Section (or Time): Instructions: Make sure that your exam is not missing
More informationJAVA INTERVIEW QUESTIONS
JAVA INTERVIEW QUESTIONS http://www.tutorialspoint.com/java/java_interview_questions.htm Copyright tutorialspoint.com Dear readers, these Java Interview Questions have been designed especially to get you
More informationICOM 4015: Advanced Programming
ICOM 4015: Advanced Programming Lecture 10 Reading: Chapter Ten: Inheritance Copyright 2009 by John Wiley & Sons. All rights reserved. Chapter 10 Inheritance Chapter Goals To learn about inheritance To
More informationAdvanced Data Structures
C++ Advanced Data Structures Chapter 8: Advanced C++ Topics Zhijiang Dong Dept. of Computer Science Middle Tennessee State University Chapter 8: Advanced C++ Topics C++ 1 C++ Syntax of 2 Chapter 8: Advanced
More informationPart I. Multiple Choice Questions (2 points each):
Part I. Multiple Choice Questions (2 points each): 1. Which of the following is NOT a key component of object oriented programming? (a) Inheritance (b) Encapsulation (c) Polymorphism (d) Parallelism ******
More informationBasic Programming and PC Skills: Basic Programming and PC Skills:
Texas University Interscholastic League Contest Event: Computer Science The contest challenges high school students to gain an understanding of the significance of computation as well as the details of
More informationObject-Oriented Programming in Java
Object-Oriented Programming in Java Quiz 1 Jan 10, 2001 Problem 1: Who wants to be a Java developer? (with apologies to Regis) Fill in your answer in the space provided. Question 1: Which is these word-pairs
More informationCS1002: COMPUTER SCIENCE OO MODELLING & DESIGN: WEEK 5
This Week CS1002: COMPUTER SCIENCE OO MODELLING & DESIGN: WEEK 5 School of Computer Science University of St Andrews Graham Kirby Alan Dearle More on Java classes Constructors Modifiers cdn.videogum.com/img/thumbnails/photos/commenter.jpg
More informationJava Interfaces. Recall: A List Interface. Another Java Interface Example. Interface Notes. Why an interface construct? Interfaces & Java Types
Interfaces & Java Types Lecture 10 CS211 Fall 2005 Java Interfaces So far, we have mostly talked about interfaces informally, in the English sense of the word An interface describes how a client interacts
More information3 Pillars of Object-oriented Programming. Industrial Programming Systems Programming & Scripting. Extending the Example.
Industrial Programming Systems Programming & Scripting Lecture 12: C# Revision 3 Pillars of Object-oriented Programming Encapsulation: each class should be selfcontained to localise changes. Realised through
More informationC++ INTERVIEW QUESTIONS
C++ INTERVIEW QUESTIONS http://www.tutorialspoint.com/cplusplus/cpp_interview_questions.htm Copyright tutorialspoint.com Dear readers, these C++ Interview Questions have been designed specially to get
More informationCourse Title: Software Development
Course Title: Software Development Unit: Customer Service Content Standard(s) and Depth of 1. Analyze customer software needs and system requirements to design an information technology-based project plan.
More informationCS193j, Stanford Handout #10 OOP 3
CS193j, Stanford Handout #10 Summer, 2003 Manu Kumar OOP 3 Abstract Superclass Factor Common Code Up Several related classes with overlapping code Factor common code up into a common superclass Examples
More informationJava CPD (I) Frans Coenen Department of Computer Science
Java CPD (I) Frans Coenen Department of Computer Science Content Session 1, 12:45-14:30 (First Java Programme, Inheritance, Arithmetic) Session 2, 14:45-16:45 (Input and Programme Constructs) Materials
More informationSemantic Analysis: Types and Type Checking
Semantic Analysis Semantic Analysis: Types and Type Checking CS 471 October 10, 2007 Source code Lexical Analysis tokens Syntactic Analysis AST Semantic Analysis AST Intermediate Code Gen lexical errors
More informationProgramming Methods & Java Examples
Programming Methods & Java Examples Dr Robert Harle, 2009 The following questions may be useful to work through for supervisions and/or revision. They are separated broadly by handout, but borders are
More informationInstall Java Development Kit (JDK) 1.8 http://www.oracle.com/technetwork/java/javase/downloads/index.html
CS 259: Data Structures with Java Hello World with the IntelliJ IDE Instructor: Joel Castellanos e-mail: joel.unm.edu Web: http://cs.unm.edu/~joel/ Office: Farris Engineering Center 319 8/19/2015 Install
More informationJIDE Action Framework Developer Guide
JIDE Action Framework Developer Guide Contents PURPOSE OF THIS DOCUMENT... 1 WHAT IS JIDE ACTION FRAMEWORK... 1 PACKAGES... 3 MIGRATING FROM EXISTING APPLICATIONS... 3 DOCKABLEBARMANAGER... 9 DOCKABLE
More informationJava GUI Programming. Building the GUI for the Microsoft Windows Calculator Lecture 2. Des Traynor 2005
Java GUI Programming Building the GUI for the Microsoft Windows Calculator Lecture 2 Des Traynor 2005 So, what are we up to Today, we are going to create the GUI for the calculator you all know and love.
More informationHandout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner.
Handout 1 CS603 Object-Oriented Programming Fall 15 Page 1 of 11 Handout 1 Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner. Java
More informationCIS 190: C/C++ Programming. Polymorphism
CIS 190: C/C++ Programming Polymorphism Outline Review of Inheritance Polymorphism Car Example Virtual Functions Virtual Function Types Virtual Table Pointers Virtual Constructors/Destructors Review of
More informationHabanero Extreme Scale Software Research Project
Habanero Extreme Scale Software Research Project Comp215: Java Method Dispatch Zoran Budimlić (Rice University) Always remember that you are absolutely unique. Just like everyone else. - Margaret Mead
More informationProgramming and Software Development (PSD)
Programming and Software Development (PSD) Course Descriptions Fundamentals of Information Systems Technology This course is a survey of computer technologies. This course may include computer history,
More informationMPLAB TM C30 Managed PSV Pointers. Beta support included with MPLAB C30 V3.00
MPLAB TM C30 Managed PSV Pointers Beta support included with MPLAB C30 V3.00 Contents 1 Overview 2 1.1 Why Beta?.............................. 2 1.2 Other Sources of Reference..................... 2 2
More informationTHE OPEN UNIVERSITY OF TANZANIA
THE OPEN UNIVERSITY OF TANZANIA FACULTY OF SCIENCE, TECHNOLOGY AND ENVIRONMENTAL STUDIES ODM 103: INTRODUCTION TO COMPUTER PROGRAMMING LANGUAGES Said Ally i ODM 103 INTRODUCTION TO COMPUTER PROGRAMMING
More informationD06 PROGRAMMING with JAVA
Cicles Formatius de Grau Superior Desenvolupament d Aplicacions Informàtiques D06 PROGRAMMING with JAVA Ch13 Inheritance PowerPoint presentation, created by Angel A. Juan - ajuanp(@)gmail.com, for accompanying
More informationCS-XXX: Graduate Programming Languages. Lecture 25 Multiple Inheritance and Interfaces. Dan Grossman 2012
CS-XXX: Graduate Programming Languages Lecture 25 Multiple Inheritance and Interfaces Dan Grossman 2012 Multiple Inheritance Why not allow class C extends C1,C2,...{...} (and C C1 and C C2)? What everyone
More informationThe C Programming Language course syllabus associate level
TECHNOLOGIES The C Programming Language course syllabus associate level Course description The course fully covers the basics of programming in the C programming language and demonstrates fundamental programming
More informationJiST Graphical User Interface Event Viewer. Mark Fong mjf21@cornell.edu
JiST Graphical User Interface Event Viewer Mark Fong mjf21@cornell.edu Table of Contents JiST Graphical User Interface Event Viewer...1 Table of Contents...2 Introduction...3 What it does...3 Design...3
More informationConstruction of classes with classes
(November 13, 2014 Class hierarchies 1 ) Construction of classes with classes Classes can be built on existing classes through attributes of object types. Example: I A class PairOfDice can be constructed
More informationlanguage 1 (source) compiler language 2 (target) Figure 1: Compiling a program
CS 2112 Lecture 27 Interpreters, compilers, and the Java Virtual Machine 1 May 2012 Lecturer: Andrew Myers 1 Interpreters vs. compilers There are two strategies for obtaining runnable code from a program
More informationContents. 9-1 Copyright (c) 1999-2004 N. Afshartous
Contents 1. Introduction 2. Types and Variables 3. Statements and Control Flow 4. Reading Input 5. Classes and Objects 6. Arrays 7. Methods 8. Scope and Lifetime 9. Utility classes 10. Introduction to
More informationGlossary of Object Oriented Terms
Appendix E Glossary of Object Oriented Terms abstract class: A class primarily intended to define an instance, but can not be instantiated without additional methods. abstract data type: An abstraction
More informationAn Introduction To UML Class Diagrams Classes
An Introduction To UML Class Diagrams Classes 1. Represent a user-created or defined data type a. they are an abstract data type (ADT) b. they implement data hiding and encapsulation c. they establish
More informationRARITAN VALLEY COMMUNITY COLLEGE ACADEMIC COURSE OUTLINE. CISY 105 Foundations of Computer Science
I. Basic Course Information RARITAN VALLEY COMMUNITY COLLEGE ACADEMIC COURSE OUTLINE CISY 105 Foundations of Computer Science A. Course Number and Title: CISY-105, Foundations of Computer Science B. New
More informationJava SE 7 Programming
Oracle University Contact Us: 1.800.529.0165 Java SE 7 Programming Duration: 5 Days What you will learn This Java SE 7 Programming training explores the core Application Programming Interfaces (API) you'll
More informationThomas Jefferson High School for Science and Technology Program of Studies Foundations of Computer Science. Unit of Study / Textbook Correlation
Thomas Jefferson High School for Science and Technology Program of Studies Foundations of Computer Science updated 03/08/2012 Unit 1: JKarel 8 weeks http://www.fcps.edu/is/pos/documents/hs/compsci.htm
More informationJava SE 7 Programming
Oracle University Contact Us: Local: 1800 103 4775 Intl: +91 80 4108 4709 Java SE 7 Programming Duration: 5 Days What you will learn This Java Programming training covers the core Application Programming
More informationProblem 1. CS 61b Summer 2005 Homework #2 Due July 5th at the beginning of class
CS 61b Summer 2005 Homework #2 Due July 5th at the beginning of class This homework is to be done individually. You may, of course, ask your fellow classmates for help if you have trouble editing files,
More informationSE 360 Advances in Software Development Object Oriented Development in Java. Polymorphism. Dr. Senem Kumova Metin
SE 360 Advances in Software Development Object Oriented Development in Java Polymorphism Dr. Senem Kumova Metin Modified lecture notes of Dr. Hüseyin Akcan Inheritance Object oriented programming languages
More informationmethod is never called because it is automatically called by the window manager. An example of overriding the paint() method in an Applet follows:
Applets - Java Programming for the Web An applet is a Java program designed to run in a Java-enabled browser or an applet viewer. In a browser, an applet is called into execution when the APPLET HTML tag
More informationEl Dorado Union High School District Educational Services
El Dorado Union High School District Course of Study Information Page Course Title: ACE Computer Programming II (#495) Rationale: A continuum of courses, including advanced classes in technology is needed.
More informationVisual Basic. murach's TRAINING & REFERENCE
TRAINING & REFERENCE murach's Visual Basic 2008 Anne Boehm lbm Mike Murach & Associates, Inc. H 1-800-221-5528 (559) 440-9071 Fax: (559) 440-0963 murachbooks@murach.com www.murach.com Contents Introduction
More informationPROBLEM SOLVING SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON
PROBLEM SOLVING WITH SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON Addison Wesley Boston San Francisco New York London
More informationGetting Started with the Internet Communications Engine
Getting Started with the Internet Communications Engine David Vriezen April 7, 2014 Contents 1 Introduction 2 2 About Ice 2 2.1 Proxies................................. 2 3 Setting Up ICE 2 4 Slices 2
More informationLecture 7 Notes: Object-Oriented Programming (OOP) and Inheritance
Introduction to C++ January 19, 2011 Massachusetts Institute of Technology 6.096 Lecture 7 Notes: Object-Oriented Programming (OOP) and Inheritance We ve already seen how to define composite datatypes
More informationChapter 5 Names, Bindings, Type Checking, and Scopes
Chapter 5 Names, Bindings, Type Checking, and Scopes Chapter 5 Topics Introduction Names Variables The Concept of Binding Type Checking Strong Typing Scope Scope and Lifetime Referencing Environments Named
More informationFirst Java Programs. V. Paúl Pauca. CSC 111D Fall, 2015. Department of Computer Science Wake Forest University. Introduction to Computer Science
First Java Programs V. Paúl Pauca Department of Computer Science Wake Forest University CSC 111D Fall, 2015 Hello World revisited / 8/23/15 The f i r s t o b l i g a t o r y Java program @author Paul Pauca
More informationPart 3: GridWorld Classes and Interfaces
GridWorld Case Study Part 3: GridWorld Classes and Interfaces In our example programs, a grid contains actors that are instances of classes that extend the Actor class. There are two classes that implement
More informationJava the UML Way: Integrating Object-Oriented Design and Programming
Java the UML Way: Integrating Object-Oriented Design and Programming by Else Lervik and Vegard B. Havdal ISBN 0-470-84386-1 John Wiley & Sons, Ltd. Table of Contents Preface xi 1 Introduction 1 1.1 Preliminaries
More informationCompiling Object Oriented Languages. What is an Object-Oriented Programming Language? Implementation: Dynamic Binding
Compiling Object Oriented Languages What is an Object-Oriented Programming Language? Last time Dynamic compilation Today Introduction to compiling object oriented languages What are the issues? Objects
More information