Autumn Examinations 2010/2011: Advanced Application Programming Exam, Exams of Applications of Computer Sciences

Information about an exam for the masters of business studies in electronic commerce, msc. Information systems management full-time and part-time programs, focusing on the module 'advanced application programming'. The exam includes multiple-choice questions and essay-style questions, covering topics such as polymorphism, inheritance, arrays, constructors, and classes. Candidates are required to answer all questions in section a and any two questions in section b. The document also includes instructions for the exam, such as duration and materials required.

Typology: Exams

2011/2012

Uploaded on 11/24/2012

divye
divye 🇮🇳

4.6

(12)

92 documents

1 / 8

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Autumn Examinations 2010/ 2011
Exam Code(s)
1AE1, 1MIS1, 1MIS2
Exam(s)
Masters of Business Studies in Electronic Commerce
MSc. Information Systems Management full-time
MSc. Information Systems Management part-time
Module Code(s)
MS815
Module(s)
Advanced Application Programming
Paper No.
Repeat Paper
External
Examiner(s)
Dr. Danail Ivanov
Internal
Examiner(s)
Dr. Thomas Acton
Mr. Seamus Hill
Instructions:
Candidates are required to answer:
Section A (20 Marks) Answer all 10 parts of section A,
This section consists of 10 multiple-choice questions all of which should ideally
be attempted. Answers are to be written on the MCQ sheet provided, NOT
on the Examination paper.
Section B (80 Marks) Answer Any Two Questions
Duration
3 Hours
No. of Pages
Discipline(s)
Business Information Systems
Course Co-
ordinator(s)
Mr. Seamus Hill
Requirements:
MCQ
Release to Library: Yes No
Handout
Statistical/ Log
Tables
Cambridge Tables
Graph Paper
Log Graph Paper
Other Materials
PTO
X
pf3
pf4
pf5
pf8

Partial preview of the text

Download Autumn Examinations 2010/2011: Advanced Application Programming Exam and more Exams Applications of Computer Sciences in PDF only on Docsity!

Autumn Examinations 2010/ 2011

Exam Code(s) 1AE1, 1MIS1, 1MIS

Exam(s) Masters of Business Studies in Electronic Commerce

MSc. Information Systems Management full-time

MSc. Information Systems Management part-time

Module Code(s) MS

Module(s) Advanced Application Programming

Paper No.

Repeat Paper

External

Examiner(s)

Dr. Danail Ivanov

Internal

Examiner(s)

Dr. Thomas Acton

Mr. Seamus Hill

Instructions: Candidates are required to answer:

Section A (20 Marks) Answer all 10 parts of section A, This section consists of 10 multiple-choice questions all of which should ideally be attempted. Answers are to be written on the MCQ sheet provided, NOT on the Examination paper. Section B (80 Marks) Answer Any Two Questions

Duration 3 Hours

No. of Pages

Discipline(s) Business Information Systems

Course Co-

ordinator(s)

Mr. Seamus Hill

Requirements :

MCQ Release to Library: Yes No

Handout

Statistical/ Log

Tables

Cambridge Tables

Graph Paper

Log Graph Paper

Other Materials

PTO

X

Question 1

1) Polymorphism allows us to _____________.

a) have the same message execute a different method depending on the receiving

object

b) hide the internal workings of a Java program from the client programmer

c) overload methods and allow the same method name to be used multiple times

d) extend and modify code

2) How would the three classes, Undergraduate, Graduate, and Student interrelate if we are

determined to use inheritance in the class definitions?

a) Student would be a subclass of Undergraduate, which would be a subclass of

Graduate.

b) Graduate would be a subclass of Undergraduate, which would be a subclass of

Student.

c) Graduate would be a subclass of Student, and Undergraduate would be a subclass of

Graduate.

d) Undergraduate and Graduate would both be subclasses of Student.

3) When an array is passed to a method ________________.

a) only the reference is passed, and a copy of the array is not created in the method.

b) a copy of the array is created within the method.

c) the value of the array is passed into the method.

d) None of the above.

4) A(n) ______________ has a method prototype but no body.

a) default constructor

b) default method

c) concrete method

d) abstract method

Section A (20 Marks) Attempt all 10 questions Mark your answers on the MCQ sheet provided

Question 2

Review the following application and explain the purpose of the application and how it works. Explain in detail, the purpose of each the classes and the workings of their methods, using the line numbers for reference.

