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:2012




(a) Define the following terms: (i) Pointer (1 Mark) (ii) Relational operators (1 Mark) (iii) Array (1 Mark) (iv) Local Variable (1 Marks) (b) Outline two types of software. (2 Marks) (c) Describe the uses of compilers and text editors as software resources used in programming. (2 Marks) (d) With a view of the correct structure of a C program, write a simple program to calculate your body mass index (BMI). Assume that BMI equals a person?s weight in kilograms divided by height in meters. (6 Marks) (e) With the use of an example, describe what variables are used in programming. (3 Marks) (f) Differentiate between printf (“%C”); and printf („%S”); (2 Marks) (g) Given the following code fragment int i=56; while (i>0) {printf (“The numbers is %d, i);i=i+i} (i) What does the code do? (2 Marks) (ii) Write a similar code fragment using the for loop. (3 Marks) (iii) Write a similar code fragment using the do-while loop. (3 Marks) (h) C programming does not provide a data type string. Explain how a string is declared in a C program. (3 Marks)
QUESTION TWO – (20 MARKS)
(a) A traveler from town A to town B that is N km apart can take W hours. (i) Represent your algorithm using a flowchart diagram. (4 Marks) (ii) Write a C function program to calculate the speed of the travelers. (3 Marks) (iii)Use the function in (ii) above in a C program. (5 Marks) (b) With a view of showing how to use arrays, write a C program. (5 Marks) (c) Explain the three parts that you state when declaring an array. (3 Marks)
QUESTION THREE – (20 MARKS)
(a) Write a simple C program to convert a string into uppercase using in built functions from thee string.h header. (4 Marks) (b) Explain what you understand by the term functions as used in C programming. (2 Marks) (c) Write a C function that calculates the factorial of any number N where N is less than 9. (4 Marks) (d) Analyze the difference between passing arguments by value and passing arguments by reference? Elaborate with short examples. (6 Marks) (e) List four advantages of C program. (4 Marks)
QUESTION FOUR – (20 MARKS)
(a) Given a Variable called VarNum and a pointer named Pnum all of type integer are needed to be used in a C program. (i) Show how to declare both the variable and the pointer. (2 Marks) (ii) Show how to let the pointer point to the variable. (2 Marks) (b) Explain the use of data files as used in programming. (2 Marks) (c) Describe the difference between printf and fprintf as used in C programming. (2 Marks) (d) Given the following structure declaration:
Struct account{ Int acc_no; Char acct_type; Char name [80]; Float balance; }; Struct account customer1, customer2
(i) State the structure members. (2 Marks) (ii) What are customer1 and customer2? (2 Marks)
(iii)Suppose you have 100 customers, show the best way to define customer1 to customer100. (4 Marks) (iv) How do you display the acc_type for customer1 in C PROGRAM? (2 Marks) (v) Show how you can assign initial values to customer2. (2 Marks)






More Question Papers


Popular Exams


Mid Term Exams

End Term 1 Exams

End Term 3 Exams

Opener Exams

Full Set Exams



Return to Question Papers