You are on page 1of 5

Bachelor of Computer Science

PROCEDURAL PROGRAMMING IN C
ASSIGNMENT BRIEF
October 2022

Lecturer: Mohamed Shihab


ASSIGNMENT BRIEF

Programme Title Bachelor of Computer Science


Module Procedural Programming in C
Lecturer Mohamed Shihab
Issue Date 06-10-2022

Hand In date:

Total Marks 100


Total Weightage 50

Task: 1 question (70 Marks)


1. A number is called an Armstrong number if the sum of the cubes of the digits of the
number is equal to the number. For example, 153 = 1^3 + 5^3 + 3^3. Write a C
program that asks the user to enter a number and returns if it is Armstrong or not
(use function). (5 Marks)

2. Write a C program to sort an array of integers using bubble sort. (5 Marks)

3. Write a C program to input n numbers in an array, calculate the sum of all even
numbers and all odd numbers in the array and print the larger sum. (5 Marks)
Example:
If the array contains the following elements:
2, 3, 3, 5, 4, 8, 7, 11, 2
The sum of all even elements is 2+4+8+2=16
Sum of all odd elements is 3+3+5+7+11=29
Therefore, the output should be 29.

4. Describe the difference between the literal values 7, "7", and ’7’. (5 Marks)

5. Determine the size,minimum and maximum value following data types. Please
specify if your machine is 32 bit or 64 bits in the answer. (5 Marks)
 char
 unsigned char
 short
 int
 unsigned int
 unsigned long
 float
Hint: Use sizeof() operator,limits.h and float.h header files

6. Write logical expressions that tests whether a given character variable c is


 lower case letter
 upper case letter
 digit
 white space (includes space, tab, new line)
(5 Marks)
7. Let the nodes in the list have the following structure
struct node
{
int data ;
struct node∗ next ;
};
a. Write the function void display(struct node∗ head) that displays all the elements
of the list (10 Marks)

b. Write the function struct node∗ addback(struct node∗ head,int data) that adds an
element to the end of the list. The function should return the new head node to
the list. (10 Marks)

c. Write the function struct node∗ find(struct node∗ head,int data) that returns a
pointer to the element in the list having the given data. The function should
return NULL if the item does not exist. (10 Marks)

d. Write the function struct node∗ delnode(struct node∗ head,struct node∗


cliquecollege) that deletes the element pointed to by cliquecollege (obtained
using find). The function should return the updated head node. (10 Marks)

All the code and sample outputs should be submitted.

Email: Upload assignment to Moodle and email softcopy of Assignment to:


mshihaab@gmail.com before Due Date.

Task: 2 Viva (30 Marks)

Students are required to demonstrate the workings of the Task 1 and provide answers
to the questions asked.
Assignments and/or Reports Instructions

Students should use the following font for their assignments:


 Times New Roman.
 Font Size 12.
 1.5 Line Spacing.

Assignments must contain a footnote with:


 The Student Name.
 The Student NID Number.
 Module Name
 The Page Number.

The marks allocated for the report is 100 (50%).

The assignment is worth 50% of your final course grade.

Each assignment must have a front cover which must include the student's full name, NID
number, title of the assignment and module name.

Students are required to submit an electronic copy (PDF) of the assignment to Moodle before
23:59 hrs on the due date.

References must be given in Harvard referencing style.

Plagiarism in any form is prohibited. Plagiarised materials will not be accepted and no marks
will be awarded for the work.

All assignments files must be saved in the following file name order: abbreviated unit title
and student number - for example: BIS Mariyam Ali

It is the responsibility of the student to ensure that the assignments are submitted by the
deadline set by the lecturer.

If an extension is required, it should be communicated with the lecturer and approved by the
Course Coordinator. Appropriate evidence or reason should be provided to justify the cause
for the extension. A student can request for an extension 3 (three) days before the assignment
deadline. The request for extension of assignment deadline should be made in writing
(letter/email) and addressed to the Course Coordinator. 

Assignment received after the submission deadline will be penalized as follows;


 5% penalty for each day after the submission deadline
 After the 4th week – the student will not be permitted to submit the
assignment
Rubrics
Unsatisfactory Satisfactory Good Excellent
Requirements  Completed less than 70% of  Completed between 70- 80% of  Completed between 80-90%  Completed between 90-100%
and Delivery the requirements. the requirements. of the requirements. of the requirements.
 Delivered on time but not in  Delivered on time, and in  Delivered on time, and in  Delivered on time, and in
correct format correct format. correct format. correct format
Coding Standards  No name, date, or assignment  Includes name, date, and  Includes name, date, and  Includes name, date, and
title included assignment title. assignment title. assignment title.
 Poor use of white space  White space makes program  Good use of white space.  Excellent use of white space.
(indentation, blank lines). fairly easy to read.  Organized work.  Creatively organized work.
 Disorganized and messy  Organized work.  Good use of variables (no  Excellent use of variables (no
 Poor use of variables (many  Good use of variables (few global variables, global variables, unambiguous
global variables, ambiguous global variables, unambiguous unambiguous naming) naming).
naming). naming).
Documentation  Very limited or no  Basic documentation has been  Clearly documented  Clearly and effectively
documentation included. completed including including descriptions of all documented including
 Documentation does not help descriptions of all class class variables. descriptions of all class variables.
the reader understand the variables.  Specific purpose is noted for  Specific purpose noted for each
code  Purpose is noted for each each function and control function, control structure, input
function. structure. requirements, and output results.
Runtime  Does not execute due to  Executes without errors.  Executes without errors.  Executes without errors excellent
errors.  User prompts contain little  User prompts are user prompts, good use of
 User prompts are misleading or information, poor design. understandable, minimum symbols, spacing in output.
non-existent.  Some testing or input use of symbols or spacing in  Thorough and organized testing
 No testing has been validation has been completed. output. or input validation has been
completed, or no input  Most testing or input completed
validation. validation completed

You might also like