Docsity

Objects and Programming - Advanced Applications Programming - Exam, Exams of Applications of Computer Sciences

Toggle sidebar
bg1
!
Autumn Examinations 2010
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. Tom 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
2 hrs
Accountancy & Finance
Requirements:
MCQ
Yes, Type a-d
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download Objects and Programming - Advanced Applications Programming - Exam and more Exams Applications of Computer Sciences in PDF only on Docsity!

Autumn Examinations 2010

Exam Code(s) 1AE1, 1 MIS 1 , 1 MIS Exam(s) Masters of Business Studies in Electronic Commerce MSc. Information Systems Management full-time MSc. Information Systems Management part-time Module Code(s) MS8 15 Module(s) Advanced Application Programming Paper No. Repeat Paper External Examiner(s) Dr. Danail Ivanov Internal Examiner(s) Dr. Tom 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 2 hrs Department(s) Accountancy & Finance Course Co-ordinator(s) Requirements : MCQ Yes, Type a-d

Section A (20 Marks)

Attempt all 10 questions

Mark your answers on the MCQ sheet provided

1 ) What are the two most important concepts in object-oriented programming?

a) objects and programming

b) objects and orientation

c) objects and classes

d) objects and inheritance

2) What is the difference between programmer-defined classes and standard classes?

a) Programmer-defined classes are always written after standard classes.

b) Programmer-defined classes can be named anything the user chooses, while

standard classes have strict formatting regulations.

c) Programmer-defined classes are written by the programmer, while standard

classes are built into Java.

d) Programmer-defined classes are written by the programmer, while standard

classes are created automatically after compilation.

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) We are writing a program to model the behavior of a car. Which of the following is a

valid candidate to be represented with a constant as opposed to a variable?

a) The level of fuel in the gas tank.

b) The maximum speed that the speedometer can read.

c) The number represented by the carโ€™s odometer.

d) The number of miles to the next oil change.

9) Which of the following is not a Boolean operator?

a) &&

b)!

c) ||

d) ++

  1. What is the difference between the Error class and the Exception class? a) There are no differences between the two classes. b) Error classes represent a different set of problems that should be caught than Exception classes do. c) Error classes represent serious problems that should not be caught, while Exceptions represent problems that should be caught. d) Error classes represent problems that should be caught, while Exceptions represent problems that should not be caught. (20 MARKS)

Section B (80 Marks)

Answer Any TWO Questions

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 import javax.swing.*; 2 3 class HiLo { 4 5 private final int MAX_GUESS_ALLOWED = 6; 6 7 private final int LOWER_BOUND = 1; 8 9 private final int UPPER_BOUND = 100; 10 11 private int secretNumber; 12 13 public HiLo( ) { 14 15 } 16 17 public static void main (String[] args) { 18 HiLo hiLo = new HiLo( ); 19 hiLo.start(); 20 } 21 22 public void start ( ) { 23 int answer; 24 25 answer = prompt("Do you want to play a Hi-Lo game?"); 26 27 while (answer == JOptionPane.YES_OPTION) { 28 29 generateSecretNumber( ); 30 31 playGame(); 32 33 answer = prompt("Do you want to play another Hi-Lo game?"); 34 } 35 } 36

93 JOptionPane.showMessageDialog(null, "You lost. Secret No. was " 94 + secretNumber); 95 } 96 } 97 98 private int prompt(String question) { 99 100 int reply; 101 102 reply = JOptionPane.showConfirmDialog(null, 103 question, 104 "Confirmmation", 105 JOptionPane.YES_NO_OPTION); 106 return reply; 107 } 108 109 } 110

(40 Marks)

Question 3

Part a)

Complete the first four constructors of the following class. Each of the four constructors

calls the fifth one by using the reserved word this.

class Cat {

private static final String DEFAULT_NAME = "No name";

private static final int DEFAULT_HGT = 6;

private static final double DEFAULT_WGT = 10.0;

private String name;

private int height;

private double weight;

public Cat( ) {

//assign defaults to all data members

public Cat(String name) {

//assign the passed name to the data member

//use defaults for height and weight

public Cat(String name, int height) {

//assign passed values to name and height

//use default for weight

public Cat(String name, double weight) {

//assign passed values to name and weight

//use default for height

public Cat(String name, int height, double weight){

this.name = name;

this.height = height;

this.weight = weight;

(10 Marks)

Continued ...