1 class Person { 2 private String name; 3 4 private int age; 5 6 private char gender; 7 8 public Person() { 9 this ("Not Given", 0, 'U'); 10 } 11 12 public Person(String name, int age, char gender) { 13 this .age = age; 14 this .name = name; 15 this .gender = gender; 16 } 17 18 public int getAge( ) { 19 return age; 20 } 21 22 public char getGender( ) { 23 return gender; 24 } 25 26 public String getName( ) { 27 return name; 28 } 29 30 public void setAge( int age ) { 31 this .age = age; 32 } 33 34 public void setGender( char gender ) { 35 this .gender = gender; 36 } 37 38 public void setName( String name ) { 39 this .name = name; 40 } 41 42 } 43 44 45

Section B (80 Marks) Answer Any TWO Questions

47 class AddressBook { 48 49 private static final int DEFAULT_SIZE = 25; 50 51 private static final int NOT_FOUND = -1; 52 53 private Person[] entry; 54 55 private int count; 56 57 public AddressBook( ) { 58 this ( DEFAULT_SIZE ); 59 } 60 61 public AddressBook( int size ){ 62 if (size <= 0 ) { 63 throw new IllegalArgumentException("Size must be positive."); 64 } 65 66 entry = new Person[size]; 67 68 } 69 70 public void add( Person newPerson ) { 71 72 assert count >= 0 && count <= entry.length; 73 74 if (count == entry.length) { 75 enlarge( ); 76 } 77 78 entry[count] = newPerson; 79 count++; 80 } 81 82 public boolean delete( String searchName ) 83 { 84 boolean status; 85 int loc; 86 87 loc = findIndex( searchName ); 88 89 if (loc == NOT_FOUND) { 90 status = false ; 91 } else { 92 93 entry[loc] = entry[count-1]; 94 95 status = true ; 96 count--; 97 98 assert count >= 0 && count <= entry.length; 99 } 100 101 return status; 102 } 103

160 class TestAddressBook { 161 162 AddressBook myBook; 163 Person person; 164 165 public static void main ( String[] args ) { 166 TestAddressBook tester = new TestAddressBook(); 167 tester.setupArray( 5 ); 168 tester.testDelete( ); 169 } 170 171 public void setupArray( int N ) { 172 myBook = new AddressBook( N ); 173 174 for ( int i = 0; i < N; i++) { 175 person = new Person( "Ms. X" + i, 10, 'F' ); 176 myBook.add( person ); 177 } 178 } 179 180 public void testDelete( ) { 181 182 person = myBook.search( "Ms. X2" ); 183 184 if ( person == null ) { 185 System.out.println("Error: Didn’t find the person it should" ); 186 } else { 187 System.out.println(person.getName()+" is found okay." ); 188 189 boolean success = myBook.delete("Ms. X2" ); 190 191 if ( success ) { 192 193 person = myBook.search( "Ms. X2" ); 194 195 if (person == null ) { 196 197 System.out.println( "Okay: Deletion works" ); 198 } else { 199 200 System.out.println( "Error: Person is still there" ); 201 } 202 } else { 203 204 System.out.println( "Error: Deletion has a problem" ); 205 } 206 } 207 } 208 } 209

(Marks 40)

Question 3.

i. Describe using examples the concept of Polymorophism.

(Marks 10)

ii. Write a program that accepts the unit of weight of a bag of coffee in pounds and the number of bags sold and display the total price of the sale, compute as follows:

totalPrice = bagWeight * numberOfBags * pricePerLb; totalPriceWithTax = totalPrice + totalPrice * taxRate;

Display the results in the following manner:

Number of bags sold: 25 Weight per bag: 5 Price per pound: €5. Sales tax: 10.0%

Total price: € 763.

Define and use a programmer-defined CoffeeBag class. Include class constants for the price per pound and tax rate with the value of €5.55 per pound and 10% respectively

(Marks 30)

Question 4.

i. Java interface and inheritance are language features used to support object-oriented

modelling –

Discuss the above statement and compare and contrast the Java Interface with

inheritance as it relates to Java, using examples where appropriate.

(Marks 20)

ii. Describe each of the following concepts as they relate to Java, using examples to

illustrate your answers.

a) Abstract superclass

b) Abstract method

c) implemented method

d) Inherited Visibility modifiers

(Marks 20)