FIRST YEAR SECOND SEMESTER SUPPLEMENTARY/SPECIAL EXAMINATION
FOR THE CERTIFICATE IN INFORMATION TECHNOLOGY
CIT 1202: STRUCTURED PROGRAMMING
DATE: JANUARY 2021 TIME: 11/2 HOURS
INSTRUCTIONS: Answer question one and any other two questions
QUESTION ONE (30 MARKS)
a) Identify any three examples of computer hardware (3 marks)
b) Programs store data temporarily in main memory. Define the term memory cell (2 marks) c) In memory a computer can either store a value or retrieve it. Distinguish between storing and retrieving values in computer memory (2 marks) d) Identify an discuss the two types of computer memory (4 marks) e) Secondary storage play an important role in computer systems. Identify two reasons why secondary storage is required (2 marks) f) Differentiate between computer hardware and software (2 marks) g) Identify any two roles played by the central processing unit (2 marks) h) Identify any four characteristics of a good algorithm (2 marks) i) C is a structured programming language. Explain why (2 marks) j) Discuss the role played by a C compiler (2 marks) k) A compiler is a translator. Distinguish between a compiler and an interpreter(4 marks) l) Part of the syntax of a C program is the pre-processor directives. Identify the role the pre-processor directives play in C (1 mark) m) The printf() function is defined in the standard input output library. What is the role of the printf() function (1 mark)
Meru University of Science & Technology is ISO 9001:2015 Certified
Foundation of Innovations Page 1 n) The semi colon is important when declaring variables and statements. What role does a semi colon play in a variable declaration (1 mark)
QUESTION TWO (15 MARKS)
a) C language contains reserved words. Briefly describe your understanding of reserved
words (2 marks) b) Identify any 5 reserved words in C (5 marks) c) Describe the two types of identifiers in C (4 marks) d) Identify any four identifier naming rules in C (4 marks)
QUESTION THREE (15 MARKS)
a) You are an IT technician in a health clinic. You have been asked to write a sample C program that would help the doctor capture some data about a patient. Ensure your program captures data pertaining to: patient’s name, age, eye colour, weight , skin colour and hair colour (6 marks) b) Write a program in C that stores marks for 5 students in an array. The program should contain a function that calculates the sum and average of the marks in the array (6 marks) c) The following is a C variable declaration statement. Write a pointer to the variable int studentMark=30 (1 mark) d) Identify any two data types in C (2 marks)
QUESTION FOUR (15 MARKS)
a) Discuss any three common programming errors (6 marks) b) Assuming you are an examination officer at your school, write a C program that receives a number between 0 and 100 and displays on the screen the grade for that number (6 marks) c) Identify the role of the scanf() function in C d) At the weighing office in a coffee factory, farmers, farmers bring their produce in bags. Having been newly hired as a programmer, identify the appropriate datatypes you
Meru University of Science & Technology is ISO 9001:2015 Certified
Foundation of Innovations Page 2 would use to represent each of the followed: bags of maize each farmer has brought; total weight of coffee each farmer has brought (2 marks)
QUESTION FIVE (15 MARKS)
a) Identify any two type of functions in C (4 marks) b) Write a brief C program that opens a file called”programming.txt” (4 marks) c) Briefly illustrate the structure of a for loop in C (2 marks) d) The table below represents litres of milk a farmer sells each day Day Litres 1 34 2 50 3 45 4 40 Being a programmer, write a program in C that calculates the average litres sold by the farmer for the four days (4 marks) e) In your own understanding, illustrate the application of the break keyword (1 mark)
Meru University of Science & Technology is ISO 9001:2015 Certified
F 5519 (Pages: 2) No Name .. M.C.A (Affiliatede Colleges) Degree Examination, February 2006 First Semester Problem Solving and Computer Programming in "C"