Get premium membership and access revision papers, questions with answers as well as video lessons.

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



1


a. Briefly explain the history and development of C language. (3 Marks) b. List any four advantages of functions. (2 Marks) c. Write a program to find the sum of odd and even numbers between 1 and 100 (4 Marks) d. Point out the errors, if any in the following program. (3 Marks) main( ) { int tag = 0, code = 1; if (tag ==0) (code> 1? printf (“\nHello”)?printf(“\nHi”)); else printf (“\nHello Hi !!”); } e. Write a program to find the cube of a given number. (3 Marks) f. Describe the steps required to develop a C program. (5 Marks) g. Highlight any four differences between C and C++ (2 Marks) h. Write a menu driven program using switch, which has the following options. (5 Marks) 1. Factorial of number 2. Prime or not 3. Odd or even 4. Exit
i. Write a simple program to demonstrate prefix and postfix increment and how it affects the result of an expression. (3 Marks)
2
QUESTION TWO – 20 MARKS
a. Write a syntax and sample programs that demonstrates the following concepts: (9 Marks) i. Declaring two dimension array ii. Do/While iii. Ternary operator
b. A library charges a fine for every book returned late. For the first five days the fine is 50 shillings, for 6 – 10 days fine is Ksh100 and above 10 days fine is 150. If you return the book after 30 days your membership will be cancelled. Write a program to accept the number of days the member is late to return the book and display the fine or the appropriate message. (6 Marks) c. List any five properties of a good program. (5 Marks)
QUESTION THREE – 20 MARKS
a. List five basic properties of an algorithm. (5 Marks) b. Given three numbers x, y and z. Draw a flow chart diagram to pick the largest of three numbers. (5 Marks) c. Write a program to call a function which returns the cube of a given number. (3 Marks) d. List any four rules to initialize an array. (2 Marks) e. Write a C program to calculate simple interest for a set of values representing principle, number of years and rate of interest. (3 Marks)
f. Explain the following: (2 Marks) i. #ifndef ii. Automatic variables QUESTION FOUR – 20 MARKS
a. Explain the advantages of structure type over the array type variables. (4 Marks) b. List and explain any five escape sequence characters. (5 Marks) c. Explain the data type conversion and how C behaves when character and integer data types are mixed. (2 Marks) d. What would be the output of the following program: (3 Marks)
main( ) { int a, b; a=-3 - - 3; b=-3 - - (-3); printf (“a=%d b=%d”, a, b); } e. Differentiate between: (4 Marks) i. Call by value and call by reference as used in function ii. Structure and union f. Write a program segment to assign 15 to an integer variable x through a pointer p. (2 Marks)
3
QUESTION FIVE – 20 MARKS
a. State the difference between using an example, between entry-controlled and exit-controlled loop structures. (2 Marks) b. Write the logical statements for the following: (3 Marks) i. Basic pay is more than 2200 for all employees whose category is not T ii. Total is more than 450 for all students whose branch is I or J iii. Stock below 100 for all items whose item no is 100 and in the shop A c. Using a simple C examples, list and discuss any three programming errors. (6 Marks) d. Write a program to take two numbers as input data and display their sum, their differences, their product and their quotient. (5 Marks) e. A company insures its drivers in the following cases: (4 Marks) i. If the driver is married ii. If the driver is unmarried, male and above 30 years of age iii. If the driver is unmarried, female and above 25 years of age
In all other cases the driver is not insured. If the marital status, sex and age of the driver are the inputs, write a program to determine whether the driver is not to be insured or not.






More Question Papers


Popular Exams



Return to Question Papers