Charles Darwin University
-22098038608000
Charles Darwin University
Final Examination
Family Name Given Name/s Student Number Teaching Period Semester 2, 2019
HIT137 Software Now DURATION
Reading Time: 10 minutes
Writing Time: 180 minutes
INSTRUCTIONS TO CANDIDATES
This question paper contains only one section and you must answer all questions.
EXAM CONDITIONS
You may begin writing from the commencement of the examination session. The reading time indicated above is provided as a guide only.
This is a RESTRICTED OPEN BOOK examination
No calculators are permitted
One A4 sheet of handwritten single-sided notes permitted
No dictionaries are permitted
ADDITIONAL AUTHORISED MATERIALS EXAMINATION MATERIALS TO BE SUPPLIED
No additional printed material is permitted
1 x 20 Page Book
THIS EXAMINATION IS PRINTED
DOUBLE-SIDED.
THIS PAGE HAS BEEN INTENTIONALLY
LEFT BLANK.
Section A
Answer all questions.
Total No of Marks for this Section: 100
This section should be answered on the Answer Sheet provided. Please ensure that your name and student number have been written on the Answer sheet and placed in the completed Answer Booklet.
Marks for each question are indicated. Suggested time allocation for Section A: 180 mins
Question 1
Write a program that accepts the users name (as text) and age (as a number) as input. The program should output a sentence containing the users name and age.
(05 Marks)
Question 2
Write a python program that can compute the Fibonacci sequence of a given number from the user. The results should be printed in a comma-separated sequence on a single line.
Input number: 6
Output: 0, 1, 1, 2, 3, 5
(05 Marks)
Question 3
Define a python class that receives a series of numbers from the user and allows the user to press the q key to indicate that he or she is finished providing inputs. After the user presses the q key, the program should call another python class to print the sum of the numbers and their average.
(10 Marks)
Question 4
Write a program that accepts a range of input from the user and checks whether the input data is sorted or not. If the data series is already sorted your program should print True or should print False otherwise.
You should not use any sort function for this program.
Input:
How many numbers you want to input: 3 # user input 3
Input the number: 5
Input the number: 2
Input the number: 7
Output:
False
(10 Marks)
Question 5
Write a script named copyfile.py. This script should prompt the user for the names of two text files. The contents of the first file should be input and written to the second file.
(10 Marks)
Question 6
Define a function that receives one alphanumeric word as a string and compute the sum of the numeric values placed in the word and print it in the console.
(10 Marks)
Question 7
A file concordance tracks the unique words in a file and their frequencies. Write a program that displays a concordance for a file. The program should output the unique words and their frequencies in alphabetical order.
(10 Marks)
Question 8
Write a simple student status program using python that has four options:
1. View Student Contact (email and telephone)
2. View enrolment status (enrolled / not enrolled)
3. View Student Grade
4. Quit.
You must implement classes and object for this program.
(10 Marks)
Question 9
Define a function drawCircle. The function should expect a Turtle object, the coordinates of the circles center point, and the circles radius as arguments and finally the function should draw the specified circle.
(10 Marks)
Question 10
Given an array of data:
array1
15 50 5 21 1 12
Write the code for the bubble sort to sort the data and draw a table showing how the data is sorted using bubble sort.
Write the code for Binary search algorithm to find the value 15 from the sorted array. Draw the tree diagram showing the binary search of the list.
(20 Marks)
-22098038608000
Charles Darwin University
Final Examination
Family Name Given Name/s Student Number Teaching Period Summer Semester, 2020
HIT137 Software Now DURATION
Reading Time: 20 minutes
Writing Time: 120 minutes
Scanning and uploading: 20 minutes
INSTRUCTIONS TO CANDIDATES
Notes: (example)
1.Read all questions carefully.
2.Answer all questions.
3.Total marks available on this test are 50.
4.Questions are (not) of equal value.
5.Open book exam.
6. Use the same template file you used in Assignment 1 to write your answers.
BACKUP OPTION:
Go to Ubuntu Pastebin (https://pastebin.ubuntu.com/)
Create title as your name and student number Paste your whole code there
Copy the link and send in your lecturers email.
EXAM CONDITIONS
You may begin writing from the commencement of the examination session. The reading time indicated above is provided as a guide only. Please make sure that you submit your work on time.
This is an OPEN BOOK examination
Question 1
Assume Str is a String.
Create your own string (Str), where "length" of the string should be 18.
(The string should be in the form of Str = "ui683ji095ytrd79687df675")
Write a program to print the substring of numbers (n). After printing the substring (n), "sort" them in descending order (d). Then subtract (d-s).
Example:
If Str = qwe598jhk90
substring (n)= 59890
descending order (d)=99850
subtract (d-n)=99850-59890=39960
("Note: You have to create your own method to sort the substring.
(Marks: 10)
Question 2
Encrypted Message = Decrypted Message = Python
(Use "Unicode Table" from "https://cdn.img.onl/thomasorlita.cz/projects/unicode-table.jpg")or given below.
Write a program to showcase the "formula" used for encryption and decryption.
("Note 2: The program should have continuos flow (i.e., Calculate Average-Encrypt-Decrypt)"")
(Marks: 10)
Question 3
Write your initials (First characters of your Name) using turtle graphics. For example:
Name: Yuba Raj Panta
Initials: YP
(Only two letters are fine)
(Marks: 7)
Question 4
Write a program to create an empty "new file.txt" and store it on the same folder as your python file.
Ask the user to input the "name of file".
Ask the user to input some content into the file and "print the input after writing in the file". (Content should only have Upper Case letters)
Finally, replace the content in the file with "unused alphabets (A-Z)" and write into the file.
Example: If content in the file is "HELLO".
Replace it with "ABCDFGIJKMNPQRSTUVWXYZ"
(Marks: 10)
Question 5
Using Object Oriented Programming create a program that consists of 'Band', 'Album', 'Song', 'Genre'. You can create '4 separate classes' (or 'subclasses'). Program should follow the questions (a, b, c, d) below. Create at least 3 entries
a. Ask user to input a 'Song'. The output should be 'Band', 'Album' and 'Genre'.
b. Create a method, so that a new song can be added to the 'Album'. (Hint: Use List[]).
c. Add a new 'Song' to the 'Album'.
d. Ask user to input a 'Album'. The output should be the updated 'Album'.
(Marks: 13)
-22098038608000
Charles Darwin University
Final Examination
Family Name Given Name/s Student Number Teaching Period Semester 2, 2020
HIT137 Software Now DURATION
Reading Time: 15 minutes
Writing Time: 120 minutes
Scanning and uploading: 20 minutes
INSTRUCTIONS TO CANDIDATES
1.Read all questions carefully.
2.Answer all questions.
3.Total marks available on this test are 50.
4.Questions are of equal value.
5.Open book exam.
6. Submit your solution in one single .py file.
EXAM CONDITIONS
You may begin writing from the commencement of the examination session. The reading time indicated above is provided as a guide only. Please make sure that you submit your work on time.
This is an OPEN BOOK examination
Question 1
In the given text file HIT137cdu.txt, programmatically count the total number of phrases: You Make CDU and Great. You Make CDU and print it in the console.
(Marks: 10)
Question 2A file concordance tracks the unique words in a file and their frequencies. Write a program that displays a concordance for the given file HIT137cdu.txt. The program should output the unique words and their frequencies in alphabetical order.
(Marks: 10)
Question 3
Write your initials (First characters of your Name) using turtle graphics. For example:
Name: John Robinson Doe
Initials: JD
(Only two letters are fine)
Use function to draw individual letter
(Marks: 10)
Question 4
CDU is a world class university with multiple colleges focused to give quality education. All of the colleges have some similarity in terms of structure, properties and functionalities. Using the object-oriented programming concept, can you create College of Engineering, IT and Environment and list out the number of students, list of courses available, building address, and print it on the screen? You can choose number of students, list of courses and building address of your own.
Hint: Use the concept of class & object
(Marks: 10)
Question 5
Create a python window containing a grid of 2x2 buttons. In that window, place 4 buttons that has 4 different functionalities:
1. Button 1: Pressing Button 1 will print a random integer number.
2. Button 2: Pressing Button 2 will print a random float number
3. Button 3: Pressing Button 3 will print a random lowercase word containing a-z
4. Button 4: Pressing Button 4 will print a random uppercase word containing A-Z
Example window will look like:
Button 1 Button 2
Button 3 Button 4
(Marks: 10)
END OF EXAM