Bit 2122:Structured Advanced Programming Question Paper
Bit 2122:Structured Advanced Programming
Course:Bachelor Of Information Technology
Institution: Meru University Of Science And Technology question papers
Exam Year:2010
a) Write a program that illustrates the use of scanf and printf functions [ 2 marks]
b) Explain using a pseudocode, flowchart and a program that picks the largest of four numbers. [5 marks] c) List any three characteristics of a good program [ 3marks]
d) What is “initialization”? Why is it important [ 2 marks]
e) Define a structure type, struct personal that would contain person name, date of joining and salary. Using this structure, write a program to read this information for one person from keyboard and print same on the screen. [ 4 marks]
f) List the following: [3 marks] a. All C logical operators g) What is a data structure? Why is an array called a data structure? [ 3 marks]
h) Explain the following concepts using a short code: [ 4 marks] i. Accessing the address of a variable ii. Initialization of pointer variables
i) Differentiate between formal parameters and actual parameters [ 2 marks]
j) Write a for statement to print each of the following sequences of integers: [ 2 marks] i. 1, 2, 4, 8, 16, 32 ii. -4, -2, 0, 2, 4
2
QUESTION TWO (20 MARKS)
a) Write a program to find the area and perimeter of a rectangle [ 2 marks] b) Define the term structured programming [ 2 marks] c) Explain using the syntaxes, flowcharts and a code snippet the difference between the working logic of do/while and while loop [ 4 marks] d) Write a program which would print the alphabets set a to z and A to Z in decimal and character form [ 4 marks] e) Write a program that explains the concepts of logical operators [ 4 marks] f) Differentiate between the following: [ 4 marks] i. main() and void main(void) ii. #define and #include directives
QUESTION THREE (20 MARKS)
a) Differentiate between the following: [ 8 marks] i. Structures and union ii. queue and stacks iii. Call by value and call by reference iv. Pointer variable declaration and address pointer b) Write a C program to display 60 in decimal, octal and hexadecimal [ 4 marks] c) Given the following procedure to pick maximum tender among a set of tenders, write a C program to implement the steps. [ 6 marks ]
Step 1: Read tender identity and tender amount Step 2: max tender = tender amount; Max tender identity = tender identity; Step 3: Perform Steps 4 and 5 as long as the end of the list of tenders is not reached. Step 4: Read tender identity and tender amount Step 5: If tender amount > max tender Then { max tender = tender amount Max tender identity = tender identity} Step 6: Write tender identity and max tender
d) Explain the statements: printf(“8.3%f”,b); [2 Marks]
QUESTION FOUR (20 MARKS)
a) Write a program to print the multiplication table from 1 x 1 to 12 x 10. Comment out your program appropriately. [ 5 marks ] b) A function definition also known as functional implementation includes six main elements. List and explain them using an example. [ 6 marks ] c) Describe rules for switch statement [ 4 marks ] d) Describe any four advantages of using Pointers in C language. [ 4 marks] e) Explain the role of the C pre-processor. [ 1 mark]
3
QUESTION FIVE (20 MARKS)
a) Interpret and discuss your understanding of: data_type *pt_name; [ 3 marks] b) Explain the types of errors in a program [ 4 marks] c) Describe using an example program the concept of defining and calling a function d) [ 4 marks ] e) Write programs to print the following outputs using for loops. [ 3 marks] ***** **** *** ** * f) Compare, in terms of their functions, the following pairs of statement: [ 6 marks] i. While and do...while ii. Break and continue iii. Continue and goto
More Question Papers