MERU UNI VERSI TY OF SCI ENCE AND TECHNOLOGY
P. O. Box 972- 60200 – Meru- Kenya
Tel: +254( 0) 799 529 958, +254( 0) 799 529 959, + 254 (0) 712 524 293,
We bsit e: i nf o @must. ac. ke Email: i nf o @must. ac. ke
UNI VERSI TY EXAMI NATI ONS 2019/ 2020
FI RST YEAR SECOND SE MESTER SUPPLE MENTARY/ SPECI AL EXAMI NATI ON
FOR THE CERTI FI CATE I NI NFORMATI ON TECHNOLOGY
CI T 1202: STRUCTURED PROGRA MMI NG
DATE: JANUARY 2021 TI ME: 11/ 2 HOURS
I NSTRUCTI ONS: Ans wer questi on one and any ot her t wo questi ons
QUESTI ON ONE ( 30 MARKS)
a) Identify any t hree exa mpl es of co mput er har dware (3 mar ks)
b) Pr ogra ms st ore dat a te mporaril y i n mai n me mor y. Defi ne t he ter m me mor y cell
(2 mar ks)
c) In me mor y a co mput er can eit her st ore a val ue or retrieve it. Di sti ngui sh bet ween
st ori ng and retrievi ng val ues i n co mput er me mor y (2 mar ks)
d) Identify an discuss t he t wo t ypes of co mput er me mor y (4 mar ks)
e) Secondar y st orage pl ay an import ant rol e i n co mput er syst e ms. Identify t wo reasons
why secondar y st orage is required (2 mar ks)
f) Di fferenti at e bet ween co mput er har dwar e and soft ware (2 mar ks)
g) Identify any t wo rol es pl ayed by t he central pr ocessi ng unit (2 mar ks)
h) Identify any four charact eristics of a good al gorit hm (2 mar ks)
i) C i s a struct ured pr ogra mmi ng l anguage. Expl ai n why (2 mar ks)
j) Di scuss t he rol e pl ayed by a C co mpil er (2 mar ks)
k) A co mpil er is a transl at or. Di sti ngui sh bet ween a co mpil er and an i nt er pret er(4 mar ks)
l) Part of t he synt ax of a C progr a mis t he pre- pr ocessor directi ves. Identify t he rol e t he
pr e- pr ocessor directi ves pl ay i n C (1 mar k)
m
) The pri ntf() functi on is defined i n t he st andar d i nput out put li brar y. What is t he role of
t he pri ntf() functi on (1 mar k)
Mer u Uni versity of Sci ence & Technol ogy is ISO 9001: 2015 Certifi ed
Foundati on of Innovati ons Page 1
n) The se mi col on is i mport ant when decl ari ng vari abl es and st at e ment s. What rol e does a
se mi col on pl ay i n a vari able decl arati on (1 mar k)
QUESTI ON T WO ( 15 MARKS)
a) C l anguage cont ai ns reser ved wor ds. Bri efl y descri be your underst andi ng of reserved
wor ds (2 mar ks)
b) Identify any 5 reser ved words i n C (5 mar ks)
c) Descri be t he t wo t ypes of identifiers i n C (4 mar ks)
d) Identify any four i dentifier na mi ng rul es i n C (4 mar ks)
QUESTI ON THREE ( 15 MARKS)
a) You are an I T t echni ci an i n a healt h cli ni c. You have been asked t o writ e a sa mpl e C
pr ogra mt hat woul d hel p t he doct or capt ure some dat a about a pati ent. Ensure your
pr ogra m capt ures dat a pert ai ni ng t o: patient’s na me, age, eye col our, wei ght , ski n
col our and hair col our (6 mar ks)
b) Wr it e a pr ogra mi n C t hat st ores mar ks for 5 st udent s in an array. The pr ogra m shoul d
cont ai n a functi on t hat cal cul at es t he sum and average of t he mar ks i n t he array
(6 mar ks)
c) The foll owi ng is a C vari able decl arati on st at e ment. Write a poi nt er t o t he vari abl e i nt
st udent Mar k=30 (1 mar k)
d) Identify any t wo dat a t ypes i n C (2 mar ks)
QUESTI ON FOUR ( 15 MARKS)
a) Di scuss any t hree co mmon progra mmi ng errors (6 mar ks)
b) Assu mi ng you are an exa mi nati on offi cer at your school, writ e a C pr ogra mt hat
recei ves a nu mber bet ween 0 and 100 and displ ays on the screen t he grade for t hat
nu mber (6 mar ks)
c) Identify t he rol e of t he scanf() functi on i n C
d) At t he wei ghi ng offi ce i n a coffee fact or y, far mers, farmers bri ng t heir pr oduce i n bags.
Havi ng been ne wl y hired as a pr ogra mmer, i dentify t he appr opri at e dat at ypes you
Mer u Uni versity of Sci ence & Technol ogy is ISO 9001: 2015 Certifi ed
Foundati on of Innovati ons Page 2
woul d use t o represent each of t he foll owed: bags of mai ze each far mer has br ought;
t ot al wei ght of coffee each far mer has br ought (2 mar ks)
QUESTI ON FI VE ( 15 MARKS)
a) Identify any t wo t ype of functi ons i n C (4 mar ks)
b) Wr it e a bri ef C pr ogra mt hat opens a file called”pr ogra mmi ng.t xt ” (4 mar ks)
c) Bri efl y ill ustrat e t he struct ure of a for l oop i n C (2 mar ks)
d) The t abl e bel ow represent s litres of mil k a far mer sells each day
Day Litres
1 34
2 50
3 45
4 40
Bei ng a pr ogra mmer, writ e a pr ogra mi n Ct hat cal cul ates t he average litres sol d by t he
far mer for t he four days (4 mar ks)
e) In your own underst andi ng, ill ustrat e t he appli cati on of t he break keywor d (1 mark)
Pr epared and co mpil ed by Mr . Swaka Chris.
Mer u Uni versity of Sci ence & Technol ogy is ISO 9001: 2015 Certifi ed
Foundati on of Innovati ons Page 3