Programming 3B Exam Final
Programming 3B Exam Final
SUBJECT PROGRAMMING 3B
SUBJECT CODE PRG320
TEST/EXAM EXAMINATION
SEMESTER 2ND
DATE WRITTEN 24 November 2023
REQUIREMENTS:
Learner Requirements: Stationery and Examination Book
Equipment Requirements: PC with Visual C# and MS Word
Create a folder on the desktop with your name, surname, module name (PRG320)
and assessment date.
E.g. John Smith, Prg320, 01-01-2016
Save all project folders into this folder.
Please copy all source code and take screenshots of running programs/interface and
paste into a word document. Save in your folder.
1
ASSESSMENT RULES AND REGULATIONS
Please ensure that you have read and fully understand the following assessment rules and regulations
prior to commencing with your assessment:
3
Section A [20 Marks]
1.1. Overloading
1.2. Instance variables
1.3. Property
1.4. Contextual keywords
1.5. Interface
1.6. Inheritance
1.7. Implicit reference conversion
1.8. Exception handling
1.9. Serialization
1.10. Structured Query Language
Section B [50 Marks]
Short Questions
2.1. Provide the instantiation of an object from the class Employee that uses the default
constructor. (2)
2.2. Write in full the set of statements/implementation that the given auto implemented
property would have automatically created. (12)
2.3. Draw a class diagram that shows how the Commission Employee class
with the field commission Rate inherits from the Employee class with the
fields empnum,
empSal and a method GetGreeting() (10)
Question 3 (10 Marks)
6
Question 4 (16 Marks)
Write a console application that would request a number from the user.
If a negative value is entered then throw an exception, set the square root value to zero
and display an appropriate message.
7
Section C [70 Marks]
Practical
a. When the user types a file name or directory into the txtInput textbox and clicks the Display
Details button, the code should do the following:
First verifies the existence of the given file, if it exists, loads the content of the file into the
multiline textbox. It should add information on Creation time, when last modified, and when last
the file was accessed.
If the file name does not exist, the code should use appropriate try and catch syntax to take
care of the situation. The code should test if the given name is a Directory and do the same
thing as in the file case, print the added details as in the file case above. (10)
b. The user may wish to load a textfile but without any other details like creation dates and
items attached to it:
When the user types in a file name, with its directory into the txtInput, and clicks on
button ReadLines, the code should load into the output box, the textfile only. (10)
[10 marks]
c. The button clear when clicked should clear all the textboxes. (5)
d. The user may wish to create a textfile by typing desired content into the output box: When the
user types in a file name with its directory into the txtInput and clicks on button WriteFile, the
program should create the text file and save it in the provided directory. (10)
e. The user may wish to create a text file containing information captured as Name, surname and
Deposit. This should happen when the user clicks on the button WriteToFile. (10)
The program should save the above given
information, in a file name and directory, typed
into the txtInput.
f. The button Exit should close the program when clicked. (5)
Create a console application that contains an array of 12 strings. Prompt the user to
enter a minimum string length, and use LINQ statements to display all the strings that
are at least as long as the value entered by the user. If no strings meet the criterion,
display an appropriate message.