STRUCTURED PROGRAMMING - JUNE 2013



CICT PART II SECTION 3: STRUCTURED PROGRAMMING

WEDNESDAY: 5 JUNE 2013: TIME ALLOWED: 3 HOURS.
Answer ALL questions. Marks allocated to each question are shown at the end of the question. Show ALL your workings.

ALL programs written should be in C programming language.

QUESTION ONE
(a) Describe the uses of the following terms in the context of structured programming environment:
(i) Compilation (2 marks)
(ii) Linking (2 marks)
(iii) Build (2 marks)
(iv) IDE (2 marks)
(b) Citing suitable examples in each case, describe three types of declarations in structured programming. (9 marks)
(c) Below is a programming declaration.
Int *ptv1,} (i),
x, } (ii),
a[10]; } (iii)
Required:
Identify the parts labeled (i) to (iii). (3 marks)

QUESTION TWO
(a) (i) Distinguish between “declaring a function” and “defining a function”. (4 marks)
(ii) Write a C language function that calculates and returns the square of an integer number. (4 marks)
(b) Use illustrations to explain three iteration structures used in structured programming. (9 marks)
(c) Highlight three items that a message from a compiler might contain (3 marks)

QUESTION THREE
(a) Examine the roles of the following statements in structured programming.
(i) Continue. (2 marks)
(ii) goto. (2 marks)
(b) You have been awarded a contract to write a program for the government’s tax department.
The program calculates tax deductions on salary based on the following criteria:
· If the salary is less than or equal to Sh. 10,000, there is no deductions.
· If the salary is more than Sh. 10,000, and less than 20,000, the tax deduction is Sh. 1,000.
· If the salary is equal to or more than Sh. 20,000, the tax deduction is 7%.
Required:
Write a C program that inputs the salary amount computes appropriate tax deductions and outputs the net pay. (7 marks)
(c) Outline four validation rules of user input in C programming language. (4 marks)
(d) Highlight five advantages of structured programming languages over procedural languages. (5 marks)


QUESTION FOUR
(a) Define the following terms as used in structured programming:
(i) Pseudocode.
(ii) Flow Chart.
(iii) Variable.
(b) The SmartLink Academy uses the following grading system:
Mark Grade
0 to 50 Fail
51 to 60 Pass
61 to 70 Credit
71 to 100 Distinction
Required:
A function named grade ( ) to convert marks into appropriate grades. (6 marks)
(c) Differentiate between the following terms:
(i) “Function prototypes” and “Function definitions”. (4 marks)
(ii) “Pre-defined functions” and “user-defined functions”. (4 marks)

QUESTION FIVE
(a) (i) Highlight two differences between “if….else” and “do….while” loops in C programming language. (4 marks)
(iii) Write a program in C language using a do while loop for printing or displaying even numbers. (4 marks)
(b) Write a program which converts temperatures in Fahrenheit to Celsius in steps of 20 degrees to a maximum of 300 degrees Fahrenheit.

The program should use the following formula:
C = (F – 32) x 5/9
Where: 0 = degrees, C = Celsius and F = Fahrenheit. (12 marks)

Comments

  1. Lucky Club Casino Site 2021 - Live Dealer Games
    Lucky Club Casino – A New Online Casino offering Live Dealer games, 카지노사이트luckclub and Casino Rewards. Sign up and log in to your Lucky Club Casino site to play real

    ReplyDelete

Post a Comment

Popular posts from this blog

PRINCIPLES OF WEB DEVELOPMENT MAY 2018