EXAMINATION FOR THE BSC (HONS) INFORMATION TECHNOLOGY; BSC (HONS) INFORMATION SYSTEMS & BSC (HONS) COMPUTER SCIENCE; YEAR 1

Similar documents
EXAMINATION FOR THE BSC (HONS) INFORMATION SYSTEMS; BSC (HONS) INFORMATION TECHNOLOGY & BSC (HONS) COMPUTER SCIENCE; YEAR 1

EXAMINATION FOR THE BSC (HONS) IN INFORMATION SYSTEMS; YEAR 2

Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub

Exam Duration: 2hrs and 30min Software Design

Final Examination Semester 3 / Year 2012

Final Examination Semester 3 / Year 2010

Module Contact: Dr Taoyang Wu, CMP Copyright of the University of East Anglia Version 1

BSc. (Hons.) Software Engineering. Examinations for / Semester 2

UNIVERSITI SAINS MALAYSIA. CIT502 Object-Oriented Programming and Software Engineering

Module Contact: Dr Geoff McKeown, CMP Copyright of the University of East Anglia Version 1

Software and Programming 1

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

Java for Non Majors Spring 2018

I BCS-031 BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination. June, 2015 BCS-031 : PROGRAMMING IN C ++

Second Exam Computer Programming 326 Dr. St. John Lehman College City University of New York Thursday, 11 November 2010

Final Examination Semester 3 / Year 2012

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

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

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

C++ Important Questions with Answers

Final Examination Semester 3 / Year 2012

Systems Programming. Bachelor in Telecommunication Technology Engineering Bachelor in Communication System Engineering Carlos III University of Madrid

Module Contact: Dr Gavin Cawley, CMP Copyright of the University of East Anglia Version 1

ENCAPSULATION AND POLYMORPHISM

Ahmadu Bello University Department of Mathematics First Semester Examinations June 2014 COSC211: Introduction to Object Oriented Programming I

Paytm Programming Sample paper: 1) A copy constructor is called. a. when an object is returned by value

Module Contact: Dr Geoff McKeown, CMP Copyright of the University of East Anglia Version 1

POLYTECHNIC OF NAMIBIA SCHOOL OF COMPUTING AND INFORMATICS DEPARTMENT OF COMPUTER SCIENCE

Java Class Design. Eugeny Berkunsky, Computer Science dept., National University of Shipbuilding

Computer Science 2 Lecture 4 Inheritance: Trinidad Fruit Stand 02/15/2014 Revision : 1.7

AP Computer Science Chapter 10 Implementing and Using Classes Study Guide

Inheritance and Polymorphism

Arrays Classes & Methods, Inheritance

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

Chapter 4 Defining Classes I

University of Swaziland Department Of Computer Science Supplementary Examination JULY 2012

Module Contact: Dr Geoff McKeown, CMP Copyright of the University of East Anglia Version 2

Object- Oriented Analysis, Design and Programming

Inheritance. Inheritance Reserved word protected Reserved word super Overriding methods Class Hierarchies Reading for this lecture: L&L

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

Module Contact: Dr Geoff McKeown, CMP Copyright of the University of East Anglia Version 1

24. Inheritance. Java. Fall 2009 Instructor: Dr. Masoud Yaghini

Handout 9 OO Inheritance.

CS/B.TECH/CSE(OLD)/SEM-6/CS-605/2012 OBJECT ORIENTED PROGRAMMING. Time Allotted : 3 Hours Full Marks : 70

22. Inheritance. Java. Summer 2008 Instructor: Dr. Masoud Yaghini

Department of Networks College of Bardarash Technical Institute DUHOK Polytechnic University Subject: Programming Fundamental by JAVA Course Book

Object Oriented Relationships

