0% found this document useful (0 votes)
48 views3 pages

Introduction To Programming and Algorithms Dit 0202

Uploaded by

yvonnemoseti71
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views3 pages

Introduction To Programming and Algorithms Dit 0202

Uploaded by

yvonnemoseti71
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

MERU UNIVERSITY OF SCIENCE AND TECHNOLOGY

P.O. Box 972-60200 – Meru-Kenya.


Tel: 020-2069349, 061-2309217. 064-30320 Cell phone: +254 712524293, +254 789151411
Fax: 064-30321
Website: www.mucst.ac.ke Email: [email protected]

University Examinations 2014/2015

STAGE II EXAMINATIONS FOR DIPLOMA IN INFORMATION TECHNOLOGY

DIT 0202: INTRODUCTION TO PROGRAMMING AND ALGORITHMS

DATE: DECEMBER 2014 TIME: 1 HOURS

INSTRUCTIONS: Answer question one and any other two questions

QUESTION ONE (30 MARKS)

a) Define the following as used in C programming (4 marks)


(i) Keyword
(ii) Pseudo code
(iii) Function
(iv) Array

b) With reference to C programming differentiate between: (4 marks)


(i) Assembler and compiler
(ii) Library functions and user defined functions

c) (i) Write a C program to print your name on the computer screen (2 marks)
(ii) State two characteristics of C programming language (2 marks)

d) (i) Write a C program that accepts three numbers input by the user and computes their
sum and average (4 marks)

1
(ii)Draw a flowchart to represent the program code in d (i) above. (3 marks)

e) Write a C program to print the sum of all odd integer numbers between 1 to 50. Use for
loop. (5 marks)

f) (i) Describe two advantages of Assembly languages (4 marks)


(ii) State three rules of naming variables in C programming (3 marks)

QUESTION TWO (15 MARKS)

a) (i) Describe how you make comments in C program (1 mark)


(ii) Give three areas where C language is applied (3 marks)
(iii) Explain any three types of operators used in C programming. Give an example
in each type (6 marks)
b) Write a C program to accept two numbers input by the user and checks whether they are
equal or unequal. Use if......else statement (5 marks)

QUESTION THREE (15 MARKS)

a) Explain three methods used for testing a program for errors (6 marks)
b) Explain the difference between while and do...while loop statement. give the syntax for
each (5 marks)
c) (i) Give two advantages of using Pseudo code (1 mark)
(ii)Describe three components of an algorithm (3 marks)

QUESTION FOUR (15 MARKS)

a) Explain two categories of arrays (4 marks)


b) Write a C program to find the sum of the first 50 natural numbers. Use while...loop.
(6 marks)
c) State and explain the stages used in developing C program (5 marks)

2
QUESTION FIVE

a) (i) Write a C program that reads two numbers through the keyboard and determines if
both are even numbers. The numbers are added and the sum output if they are both even
otherwise they are multiplied and the product output. (6 marks)
(ii) Draw a flowchart to represent the program code above. (4 marks)
b) Write a program that computes the volume of a cube. Have the program prompt the user
for each dimension. (5 marks)

You might also like