0% found this document useful (0 votes)
13 views5 pages

B6IT017 Principles of Programming December 2013

Uploaded by

bob.ilukhor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views5 pages

B6IT017 Principles of Programming December 2013

Uploaded by

bob.ilukhor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

QQI

Principles of Programming

Momentum

Module Description: Principles of Programming

Examiner: Mr Damien Kettle

Internal Moderator: Mr Rory O’ Donnell

Date: Thursday 19th December 2013


Time: 14:30 – 16:30

INSTRUCTIONS TO CANDIDATES:

Time allowed is 2 hours.

Answer THREE questions:


 Question 1 in Section A is Compulsory
 One Question from Section B
 One Question from Section C.

Write your answers to Question 1 in the examination booklet.


The other two questions must be completed using Visual Studio
and uploaded to Moodle
Section A –
Write your answers to Question 1 in the examination booklet
supplied.

Question 1 – Compulsory – 30 Marks

a) For each of the following kinds of data, define the most suitable and meaningful variable
definition to represent the data in a C# program.

(i) The number of students in a class.

(ii) A letter of the alphabet.

(iii) The average mark in an examination, including the decimal part.

(iv) The name of a student.

(2 marks)

b) Briefly explain the terms compile, link, syntax error and run-time error.
(4 marks)

c) Using an example, explain what a switch statement does.

(4 marks)

d) C# has three logical operators:


(i) !
(ii) ||
(iii) &&
Using examples, explain what each of these operators is used for.

(6 marks)

e) Using examples, explain what the pre and post increment operators do.

(4 marks)

f) When a C# method is called, the parameters can be passed by value or passed by


reference. Explain the difference between these. Use examples in your answer.
(6 marks)

g) What is a type-casting? Use an example in your answer.

(4 marks)
Section B – Answer One Question From This Section.
The answer to either question must be completed using Visual Studio and
uploaded to Moodle

Question 2 - 35 Marks

Write a C# program which collects all the Players from a football league. The user of the
program should be asked how many Players they wish to record. The user must enter goals
scored for each player.

Once all results are entered display a table of the results.


The first column should show the Player as entered, the second column should show the goals
scored.
On a new line show the following;
 The highest number of goals scored by Player Name
(35 marks)

Question 3 - 35 Marks

Write a foreign exchange C# program which allows a user to convert from Euro to a selected
alternative currency. The user should be first presented with a menu which indicates the options
available to the user.

The user must be able to convert to US Dollars, British Pounds, Australian Dollars and
Canadian Dollars. Once the user selects which exchange rate they wish to use, they must then be
asked for the amount they wish to exchange in euro.

Once the result is presented with the results they should be asked if they would like to quit the
program or return to the main menu.

Use the following exchange rates (1 euro is worth):


 US Dollar: $1.30
 British Pounds: £0.80
 Australian Dollar: AU$1.29
 Canadian Dollar: C$1.65

(35 marks)
Section C – Answer One Question From This Section.
The answer to either question must be completed using Visual Studio and
uploaded to Moodle

Question 4 - 35 Marks

Write a C# GUI program the converts a


temperature in Fahrenheit to the equivalent
temperature in Celsius and also converts a
temperature in Celsius to the equivalent
temperature in Fahrenheit.
The GUI required consists of a textbox, three
buttons and a label.

The user enters the temperature in the textbox at the top of the form, selects a button and the
equivalent temperature is displayed in the label at the bottom of the form.

To convert a temperature in Celsius to Fahrenheit use the formula:

F = 9.0 * C / 5.0 + 32.0

To convert a temperature in Fahrenheit to Celsius use the formula:

C = 5.0/9.0*( F -32.0)

Examples:

A message box is displayed if a non-numeric temperature value is entered.

Comment your program.

Save the Visual Studio project as Q4. (35 marks)


Question 5 – 35 Marks

Create the following in C#

The user enters the amount to be converted in the textbox at the top of the form, selects one of
the buttons and the conversion is displayed in the label at the bottom of the form.

To convert
 Miles to Kilometres use the formula: 1.609
 Pounds to Kilos use the formula: 0.453

 A Error message box is displayed if a non-numeric weight value is entered.

Comment your program.

Save the Visual Studio project as Q5.

(35 marks)

END OF EXAMINATION

You might also like