Tutorial 4. public class Stock { private int numberofshares; private double dividend; private String TickerSymbol;

Understanding the Object Paradigm

Create a Java project named week10

Final Examination Semester 3 / Year 2008

Polymorphism. return a.doublevalue() + b.doublevalue();

MARATHWADA INSTITUTE OF TECHNOLOGY, AURANGABAD DEPARTMENT OF MASTER OF COMPUTER APPLICATIONS ADVANCE JAVA QUESTION BANK

COP 3330 Final Exam Review

Introduction to Programming Using Java (98-388)

CS111: PROGRAMMING LANGUAGE II

OBJECT ORIENTED PROGRAMMING. Course 4 Loredana STANCIU Room B616

CS 110 Practice Final Exam originally from Winter, Instructions: closed books, closed notes, open minds, 3 hour time limit.

Inheritance, Polymorphism, and Interfaces

Class, Variable, Constructor, Object, Method Questions

SRM INSTITUTE OF SCIENCE & TECHNOLOGY Faculty of Science and Humanities Department of Computer Science UNIT I - INTRODUCTION TO JAVA

CH. 2 OBJECT-ORIENTED PROGRAMMING

Practice for Chapter 11

CS 116 Week 8 Page 1

Chapter 6 Introduction to Defining Classes

CS 1316 Exam 1 Summer 2009

COMPUTER SCIENCE DEPARTMENT PICNIC. Operations. Push the power button and hold. Once the light begins blinking, enter the room code

Programming II (CS300)

Inheritance (continued) Inheritance

INDEX. A SIMPLE JAVA PROGRAM Class Declaration The Main Line. The Line Contains Three Keywords The Output Line

5. In JAVA, is exception handling implicit or explicit or both. Explain with the help of example java programs. [16]

8.1 Inheritance. 8.1 Class Diagram for Words. 8.1 Words.java. 8.1 Book.java 1/24/14

ALIGARH MUSLIM UNIVERSITY Department of Computer Science. JAVA Lab Assignment Course: MCA II nd Semester Academic Session:

Write a java program to prints the count of odd and even no s entered.

APCS Semester #1 Final Exam Practice Problems

COMP200 - Object Oriented Programming: Test One Duration - 60 minutes

CSE115 / CSE503 Introduction to Computer Science I. Dr. Carl Alphonce 343 Davis Hall Office hours:

Anatomy of a Class Encapsulation Anatomy of a Method

a) Answer all questions. b) Write your answers in the space provided. c) Show all calculations where applicable.

SAMPLE EXAM Second Exam Computer Programming 326 Dr. St. John Lehman College City University of New York Thursday, 11 November 2010

Objects as a programming concept

Lecture 3. COMP1006/1406 (the Java course) Summer M. Jason Hinek Carleton University

Java Fundamentals (II)

BSc (Hons) Computer Science with Network Security/ BSc (Hons) Software Engineering/ BSc (Hons) Web Technologies. Examinations for 2016 Semester 1

CSCI 136 Written Exam #0 Fundamentals of Computer Science II Spring 2013

Object Orientated Analysis and Design. Benjamin Kenwright

Mathematics/Science Department Kirkwood Community College. Course Syllabus. Computer Science CSC142 1/10

University of Cape Town ~ Department of Computer Science Computer Science 1015F ~ June Exam

Two hours QUESTION PAPER MUST NOT BE REMOVED FROM THE EXAM ROOM UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE

Inheritance Motivation

Objective Questions. BCA Part III Paper XIX (Java Programming) page 1 of 5

UNIVERSITI TEKNOLOGI MALAYSIA FINAL EXAMINATION SEMESTER II, 2016 / 2017

3.Constructors and Destructors. Develop cpp program to implement constructor and destructor.

Islamic University of Gaza Faculty of Engineering Computer Engineering Department

NATIONAL UNIVERSITY OF SINGAPORE

CO Java SE 8: Fundamentals

CS111: PROGRAMMING LANGUAGE II

ITI Introduction to Computing II

Questions Answer Key Questions Answer Key Questions Answer Key

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

Transcription:

FACULTY OF SCIENCE AND TECHNOLOGY EXAMINATION FOR THE BSC (HONS) INFORMATION TECHNOLOGY; BSC (HONS) INFORMATION SYSTEMS & BSC (HONS) COMPUTER SCIENCE; YEAR 1 ACADEMIC SESSION 2014; SEMESTER 2 PRG1203: OBJECT ORIENTED PROGRAMMING FUNDAMENTALS FINAL JULY 2014 EXAM CYCLE TIME: 2 HOURS + 10 MINUTES READING TIME INSTRUCTIONS TO CANDIDATES This question booklet contains two sections. Section A: Answer the compulsory questions. Section B: Answer two questions out of three questions All answers must be written in the answer booklets provided using blue or black INK IMPORTANT NOTES TO CANDIDATES Materials Allowed Standard Items : Pen, Pencil, Eraser or Correction Fluid, Ruler Special Items : Non Programmable Calculators It is your responsibility to ensure that you do NOT have in your possession any unauthorised notes or any other means that would improperly help you in your work. If you have any unauthorised materials with you, hand it to the invigilator BEFORE reading any further. DO NOT REMOVE THIS QUESTION PAPER FROM THE EXAMINATION HALL [This paper contains FOUR questions printed on SEVEN pages]

Section A Compulsory Question. Question 1 (50 marks) a) State whether the following statement is true or false. (6 marks) i. The keyword this is used to access the superclass constructor. A subclass cannot directly access private members of its superclass. A superclass can directly access the members of its subclass. A constructor must have the same name as the class name and without return type. v. Overloaded methods must have the same name. vi. The Keyword extends used to define the relationship between classes. b) Briefly define the following terms: i. Class Object Data member Constructor v. Inheritance vi. Overloaded constructor c) Explain the difference between the term instantiation and initialization. Provide one example of each using the following class. (6 marks) (6 marks) -name:string -age:int Student +getname():string +getage():int +setname(string):void +setage(int):void 1

