You are on page 1of 4

TCC238/05 –Structured Programming

TCC238/03 – Structured Programming

JANUARY 2024

COURSE ASSESSMENT (CA)


ASSIGNMENT 1

Instructions:

1. The total marks for Assignment 1 is 100 and contributes 50% to the total grade.
2. Assignment 1 covers the topics in Unit 1 and Unit 2.
3. Submit your Assignment to the Online Assignment Submission system. Submission
of assignments in hard copy will not be accepted. Marks will be awarded for quality
content and presentation.
4. Times New Roman 12 pt font should be used for all writing. Answer all questions in
English.
5. Students would be required to attach the CA Declaration form as the front cover of
their Assignment. No duplication of work will be tolerated. Any plagiarism or
collusion may result in disciplinary action to all parties involved.
6. Please check WawasanLearn for submission deadline.

1
TCC238/05 –Structured Programming

Guidelines for Assignment 1:

1. Compile and test all codes before submitting to ensure that they are error free.
2. Provide the necessary comments in your source codes.
3. Include both codes and sample outputs (e.g. screen shots) in your answer script, i.e.
Word document. Additionally, attach also the original source codes (e.g. *.cfiles) in
the final zipped file for submission.
4. Note the differences between the codes for a complete C program and C function:
• C program comprises all codes needed for compilation and execution of a
runnable system. A complete C program can include multiple functions and
function calls. Modularity makes the entire program more readable and easier to
debug. You should always strive to modularize your codes.
• A C function on the other hand is limited to the implementation of
procedure/method performing a specific task.
5. Hence, read each question's requirements properly in order to avoid losing marks
unnecessarily.

2
TCC238/05 –Structured Programming

Question 1 [60 marks]

a) Flowchart plays a major role in communicating programming (solution) details to


the client. It is a symbolic form of a solution, which will be implemented in the form
of a computer program.

Design a flowchart for a selection structure to help in the communication between


the system analyst and programmer based on the given pseudocode below:

Get up from bed


While awake is not true
drink coffee
Endwhile
If temperature < 20 is true then
wear coat
else
wear shirt
Endif
If hungry is true then
take breakfast
Endif
While have keys is not true
search for keys
Endwhile
[25 marks]

b) Write a C program to categorize the grades of oranges based on the table given
below:

• Get the input weight.


• Categorize the grades of oranges with if…else statements.
• Use printf() to display the grade.
[25 marks]

c) What are the primary differences between symbolic and high-level languages?
[10 marks]

3
TCC238/05 –Structured Programming

Question 2 [40 marks]

a) Write a program that generates a random number from the following set:

1, 4, 7, 10, 13, 16
[15 marks]

b) Write a function to print your name, as shown below. Write a call as it would be
coded in a calling function, such as main.

[15 marks]

c) Write a function that receives a positive floating-point number and rounds it to two
decimal places. For example, 127.565031 rounds to 127.570000. Print the rounder
numbers to six decimal places.
[10 marks]

You might also like