CIT 1202 Structured Programming2
CIT 1202 Structured Programming2
I NSTRUCTI ONS: Ans wer questi on one and any ot her t wo questi ons
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)
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)
Mer u Uni versity of Sci ence & Technol ogy is ISO 9001: 2015 Certifi ed
Foundati on of Innovati ons Page 3