Java Programming & Data Structures Exam: Higher Cert. in Computing in IT, Exams of Software Development Methodologies

A past exam for the higher certificate in science in computing in information technology program at the cork institute of technology. The exam covers topics such as java programming, software development, linked lists, binary trees, and file input/output. It includes four questions with code examples and diagrams, and students are required to write java code, draw diagrams, and modify existing code. The exam also includes an appendix with code snippets for mylinkedlist, treenode, and student classes.

Typology: Exams

2012/2013

Uploaded on 03/25/2013

digvijay
digvijay 🇮🇳

4.4

(17)

185 documents

1 / 8

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Cork Institute of Technology
Higher Certificate in Science in Computing in Information Technology
Support – Award
(NFQ Level 6)
Spring 2007
Software Development
(Time: 2½ Hours)
Instructions: Examiners: Mr. Jim Doyle
Answer question 1 and any two others. Mr. J. Greenslade
Mr. J. Walsh
pf3
pf4
pf5
pf8

Partial preview of the text

Download Java Programming & Data Structures Exam: Higher Cert. in Computing in IT and more Exams Software Development Methodologies in PDF only on Docsity!

Cork Institute of Technology

Higher Certificate in Science in Computing in Information Technology

Support – Award

(NFQ Level 6)

Spring 2007

Software Development

(Time: 2½ Hours)

Instructions: Examiners: Mr. Jim Doyle Answer question 1 and any two others. Mr. J. Greenslade Mr. J. Walsh

  1. A company pays their sales staff a basic pay of €200 per week plus a commission of 4 % of their sales for that week. E.g. if a salesperson sold of goods in a week, their salary would be €400 ( €200 base pay and commission ).

a) Write a Java program that accepts the sales of each employee in turn and displays the salary for that individual.

The Program should stop when -1 is input for sales.

Use any method of input and output you like. You do not have to cater for the case where a user does not enter data correctly.

(25 marks)

b) Modify the program in part ( a) so that it prints the average sales for the entire sales force. That is the total of all sales divided by the number of sales that were input. Use an if-statement to avoid division by zero.

(5 marks)

a) Each Node in a binary tree can be thought of as a sub tree.

Using the TreeNode code in APPENDIX II, write the recursive method, insert(int d).

( 15 marks )

b) If an object implements Comparable then it can be sorted in any java.util.Collection.

Modify the Student code in APPENDIX III so that it implements Comparable or Comparable.

Student s should be compared by their mark s.

( 10 marks )

c) Modify the TreeNode code from APPENDIX II including the code from part (a) of this question so that the tree will hold Students from part (b).

( 10 marks )

a) If ReadList is a class with two attributes:-

public static int size = 100; public Integer[] array = new Integer[size]; ,

Write Java code for the ReadList class, that reads Integers from the file “MyList” and stores them in array.

You may assume that the array is full of zeros to start with and that there are less than 100 Integers in the file. I.e. when reading from the file, you need to check that the data is read but not that the array is out of bounds.

Show all the code required from declaring the InputStreams up to closing the file.

( 20 marks )

b) Write a method for class ReadList in part (a) that sorts array in ascending order.

( 15 marks )

APPENDIX II

class TreeNode { int data;

TreeNode left; TreeNode right;

public TreeNode( int d) { data = d; left = null ; right = null ; }

public TreeNode() { data = 0; }

public void insert( int d) …

}

APPENDIX III

class Student { private int mark; private String name;

//constructor public Student(String n, int m) { mark = m; name = n; }

public void setMark(int m) { mark = m; } public void setName(String n) { name = n; } public int getMark() { return mark; } public String getName() { return name; }

}