d) Consider the following Java program. public class FinalExam { public static void main(string[] args) { int n1=10, n2=8; int result = getsum(3,6); System.out.println("The sum of 3 and 6 is " + result); System.out.println("The sum of 10 and 8 is " + getsum(n1,n2)); result = getsum(n1,-4); } static int getsum(int num1, int num2) { return num1 + num2; } } i. What will be output of the above program? Briefly explain the purpose of String[] args in the main method and how to use it in a Java program. What is the purpose of the keyword static in the above program? (3 marks) e) City Sports Club is developing a system to keep track of its member s information and to calculate their total membership fee. Each member s data consists of a name, IC number, length of membership (in years) and yearly membership fee. (10 marks) Write the corresponding UML Class Diagram for the Member class. The class diagram should include the following: i. Attributes A default constructor An overloaded constructor to initialize all attributes. Methods (accessor methods) 2

f) Consider a program to manage a bank deposit account. The account data consists of an IC number and the amount in the deposit. The yearly interest is calculated as follows. If the amount is less than 5000, the interest rate is 1.2 %, if the amount is in between 5000 to 50000 inclusive; the rate is 3.0 %, if the amount is more than 50000, the interest rate is 3.5 %. Write the code (Java class) for the above scenario by identifying the following elements: i. Object (1 mark) Attributes ( data of objects) Methods (behavior of objects) to be performed including yearly interest. Constructors (default & overloaded) (8 marks) 3

Section B Answer any TWO questions from this section. Question 2 (25 marks) a) A class BookOrder is used to process an online order of book purchase. The class diagram for the BookOrder class is given below : BookOrder -title: String -isbn: String -quantity: int -unitprice: float +gettitle(): String +getisbn(): String +getquantity(): int +getunitprice(): float +settitle(string): void +setisbn(string): void +setquantity(int): void +setunitprice(float): void +calculatetotalprice(): float +printdetails(): void From the superclass BookOrder, write the code (Java class) for the following: i. Create a subclass called BookShippingOrder. (1 mark) A data member named shippingcharge for shipping and handling charge with value RM 8.00 (a constant value with RM 8.00). An overloaded constructor that has title, isbn, and quantity ordered in the argument list, and a default constructor. Accessor method for the shippingcharge data member. v. An overriding method calculatetotalprice() to compute the total price including the shipping and handling charge. 4

b) Consider an application to store 20 whole numbers in an array. Answer the below questions: i. Write the code fragment to create an array named numberlist, to hold the 20 whole numbers. Assuming that a Scanner object, sc, has been created, write the code fragment to store the numbers in the array when the user enters the numbers at the keyboard. Assume the following variable is declared to store the total number of odd numbers in the list. int oddcount = 0; Write code fragment to calculate and display the total number of odd numbers in the list. c) Explain the term typecasting and give an example for each implicit and explicit typecasting. Question 3 (25 marks) a) Briefly explain the key differences that distinguish between: (12 marks) i. The keywords this & super Overriding method and overloading method The keywords extends and implements b) Assume that you are working with the design for a Library loan management application. (8 marks) The application must enable the user to view the loan history list, view books currently on loan, delete selected loan information, and renew the loan for selected or all books. A login is also required. Only a user with a successful login is allowed to access the application. Draw the use-case diagram that models the above application scenario: c) What is recursion? Give an example for recursive method in Java. (5 marks) 5

Question 4 (25 marks) a) Consider the following class and answer the below questions: Staff -name: String -staff_id: String #divisionno: int +Staff(): +Staff(String, String, int): +getname():string +setname(string): void +getstaff_id():string +setstaff_id(string):void +getdivisionno():int +setdivisionno(int):void i. Why is it a good practice for data members to be declared as private? When it would be appropriate for the data member name to be designated a protected? What is the symbol # represents in the above class? Identify any two mutator methods in the Staff class and provide the implementation for it. v. Write the code fragment for the tostring method to display the details of the above Staff class. b) Consider the UML diagram for the class Loan and interface LoanCalculator. (13 marks) Loan -icnum:string -noofyears:int -amount:float +Loan() +Loan(String, float) +seticnum(string):void +geticnum():string +setnoofyears(int):void +getnoofyears():int +setamount(float):void +getamount():int <<interface>> LoanCalculator +downpercentage:float +calyearint(float):float +calinideposit():float 6

The LoanCalculator interface has one constant float downpercentage as down payment percentage initialized to 3%, one abstract method public float calyearint(float interestrate), and an abstract method public float calinideposit(). The interest rate is in percentage (e.g. 3.5) The yearly interest is calculated based on the following formula: Yearly interest = interestrate * amount The down payment is calculated based on the following formula Total Amount Initial Deposit >20000 downpercentage * amount <=20000 100 Create the Java implementation of the class Loan and interface LoanCalculator. END OF EXAMINATION PAPER 7