Appendices Attached (2 pages) Two Hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE QUESTION PAPER MUST NOT BE REMOVED FROM THE EXAM ROOM
|
|
- Katrina Taylor
- 6 years ago
- Views:
Transcription
1 Appendices Attached (2 pages) COMP27010 Two Hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE QUESTION PAPER MUST NOT BE REMOVED FROM THE EXAM ROOM Object Oriented Programming 2 Date: Monday 19 th May 2008 Time: 14:00 16:00 Answer the 20 short questions in Section A (worth 60 marks) Answer ONE question from Section B (worth 20 marks) Answer ONE question from Section C (worth 20 marks) Note: Do not answer more than the required number of questions. Clearly cross out anything you do not wish to be marked. The use of electronic calculators is permitted provided they are not programmable and do not store text. [PTO]
2 Page 2 of 16 COMP27010 Section A Answer all questions 1. Java utilises class constructors. Answer the following questions with reference to a constructor. a) What is a constructor? (0.5 mark) b) What is the function of a constructor? (0.5 mark) c) How is a constructor called? Write a code fragment that instantiates an object, of type ClassA, by calling its constructor. (1 mark) 2. Given the Java interface code, ExampleInterface, specification below, answer the following: a) When an interface is implemented in a specific class, what does the interface ensure the class contains? (1 mark) b) What does the compiler assume if a class uses an interface? (1 mark) c) Write a code fragment for a class that implements the ExampleInterface interface. public interface ExampleInterface // Interface method definition void SetValueMethod(int y); Question 2: Code segment for ExampleInterface.
3 Page 3 of 16 COMP Given the code segment in Appendix 1, ObjectVariables1Example, the supplementary Program Listing(s) at the end of this exam paper. Given that Fred has been instantiated, what are the values of: a) Test? b) Val? c) Old? with reference to object Fred. 4. With reference to exception handling in Java, answer the following related questions: a) What does the key word throw enable a program to do and where is it derived from; and b) Write a code fragment for the throw program listing that throws a new exception in the public method named method1. (Note: 2 marks for a concise code fragment that includes a relevant exception string argument that specifies the location of the exception, 1 mark for basic code fragment). public void samplemethod() try method1(); catch ( Exception e ) System.out.println("An exception has occurred: " + e); // The method below is incomplete public static void method1() // Auxiliary code required Question 4: Throw program listing [Code snippet] 5. Java handles interactions with a user by employing event-driven software. Explain what an event is and give an example of an event initiated by a user. [PTO]
4 Page 4 of 16 COMP a) Differentiate between a superclass default constructor super() and a finalize(). In your answer also state when each is normally called; and b) Give examples of typical steps (or processes) a finalizer like finalize() enables a class to undertake. 7. Database servers provide functionality that Java programmers require. State what Database servers actually do, with reference to providing functionality that Java programmers require. (Note: 2 marks for a set of succinct sentences that support the answers, 1 mark for basic explanations). (4 marks) 8. When interacting with a server a client is able to manage (save) client state information. State the three main ways of managing (saving) client state information. 9. Consider the inheritance hierarchy depicted in the diagram below. Two objects are instantiated utilising similar code to that in Appendix 1 of the exam paper. Object variable name Joe is of type ClassC and Fred is of type ClassA. Note: getval; gettest; & getold are class methods. Write a set of code snippets, with appropriate object instantiation, to: a) Access the getval method in ClassC. b) Access the getval method in ClassA. (NOTE: 4 marks for indicating the correct instantiations plus correct method usage, 2 mark if only half the code is specified.) (4 marks) ClassA ClassC Class C Static Vars Local Var Defns Parent Class Class C Methods getval - returns 5 ClassB Class B Static Vars Local Var Defns Parent Class Class B Methods gettest - returns 3 getval - returns 11 Class A Static Vars Non-Static Var Defns Parent Class Class A Methods getval - returns 19 gettest - returns 21 getold - returns 42 Question 9: Class inheritance hierarchy.
5 Page 5 of 16 COMP Given Appendix 2, AccessingBaseMembersExample, Supplementary Program Listing(s) at the end of this exam paper, write the missing code in the class Cylinder such that the method [property] Area() accesses [utilises] the super class Circle properties, to enable it to calculate the area. 11. What does saying that OutputStream is an abstract class mean? What does a typical OutputStream do? Describe briefly the relationship between a File, a FileOutputStream and a BufferedOutputStream. (3 marks) 12. Suppose you had a file containing the text shown below: Artist: Dr. John, Album: Gris-Gris, Price: Artist: Sleepy John Estes, Album: Working Man's Blues, Price: 2.99 Artist: Memphis Minnie, Price: 2.99 Matching each line of this file against the regular expression Artist(.*)Album(.*)Price(.*)\\z would produce a number of 'capture groups'. Show the value of each capture group for each of the lines above. (3 marks) 13. Suppose you had a program that drew pictures like the cafe wall illusion, shown below. Explain briefly the role of the paint method in such a program. (3 marks) [PTO]
6 Page 6 of 16 COMP Describe what the following fragment of Java does, and explain the advantages of using an anonymous inner class here. depthbar = new Scrollbar(Scrollbar.HORIZONTAL, 0, 20, 0, 100); depthbar.addadjustmentlistener( new AdjustmentListener() public void adjustmentvaluechanged(adjustmentevent ae) System,out.println(depthbar.getValue()); ); (3 marks) 15. Consider the following two class definitions: class Link Object value; Link next; Link(Object v, Link n) value = v; next = n; class DLink Object value; DLink prev, next; DLink(Object v, DLink p, DLink n) value = v; prev = p; next = n; Write a method called toxml for writing out entities of type Link as XML, and explain why it is not possible to write a similar method for DLinks. (3 marks)
7 Page 7 of 16 COMP If you use a DOM parser to read a file of XML, you get an object of type Node. Suppose you had written a Link object of the kind defined in Q15 as an XML file. Outline informally what a program for converting a Node to a Link would have to do. (3 marks) 17. Consider the following XML term. <properties> <property> <type>house</type> <address>21 Christchurch Rd</address> </property> </properties> Assuming that you had a Transformer that ignored the white space around the tags, what would the following XSL file produce from this term? <xsl:template match="properties"> Properties for sale or rent <xsl:apply-templates/> </xsl:template> <xsl:template match="property"> <p> <xsl:apply-templates/> </p> </xsl:template> <xsl:template match="type"> </xsl:template> <xsl:template match="address"> <xsl:apply-templates/> </xsl:template> 18. Explain briefly the relationship between the browser on a user s machine, a Tomcat application server and an application program. (4 marks) [PTO]
8 Page 8 of 16 COMP What is the function of the following elements of a web.xml file? <servlet> <servlet-name>upload File</servlet-name> <servlet-class>uploadservlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>upload File</servlet-name> <url-pattern>/upload.do</url-pattern> </servlet-mapping> (3 marks) 20. What would the raw HTML produced by the following fragment of JSP look like, and what would this look like when viewed through a typical browser? <br> We stock the following beers: <br> <br> <% String beers[] = "Young s Special", "Felinfoel Double Dragon"; for(int i=0; i<beers.length; ++i) String s = beers[i]; %> <%= s %> <br> <% %> (3 marks)
9 Page 9 of 16 COMP27010 Section B Answer ONE question from this section. B1. Answer all parts. Reflection as a mechanism is employed in Java. a) Give a detailed and concise description of what reflection actually is. (4 marks) b) Given the reflection code snippet below, write a code snippet that utilises the Field reference balancefield to get the value of the balance. BankAccount1 TestBankAccountField = new BankAccount1(); Class ClassInfo = TestBankAccountField.getClass(); Field balancefield = ClassInfo.getField("balance"); Section B: Question 1: Reflection [Code snippet] c) Given the reflection code snippet above. Write a code snippet that utilises the Field reference balancefield to set the value of the balance to 100. d) What functionality does reflection provide (or support)? (6 marks) e) In Java reflection is supported by a Reflection API that is type-safe and secure. The API supports introspection with respect to classes and objects in the current Java Virtual Machine. State what the API can be used for. (4 marks) f) What are the main get...() methods that the Reflection API provides to assess the primary features of another class? [PTO]
10 Page 10 of 16 COMP27010 B2. Answer all parts. a) Both abstract classes and interfaces are utilised in Java. Compare and contrast abstract classes and interfaces. (4 marks) b) The following Exception handling code extract has some errors. i) Rewrite it correcting all the errors. There are eight errors to be found in the code snippet below. ii) Then state what will be printed by one of the System.out.println( ); statements when the program runs once it has been fully corrected. (5 marks) 1 public TestIndexOutOfRangeException() 2 3 / Test IndexOutOfRangeException 4 int [] TestArray = New int[4]; 5 int ExceptionNo 0; 6 7 try 8 9 int TestInt = TestArray[5; catch(arithmeticexception e) System.out.println("An ArithmeticException. \n") ExceptionNo = 1; catch(java.lang.indexoutofboundsexception ) System.out.println("An IndexOutOfBoundsException. \n"); ExceptionNo = 2; if(exceptionno==0) System.out.println("No Exception has occurred. \n"); Question B2: Exception program listing [Code snippet] (Question B2 continues on the following page)
11 Page 11 of 16 COMP27010 (Question B2 continues from the previous page) c) With reference to the above exception program listing; if line nine in the program were replaced with int a = 3/0;, e.g. int TestInt =...; is replaced with int a = 3/0; then: i) State which of the exceptions would now be thrown. ii) Also, state what type of exception is thrown, and why. iii) Finally, state what will be printed by one of the System.out.println( ); statements when the program runs. (3 marks) d) State what would happen if a catch handler catches an exception but cannot process it. (1 mark) e) Explain what happens to unhandled exceptions. (1 mark) f) If one or more catches are used they may be followed by a finally clause, the finally clause is obeyed in every case. Give examples of when the finally clause is obeyed. (3 marks) g) Write down the basic skeleton of a code snippet that outlines (defines) the correct usage of a finally clause, in a try and catch block. (3 marks) [PTO]
12 Page 12 of 16 COMP27010 Section C Answer ONE question from this section. C1. Consider the program overleaf. This program is supposed to read in a comma-separated file of the form , , , -88 where the first number on each line is an account number and the second line is either a payment into that account and or a withdrawal from it, depending whether it is positive or negative. For each line that it reads it should print out a record like Transaction(account=600078, amount=600) but there are a number of flaws in it. a) What would the program actually do if you gave it a file containing the records above? Define the method(s) that would be needed in order to get it to do what it is supposed to do. (10 marks) b) What would it do with each of the following lines: , 400, , 50 (6 marks) c) What would you have to do to it to make it print error messages when it read these lines and then continued processing the remainder of the input file. (4 marks) (Question C1 continues on the following page)
13 Page 13 of 16 COMP27010 (Question C1 continues from the previous page) import java.io.*; import java.util.*; import java.lang.math.*; public class ReadCSVRevision public static void main(string args[]) new ReadCSVRevision(args); ReadCSVRevision(String args[]) try BufferedReader br = new BufferedReader( new InputStreamReader(new FileInputStream(args[0]))); String s ; while((s = br.readline())!= null) ArrayList list = new ArrayList(); StringTokenizer st = new StringTokenizer(s, ","); while(st.hasmoretokens()) String t = st.nexttoken(); int i = Integer.parseInt(t.trim()); list.add(i); System.out.println(new Transaction(list)); catch(exception e) System.out.println(e); class Transaction int account, value ; Transaction(ArrayList list) account = (Integer) list.get(0); value = (Integer) list.get(1); [PTO]
14 Page 14 of 16 COMP27010 C2. Consider the fragment of XML below. <?xml version="1.0" encoding="utf-8"?> <Personnel> <Employee type="permanent"> <Name>Seagull</Name> <Id>3674</Id> <Age>34</Age> </Employee> <Employee type="contract"> <Name>Robin</Name> <Id>3675</Id> <Age>25</Age> </Employee> <Employee type="permanent"> <Name>Crow</Name> <Id>3676</Id> <Age>28</Age> </Employee> </Personnel> a) Write a DTD that would characterise the data recorded in this file. (8 marks) b) Write an XSL file which would produce the output shown below if viewed through a typical browser. (12 marks) END OF EXAMINATION Appendices follow on 2 pages
15 Page 15 of 16 COMP27010 Appendix 1, ObjectVariables1Example: Supplementary Program Listing(s) //******************************************************************** public class ClassA private int Val = 19; private int Test = 21; private int Old = 42; public ClassA() public int getval() return Val; public int gettest() return Test; public int getold() return Old; //******************************************************************** public class ClassB extends ClassA private int Test = 3; private int Val = 11; public ClassB() public int getval() return Val; public int gettest() return Test; //******************************************************************** public class TestB public TestB() public void samplemethod() ClassB Joe = new ClassB(); ClassB Fred = Joe; int Test = Fred.getTest(); int Val = Fred.getVal(); int Old = Fred.getOld(); //********************************************************************
16 Page 16 of 16 COMP27010 Appendix 2, AccessingBaseMembersExample: //******************************************************************** public class Circle public double radius; public Circle() radius = 0.0; public Circle(double r) radius = r; public double Area() // Area = PI * r^2 return Math.PI * radius * radius; //circumference = PI * diameter or //circumference = PI * (radius * 2) public double Circumference() return Math.PI * radius * 2; //****************************************************************** public class Cylinder extends Circle public double height; public Cylinder() super(); height = 0.0; public Cylinder(double r, double h) super(r); height = h; //area = 2 * (PI * r^2) + (PI * (radius * 2)) + height public double Area() return // missing Code; //********************************************************************
COMP200 - Object Oriented Programming: Test One Duration - 60 minutes
COMP200 - Object Oriented Programming: Test One Duration - 60 minutes Study the following class and answer the questions that follow: package shapes3d; public class Circular3DShape { private double radius;
More informationAdvanced Java Exercises
Advanced Java Exercises Generics Exercise 1: Write a generic method to exchange the positions of two different elements in an array. Exercise 2: Consider the following classes: public class AnimalHouse
More informationTwo hours QUESTION PAPER MUST NOT BE REMOVED FROM THE EXAM ROOM UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE
Two hours QUESTION PAPER MUST NOT BE REMOVED FROM THE EXAM ROOM UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE High-Level Programming (Java) Date: Thursday 20th January 2011 Time: 14:00-16:00 Answer
More informationCS506 Web Design & Development Final Term Solved MCQs with Reference
with Reference I am student in MCS (Virtual University of Pakistan). All the MCQs are solved by me. I followed the Moaaz pattern in Writing and Layout this document. Because many students are familiar
More 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 informationFull file at Chapter 2 - Inheritance and Exception Handling
Chapter 2 - Inheritance and Exception Handling TRUE/FALSE 1. The superclass inherits all its properties from the subclass. ANS: F PTS: 1 REF: 76 2. Private members of a superclass can be accessed by a
More informationOne and a half hours. Appendices A and B are located at the back of the exam UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE
One and a half hours Appendices A and B are located at the back of the exam UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE Software Evolution Date: Thursday 23rd May 2013 Time: 09:45-11:15 Please
More informationCS 113 PRACTICE FINAL
CS 113 PRACTICE FINAL There are 13 questions on this test. The value of each question is: 1-10 multiple choice (4 pt) 11-13 coding problems (20 pt) You may get partial credit for questions 11-13. If you
More 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 information6.Introducing Classes 9. Exceptions
6.Introducing Classes 9. Exceptions Sisoft Technologies Pvt Ltd SRC E7, Shipra Riviera Bazar, Gyan Khand-3, Indirapuram, Ghaziabad Website: www.sisoft.in Email:info@sisoft.in Phone: +91-9999-283-283 Learning
More informationpublic static boolean isoutside(int min, int max, int value)
See the 2 APIs attached at the end of this worksheet. 1. Methods: Javadoc Complete the Javadoc comments for the following two methods from the API: (a) / @param @param @param @return @pre. / public static
More informationFINALTERM EXAMINATION Spring 2009 CS506- Web Design and Development Solved by Tahseen Anwar
FINALTERM EXAMINATION Spring 2009 CS506- Web Design and Development Solved by Tahseen Anwar www.vuhelp.pk Solved MCQs with reference. inshallah you will found it 100% correct solution. Time: 120 min Marks:
More informationException Handling in Java. An Exception is a compile time / runtime error that breaks off the
Description Exception Handling in Java An Exception is a compile time / runtime error that breaks off the program s execution flow. These exceptions are accompanied with a system generated error message.
More informationQUIZ 2 Introduction to Computer Science (COMP 250) Mon. March 2, 2009 Professor Michael Langer
QUIZ 2 Introduction to Computer Science (COMP 250) Mon. March 2, 2009 Professor Michael Langer STUDENT NAME: ID: The exam consists of five questions. There are a total of 10 points. You may use the back
More informationINTRODUCTION TO SOFTWARE SYSTEMS (COMP1110/COMP1140/COMP1510/COMP6710)
Important notice: This document is a sample exam. The final exam will differ from this exam in numerous ways. The purpose of this sample exam is to provide students with access to an exam written in a
More informationCOMP-202 Unit 9: Exceptions
COMP-202 Unit 9: Exceptions Announcements - Assignment 4: due Monday April 16th - Assignment 4: tutorial - Final exam tutorial next week 2 Exceptions An exception is an object that describes an unusual
More informationIT6503 WEB PROGRAMMING. Unit-I
Department of Information Technology Question Bank- Odd Semester 2015-2016 IT6503 WEB PROGRAMMING Unit-I SCRIPTING 1. What is HTML? Write the format of HTML program. 2. Differentiate HTML and XHTML. 3.
More informationBSc. (Hons.) Software Engineering. Examinations for / Semester 2
BSc. (Hons.) Software Engineering Cohort: BSE/04/PT Examinations for 2005-2006 / Semester 2 MODULE: OBJECT ORIENTED PROGRAMMING MODULE CODE: BISE050 Duration: 2 Hours Reading Time: 5 Minutes Instructions
More 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 informationComputer Science 1 Bh
UNIVERSITY OF EDINBURGH course CS0077 FACULTY OF SCIENCE AND ENGINEERING DIVISION OF INFORMATICS SCHOOL OF COMPUTER SCIENCE Computer Science 1 Bh Degree Examination Date: Saturday 26th May 2001 Time: 12:00
More informationException Examples. All examples written by Edith Hemaspaandra and modified by Jessica Bayliss
Exception Examples All examples written by Edith Hemaspaandra and modified by Jessica Bayliss using System; // An example showing how exceptions propogate. public static int divide( int n, int m ) { return
More informationCISC-124. Passing Parameters. A Java method cannot change the value of any of the arguments passed to its parameters.
CISC-124 20180215 These notes are intended to summarize and clarify some of the topics that have been covered recently in class. The posted code samples also have extensive explanations of the material.
More informationCS365 Midterm -- Spring 2019
CS365 Midterm -- Spring 2019 1. This exam is closed-note, closed-book. 2. You must answer all of the questions. 3. The exam has 120 points and you will be scored out of 120 points. For example, if you
More informationInheritance. Inheritance allows the following two changes in derived class: 1. add new members; 2. override existing (in base class) methods.
Inheritance Inheritance is the act of deriving a new class from an existing one. Inheritance allows us to extend the functionality of the object. The new class automatically contains some or all methods
More informationCS313D: ADVANCED PROGRAMMING LANGUAGE
CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 6 : Abstraction Lecture Contents 2 Abstract classes Abstract methods Case study: Polymorphic processing Sealed methods & classes
More informationJAVA. Duration: 2 Months
JAVA Introduction to JAVA History of Java Working of Java Features of Java Download and install JDK JDK tools- javac, java, appletviewer Set path and how to run Java Program in Command Prompt JVM Byte
More informationCOMP 213. Advanced Object-oriented Programming. Lecture 19. Input/Output
COMP 213 Advanced Object-oriented Programming Lecture 19 Input/Output Input and Output A program that read no input and produced no output would be a very uninteresting and useless thing. Forms of input/output
More informationCS115. Chapter 17 Exception Handling. Prof. Joe X. Zhou Department of Computer Science. To know what is exception and what is exception handling
CS115 Pi Principles i of fcomputer Science Chapter 17 Exception Handling Prof. Joe X. Zhou Department of Computer Science CS115 ExceptionHandling.1 Objectives in Exception Handling To know what is exception
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 informationS.No Question Blooms Level Course Outcome UNIT I. Programming Language Syntax and semantics
S.No Question Blooms Level Course Outcome UNIT I. Programming Language Syntax and semantics 1 What do you mean by axiomatic Knowledge C254.1 semantics? Give the weakest precondition for a sequence of statements.
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 informationJava Class Design. Eugeny Berkunsky, Computer Science dept., National University of Shipbuilding
Java Class Design Eugeny Berkunsky, Computer Science dept., National University of Shipbuilding eugeny.berkunsky@gmail.com http://www.berkut.mk.ua Objectives Implement encapsulation Implement inheritance
More informationMore About Classes CS 1025 Computer Science Fundamentals I Stephen M. Watt University of Western Ontario
More About Classes CS 1025 Computer Science Fundamentals I Stephen M. Watt University of Western Ontario The Story So Far... Classes as collections of fields and methods. Methods can access fields, and
More informationCMSC 132: Object-Oriented Programming II
CMSC 132: Object-Oriented Programming II Java Support for OOP Department of Computer Science University of Maryland, College Park Object Oriented Programming (OOP) OO Principles Abstraction Encapsulation
More informationANNA UNIVERSITY OF TECHNOLOGY COIMBATORE B.E./B.TECH DEGREE EXAMINATIONS: NOV/DEC JAVA PROGRAMMING
ANNA UNIVERSITY OF TECHNOLOGY COIMBATORE B.E./B.TECH DEGREE EXAMINATIONS: NOV/DEC 2010 080230021-JAVA PROGRAMMING 1. What are the Java Features? 1. Compiled and Interpreted 2. Platform Independent and
More informationJava Primer. CITS2200 Data Structures and Algorithms. Topic 2
CITS2200 Data Structures and Algorithms Topic 2 Java Primer Review of Java basics Primitive vs Reference Types Classes and Objects Class Hierarchies Interfaces Exceptions Reading: Lambert and Osborne,
More informationAdvanced Java Programming
Advanced Java Programming Length: 4 days Description: This course presents several advanced topics of the Java programming language, including Servlets, Object Serialization and Enterprise JavaBeans. In
More informationHomework 6. Yuji Shimojo CMSC 330. Instructor: Prof. Reginald Y. Haseltine
Homework 6 Yuji Shimojo CMSC 330 Instructor: Prof. Reginald Y. Haseltine July 21, 2013 Question 1 What is the output of the following C++ program? #include #include using namespace
More informationException Handling. Sometimes when the computer tries to execute a statement something goes wrong:
Exception Handling Run-time errors The exception concept Throwing exceptions Handling exceptions Declaring exceptions Creating your own exception Ariel Shamir 1 Run-time Errors Sometimes when the computer
More informationExceptions Questions https://www.journaldev.com/2167/java-exception-interview-questionsand-answers https://www.baeldung.com/java-exceptions-interview-questions https://javaconceptoftheday.com/java-exception-handling-interviewquestions-and-answers/
More informationException Handling. Run-time Errors. Methods Failure. Sometimes when the computer tries to execute a statement something goes wrong:
Exception Handling Run-time errors The exception concept Throwing exceptions Handling exceptions Declaring exceptions Creating your own exception 22 November 2007 Ariel Shamir 1 Run-time Errors Sometimes
More informationMore on Exception Handling
Chapter 18 More on Exception Handling Lecture slides for: Java Actually: A Comprehensive Primer in Programming Khalid Azim Mughal, Torill Hamre, Rolf W. Rasmussen Cengage Learning, 2008. ISBN: 978-1-844480-933-2
More informationMcGill University School of Computer Science COMP-202A Introduction to Computing 1
McGill University School of Computer Science COMP-202A Introduction to Computing 1 Midterm Exam Thursday, October 26, 2006, 18:00-20:00 (6:00 8:00 PM) Instructors: Mathieu Petitpas, Shah Asaduzzaman, Sherif
More informationModule 6: Binary Trees
Module : Binary Trees Dr. Natarajan Meghanathan Professor of Computer Science Jackson State University Jackson, MS 327 E-mail: natarajan.meghanathan@jsums.edu Tree All the data structures we have seen
More informationFinal Examination Semester 3 / Year 2008
Southern College Kolej Selatan 南方学院 Final Examination Semester 3 / Year 2008 COURSE : JAVA PROGRAMMING COURSE CODE : PROG1114 TIME : 2 1/2 HOURS DEPARTMENT : COMPUTER SCIENCE CLASS : CS08-A + CS08-B LECTURER
More informationThe University of Nottingham
The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, SPRING SEMESTER OBJECT-ORIENTED METHODS Time allowed TWO hours Candidates may complete the front cover of their answer book and
More 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 informationProgramming II (CS300)
1 Programming II (CS300) Chapter 04: Exception Handling MOUNA KACEM mouna@cs.wisc.edu Spring 2018 Creating Classes 2 Introduction Exception Handling Common Exceptions Exceptions with Methods Assertions
More informationSSE3052: Embedded Systems Practice
SSE3052: Embedded Systems Practice Minwoo Ahn minwoo.ahn@csl.skku.edu Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu SSE3052: Embedded Systems Practice, Spring 2018, Jinkyu Jeong
More informationJava: exceptions and genericity
Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer Java: exceptions and genericity Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer Exceptions Exceptions
More informationECE462Exam3. 08:10-09:20AM, November 20, 2009
ECE462Exam3 08:10-09:20AM, November 20, 2009 IcertifythatIwillnotreceivenorprovideaidtoanyotherstudentforthisexam. Signature: Youmustsignhere.Otherwise,theexamisnotgraded. This exam is printed double sides.
More informationI BCS-031 BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination. June, 2015 BCS-031 : PROGRAMMING IN C ++
No. of Printed Pages : 3 I BCS-031 BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination 05723. June, 2015 BCS-031 : PROGRAMMING IN C ++ Time : 3 hours Maximum Marks : 100 (Weightage 75%)
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 informationJAC444 - Lecture 4. Segment 1 - Exception. Jordan Anastasiade Java Programming Language Course
JAC444 - Lecture 4 Segment 1 - Exception 1 Objectives Upon completion of this lecture, you should be able to: Separate Error-Handling Code from Regular Code Use Exceptions to Handle Exceptional Events
More information엄현상 (Eom, Hyeonsang) School of Computer Science and Engineering Seoul National University COPYRIGHTS 2017 EOM, HYEONSANG ALL RIGHTS RESERVED
엄현상 (Eom, Hyeonsang) School of Computer Science and Engineering Seoul National University COPYRIGHTS 2017 EOM, HYEONSANG ALL RIGHTS RESERVED Outline - Interfaces - An Instrument interface - Multiple Inheritance
More informationObject Oriented Programming 2013/14. Final Exam June 20, 2014
Object Oriented Programming 2013/14 Final Exam June 20, 2014 Directions (read carefully): CLEARLY print your name and ID on every page. The exam contains 8 pages divided into 4 parts. Make sure you have
More informationCH. 2 OBJECT-ORIENTED PROGRAMMING
CH. 2 OBJECT-ORIENTED PROGRAMMING ACKNOWLEDGEMENT: THESE SLIDES ARE ADAPTED FROM SLIDES PROVIDED WITH DATA STRUCTURES AND ALGORITHMS IN JAVA, GOODRICH, TAMASSIA AND GOLDWASSER (WILEY 2016) OBJECT-ORIENTED
More informationComputer Science 1 Bh
UNIVERSITY OF EDINBURGH course CS0077 FACULTY OF SCIENCE AND ENGINEERING DIVISION OF INFORMATICS SCHOOL OF COMPUTER SCIENCE Computer Science 1 Bh Degree Examination Date: Saturday 25th May 2002 Time: 12:00
More informationLesson 15..Classes and Objects
15-1 Lesson 15..Classes and Objects A class is like a cookie cutter and the cookies it produces are the objects: One cookie cutter..many possible cookies. One class... many possible objects. Building a
More informationProgramming II (CS300)
1 Programming II (CS300) Chapter 04: Exception Handling MOUNA KACEM mouna@cs.wisc.edu Fall 2018 Creating Classes 2 Introduction Exception Handling Common Exceptions Exceptions with Methods Assertions and
More informationObject- Oriented Analysis, Design and Programming
Object- Oriented Analysis, Design and Programming Medialogy, Semester 4 Monday 19 April 2010 9.00 12.00 You have 3 hours to complete this examination. Neither written material nor electronic equipment
More informationA Third Look At Java. Chapter Seventeen Modern Programming Languages, 2nd ed. 1
A Third Look At Java Chapter Seventeen Modern Programming Languages, 2nd ed. 1 A Little Demo public class Test { public static void main(string[] args) { int i = Integer.parseInt(args[0]); int j = Integer.parseInt(args[1]);
More informationUniversity of Cape Town Department of Computer Science. Computer Science CSC115F. June 2003/2004 Supplementary Exam
University of Cape Town Department of Computer Science Computer Science CSC115F June 2003/2004 Supplementary Exam Answer all questions. All questions that refer to elements of programming make reference
More informationCS 11 java track: lecture 3
CS 11 java track: lecture 3 This week: documentation (javadoc) exception handling more on object-oriented programming (OOP) inheritance and polymorphism abstract classes and interfaces graphical user interfaces
More informationUsing APIs. Chapter 3. Outline Fields Overall Layout. Java By Abstraction Chapter 3. Field Summary static double PI
Outline Chapter 3 Using APIs 3.1 Anatomy of an API 3.1.1 Overall Layout 3.1.2 Fields 3.1.3 Methods 3.2 A Development Walkthrough 3.2.1 3.2.2 The Mortgage Application 3.2.3 Output Formatting 3.2.4 Relational
More informationI pledge by honor that I will not discuss this exam with anyone until my instructor reviews the exam in the class.
Name: Covers Chapters 1-3 50 mins CSCI 1301 Introduction to Programming Armstrong Atlantic State University Instructor: Dr. Y. Daniel Liang I pledge by honor that I will not discuss this exam with anyone
More informationTopics. Java arrays. Definition. Data Structures and Information Systems Part 1: Data Structures. Lecture 3: Arrays (1)
Topics Data Structures and Information Systems Part 1: Data Structures Michele Zito Lecture 3: Arrays (1) Data structure definition: arrays. Java arrays creation access Primitive types and reference types
More informationCall: Core&Advanced Java Springframeworks Course Content:35-40hours Course Outline
Core&Advanced Java Springframeworks Course Content:35-40hours Course Outline Object-Oriented Programming (OOP) concepts Introduction Abstraction Encapsulation Inheritance Polymorphism Getting started with
More informationExceptions and Working with Files
Exceptions and Working with Files Creating your own Exceptions. You have a Party class that creates parties. It contains two fields, the name of the host and the number of guests. But you don t want to
More informationCS Internet programming Unit- I Part - A 1 Define Java. 2. What is a Class? 3. What is an Object? 4. What is an Instance?
CS6501 - Internet programming Unit- I Part - A 1 Define Java. Java is a programming language expressly designed for use in the distributed environment of the Internet. It was designed to have the "look
More informationAP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS
AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS PAUL L. BAILEY Abstract. This documents amalgamates various descriptions found on the internet, mostly from Oracle or Wikipedia. Very little of this
More informationAn exception is simply an error. Instead of saying an error occurred, we say that an.
3-1 An exception is simply an error. Instead of saying an error occurred, we say that an. Suppose we have a chain of methods. The method is the first in the chain. An expression in it calls some other
More informationUnit3: Java in the large. Prepared by: Dr. Abdallah Mohamed, AOU-KW
Prepared by: Dr. Abdallah Mohamed, AOU-KW 1 1. Introduction 2. Objects and classes 3. Information hiding 4. Constructors 5. Some examples of Java classes 6. Inheritance revisited 7. The class hierarchy
More informationCSCI 201L Written Exam #1 Fall % of course grade
Final Score /15 Name SOLUTION ID Extra Credit /0.5 Lecture Section (circle one): TTh 8:00-9:20 TTh 9:30-10:50 TTh 11:00-12:20 CSCI 201L Written Exam #1 Fall 2017 15% of course grade The exam is one hour
More informationCOMP-202 Unit 9: Exceptions
COMP-202 Unit 9: Exceptions Course Evaluations Please do these. -Fast to do -Used to improve course for future. (Winter 2011 had 6 assignments reduced to 4 based on feedback!) 2 Avoiding errors So far,
More informationSCHEME OF COURSE WORK
SCHEME OF COURSE WORK Course Details: Course Title Object oriented programming through JAVA Course Code 15CT1109 L T P C : 3 0 0 3 Program: B.Tech. Specialization: Information Technology Semester IV Prerequisites
More information16-Dec-10. Consider the following method:
Boaz Kantor Introduction to Computer Science IDC Herzliya Exception is a class. Java comes with many, we can write our own. The Exception objects, along with some Java-specific structures, allow us to
More informationCSCI 135 Exam #2 Fundamentals of Computer Science I Fall 2013
CSCI 135 Exam #2 Fundamentals of Computer Science I Fall 2013 Name: This exam consists of 6 problems on the following 6 pages. You may use your two-sided hand-written 8 ½ x 11 note sheet during the exam.
More informationCSCI 136 Written Exam #1 Fundamentals of Computer Science II Spring 2014
CSCI 136 Written Exam #1 Fundamentals of Computer Science II Spring 2014 Name: This exam consists of 5 problems on the following 6 pages. You may use your double- sided hand- written 8 ½ x 11 note sheet
More informationHST 952. Computing for Biomedical Scientists Lecture 8
Harvard-MIT Division of Health Sciences and Technology HST.952: Computing for Biomedical Scientists HST 952 Computing for Biomedical Scientists Lecture 8 Outline Vectors Streams, Input, and Output in Java
More informationObject oriented programming. Instructor: Masoud Asghari Web page: Ch: 7
Object oriented programming Instructor: Masoud Asghari Web page: http://www.masses.ir/lectures/oops2017sut Ch: 7 1 In this slide We follow: https://docs.oracle.com/javase/tutorial/index.html Trail: Essential
More informationM257 Past Paper Oct 2007 Attempted Solution
M257 Past Paper Oct 2007 Attempted Solution Part 1 Question 1 The compilation process translates the source code of a Java program into bytecode, which is an intermediate language. The Java interpreter
More informationObject-Oriented Programming Design. Topic : Streams and Files
Electrical and Computer Engineering Object-Oriented Topic : Streams and Files Maj Joel Young Joel Young@afit.edu. 18-Sep-03 Maj Joel Young Java Input/Output Java implements input/output in terms of streams
More informationEXAM Microsoft MTA Software Development Fundamentals. Buy Full Product.
Microsoft EXAM - 98-361 Microsoft MTA Software Development Fundamentals Buy Full Product http://www.examskey.com/98-361.html Examskey Microsoft 98-361 exam demo product is here for you to test the quality
More informationAccurate study guides, High passing rate! Testhorse provides update free of charge in one year!
Accurate study guides, High passing rate! Testhorse provides update free of charge in one year! http://www.testhorse.com Exam : 1Z0-850 Title : Java Standard Edition 5 and 6, Certified Associate Exam Version
More information(800) Toll Free (804) Fax Introduction to Java and Enterprise Java using Eclipse IDE Duration: 5 days
Course Description This course introduces the Java programming language and how to develop Java applications using Eclipse 3.0. Students learn the syntax of the Java programming language, object-oriented
More informationObject Oriented Programming 2014/15. Final Exam July 3, 2015
Object Oriented Programming 2014/15 Final Exam July 3, 2015 Directions (read carefully): CLEARLY print your name and ID on every page. The exam contains 8 pages divided into 4 parts. Make sure you have
More informationBBM 102 Introduction to Programming II Spring Exceptions
BBM 102 Introduction to Programming II Spring 2018 Exceptions 1 Today What is an exception? What is exception handling? Keywords of exception handling try catch finally Throwing exceptions throw Custom
More informationHappy Cinco de Mayo!!!!
CSC 1051 Algorithms and Data Structures I Happy Cinco de Mayo!!!! Final Examination May 5, 2018 Name: Question Value Score 1 10 2 10 3 10 4 10 5 10 6 10 7 10 8 10 9 20 TOTAL 100 Please answer questions
More informationInput-Output and Exception Handling
Software and Programming I Input-Output and Exception Handling Roman Kontchakov / Carsten Fuhs Birkbeck, University of London Outline Reading and writing text files Exceptions The try block catch and finally
More informationQ&A. DEMO Version
Sun Certified Programmer for the Java 2 Platform.SE 5.0 Q&A DEMO Version Copyright (c) 2007 Chinatag LLC. All rights reserved. Important Note Please Read Carefully For demonstration purpose only, this
More informationMore on Exception Handling
Chapter 18 More on Exception Handling Lecture slides for: Java Actually: A Comprehensive Primer in Programming Khalid Azim Mughal, Torill Hamre, Rolf W. Rasmussen Cengage Learning, 2008. ISBN: 978-1-844480-933-2
More informationClass 9: Static Methods and Data Members
Introduction to Computation and Problem Solving Class 9: Static Methods and Data Members Prof. Steven R. Lerman and Dr. V. Judson Harward Goals This the session in which we explain what static means. You
More information[Course Overview] After completing this module you are ready to: Develop Desktop applications, Networking & Multi-threaded programs in java.
[Course Overview] The Core Java technologies and application programming interfaces (APIs) are the foundation of the Java Platform, Standard Edition (Java SE). They are used in all classes of Java programming,
More informationFile IO. Computer Science and Engineering College of Engineering The Ohio State University. Lecture 20
File IO Computer Science and Engineering College of Engineering The Ohio State University Lecture 20 I/O Package Overview Package java.io Core concept: streams Ordered sequences of data that have a source
More informationChapter 9. Exception Handling. Copyright 2016 Pearson Inc. All rights reserved.
Chapter 9 Exception Handling Copyright 2016 Pearson Inc. All rights reserved. Last modified 2015-10-02 by C Hoang 9-2 Introduction to Exception Handling Sometimes the best outcome can be when nothing unusual
More informationIntroduction. Exceptions: An OO Way for Handling Errors. Common Runtime Errors. Error Handling. Without Error Handling Example 1
Exceptions: An OO Way for Handling Errors Introduction Rarely does a program runs successfully at its very first attempt. It is common to make mistakes while developing as well as typing a program. Such
More informationComputer Science 1 Ah
UNIVERSITY OF EDINBURGH course CS0077 COLLEGE OF SCIENCE AND ENGINEERING SCHOOL OF INFORMATICS Computer Science 1 Ah Resit Examination Specimen Solutions Date: Monday 1st September 2003 Time: 09:30 11:00
More informationNotes on Chapter Three
Notes on Chapter Three Methods 1. A Method is a named block of code that can be executed by using the method name. When the code in the method has completed it will return to the place it was called in
More informationComments are almost like C++
UMBC CMSC 331 Java Comments are almost like C++ The javadoc program generates HTML API documentation from the javadoc style comments in your code. /* This kind of comment can span multiple lines */ //
More information