CPT109 C Programming and Software Engineering 1 – ASSESSMENT 1
Assessment Number 1
Contribution to Overall Marks 15%
Issue Date Monday, 11th October 2021 (Week 5)
Submission Deadline Monday, 25th October 2021, 00:01 (Week 7)
Assessment Overview
This assessment aims at testing some basic concepts of C programming and initiates the
routine of code development using the software development process (SDP). There are 3
exercises, for exercise 1 and 2 only your code needs to be submitted. For exercise 3 you must
submit code and your SDP report. The SDP was presented in Lecture 1 you should only focus
on the first five steps:
1. Problem statement: formulate the problem.
2. Analysis: determine the inputs, outputs, variables, etc
3. Design: define the list of steps (the algorithm) needed to solve the problem.
4. Implementation: the C code has to be submitted as a separate file (.c).
Just indicate here the name of the file. DO NOT paste your code into your report.
5. Testing: explain how you have tested and verified your C program.
Things to note:
1. Submit only what is required by each question.
2. Include clear comments in your code to make it easy to understand.
3. Use the C90 standard.
4. ALL programs MUST compile and run in Visual Studio 2013.
Exercise 1 (20%)
Write a C program that can perform the following:
• Read a full name with spaces from the keyboard:
• Remove all white space (space ‘ ‘, enter ‘\n’ or tab ‘\t’) from the string.
• Determine the length of the string excluding white space and print the length and the string
on the screen.
• Change all characters in the string to UPPERCASE.
• Print the string on the screen in reverse (DO NOT reverse the characters in the array).
• Add and subtract alternate ASCII values of each character and print the result on the
screen.
Example
input is: Jet Li
output is:
The string has 5 characters not including spaces: JetLi
The string printed in reverse is: ILTEJ
74 – 69 + 84 – 76 + 73 = 86
Submit ONLY your .c file named: studentID_E1.c
Exercise 2 (20%)
Write a C program that can perform the following:
• Read an 8-bit binary number from the keyboard.
• Convert the binary to its decimal equivalent.
• Convert the binary to its hexadecimal equivalent.
Example:
input is: 11010100
output is:
The binary value 11010100 is 212 in decimal
The binary value 11010100 is D4 in hexadecimal
Submit ONLY your .c file named: studentID_E2.c
Exercise 3 (60%)
Write a C program that can perform the following:
• Read 5 real numbers from the keyboard between 0 and 10, but not 0.
• Calculate the following: Average, Standard Deviation (expressions below).
• Display the results of each calculation on the screen rounded to 2 decimal places.
• Sort the values in the array in ascending order (small to large).
• Display the sorted array.
Example:
input is: 1.2 7.65 9 5.3421 8.88888
output is:
The average value is: 6.42
The standard deviation is: 2.92
The sorted array is: 1.2
5.3421
7.65
Submission:
Submit your .c file named: studentID_E3.c 20%
Submit your SDP report named: studentID_ E3.pdf 40%
Marking Exercises 1 and 2
Implementation (90%) – how well your code meets the problem requirements
Robustness (10%) – how well your code can adapt to situations.
Marking Exercise 3
Quality of Report 10%
Specification 10%
Analysis 10%
Algorithm Design 10%
Implementation 40%
Robustness 10%
Testing 10%
Please refer to the file “CPT109 Marking Guidelines for Assignment 1” on Learning
Mall for details on marking for these two items.
How the work should be submitted?
Should be submitted electronically through the Learning Mall Online (LMO). Feedback and
your grade will also be given through LMO.
You submission should be a single zip file containing 4 files:
1234567_E1.c
1234567_E2.c
1234567_E3.c
1234567_E3.pdf
1234567_A1.zip
Important notes:
University late submission policy will be applied.
University Academic Integrity policy will be applied rigorously. Note that plagiarism and
collusion will not be tolerated.
You can find information relating to both of these in ebridge.