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

Structured Programming Questions Only

The document contains a series of structured programming questions focusing on the C programming language, covering topics such as programming languages, operators, data structures, algorithms, and coding practices. It includes questions on specific C functions, programming concepts, and the development process. The questions are divided into two sections, with Section A focusing on theoretical knowledge and Section B on practical applications and coding tasks.

Uploaded by

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

Structured Programming Questions Only

The document contains a series of structured programming questions focusing on the C programming language, covering topics such as programming languages, operators, data structures, algorithms, and coding practices. It includes questions on specific C functions, programming concepts, and the development process. The questions are divided into two sections, with Section A focusing on theoretical knowledge and Section B on practical applications and coding tasks.

Uploaded by

jobkilonzo95
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

STRUCTURED PROGRAMMING - JULY 2023 (Questions Only)

SECTION A (40 MARKS)

1. (a) State four examples of third generation programming languages.


(b) Explain the function of a loader as used in programming.

2. State the difference between / operator and % operator as used in a C program.

3. Outline four characteristics of a C programming language.

4. Kennedy considered the following factors when choosing a programming language:


(a) Efficiency
(b) Elasticity of a language
Explain a reason for each consideration.

5. Explain a circumstance that would necessitate the use of each of the following format
strings in a C program:
(a) %d
(b) %E

6. The following is a program written in C programming language. Use it to answer the


questions that follow:

#include<stdio.h>
main()
{
printf("My country is Kenya");
}

Explain the function of each of the following in the code:


(a) main()
(b) printf()

7. Jared used the following keywords in a C program that he developed:


(a) goto statement
(b) break statement
Explain the function of each keyword in the program.

8. The following is a statement used in a C program:


for (k=1; k<=20; k++)
(a) Identify the logical expression in the statement.
(b) State the function of the statement k++.

9. With the aid of an illustration, state the difference between a one-dimensional array and a
two-dimensional array as used in C programming language.

10. Describe each of the following data structures as used in programming language:
(a) Stack
(b) Linked list

SECTION B (60 MARKS)

11. (a) Describe each of the following tools as used in programming:


(i) Decision tree
(ii) Flow chart

(b) Marion intends to develop an application in C programming language. Describe two


types of software other than the operating system she would require to achieve her goal.

(c) (i) Explain merge sort technique as used in C programming.


(ii) The following are elements in an array:
6, 11, 16, 21, 26, 31, 37
Using a binary search algorithm, write a pseudo-code to find the element 26 in the
array.

12. (a) Explain the term binary file as used in C programming.


(b) Outline two advantages of using a binary file in C programming.
(c) Sally documented a program that she developed. Explain three types of documentation
that she could have considered.

13. (a) Write a program using C programming language that would display all integers from
20 to 50. Use a for loop statement.
(b) Explain the function of each of the following function prototype statements in a C
program:
(i) float area(int, int)
(ii) int void sum(int)

14. State a program development phase where each of the following activities may be
performed:
(i) Writing the actual program
(ii) Stating the requirements of the program to be developed
(iii) Enhancing the operation of the program
(iv) Checking if the program meets its requirement specifications
(v) Drawing a flowchart to show the logic of a program

15. The volume of a sphere is given by V = 4/3πr³, where V is the volume and r is the radius.
Write a C program that would compute and display the volume of a sphere with a radius
of 20 cm.

16. (a) Outline three advantages of sub programs in programming.


(b) With the aid of an example, differentiate between a single character constant and a
string character constant as used in C programming.

17. The following is a program in C programming language. Use it to answer the questions
that follow:

#include <stdio.h>
int g;
int main()
{
int a, b;
a = 10;
b = 20;
g = a + b;
printf("value of a = %d, b = %d and g = %d\n", a, b, g);
return 0;
}

(i) State two statements that have been used to initialise variables in the program.
(ii) Explain the function of \n in the printf statement.
(iii) Explain the scope of each of the following variables declared in the program:
g
a

18. State the difference between “a” command mode and “r+” command mode as used in C
programming files.

19. Explain the function of each of the following in C programming language:


(i) Escape sequence
(ii) Nested loop
(iii) clrscr() command

20. Write a C program that would accept a string of 10 characters through an input
statement. The program should then print the first character and last character of the string
on the screen.

You might also like