Problem Solving and Programming
Problem Solving and Programming
First Semester
(Regulations 2013)
PART B — (5 13 = 65 marks)
11. (a) Analyze the Recursive Quick Sort algorithm and find the time
complexity. (13)
Or
(b) Explain top down design in problem solving with an example. (13)
12. (a) (i) Show the different if control statements with an example for each.
(6)
(ii) Write a C program to calculate the incentive amount of a sales
person based on their annual sales amount
0 to 10,000 – 10% of sales amount
1,000 to 20,000 – 20% of sales amount
2,000 to 30,000 – 25% of sales amount. (7)
Or
(b) (i) What is multiple selection switch statement? Write its syntax. (4)
(ii) Write a C program to compute the EMI amount for a customer’s
purchase on loan using switch control statement.
Number of years EMI
1 10% of loan
2 11% of loan
3 12% of loan
4 14% of loan
5 15% of loan. (9)
13. (a) (i) Explain counter controlled repetition with while loop. Give an
example. (9)
(ii) What is the purpose of header files? Give examples. (4)
Or
(b) (i) What is sentinel controlled repetition? Give example. (4)
(ii) What is an array? Write a program to compute Mean and Median
using arrays. (9)
14. (a) (i) How arguments are passed to a function using references? (10)
(ii) What is array of pointers? Give an example. (3)
Or
(b) What are the string handling functions available in C? Write user
defined functions for string copy, string compare and substring. (13)
15. (a) How formatting input is done in scanf( ) statements? Give an example for
each. (13)
Or
(b) Write a program in C to reverse the contents of a file using random
access file mode. (13)
2 J1353
PART C — (1 15 = 15 marks)
16. (a) Write a C program to find the minimum number in a list of 'N' numbers.
Analyse its time complexity.
Or
(b) Write a C program to check whether all the elements in a given away of
'n' elements are distinct.
——————————
3 J1353
Reg. No. :
First Semester
(Regulations 2013)
1. Define modularity.
4. Write a C program to accept two numbers compute its sum and print the
result.
6. Define recursion.
9. State the difference between sequential access file and random access file.
PART B — (5 × 13 = 65 marks)
Or
(b) (i) Explain with an example verification of program segments with
loops. (8)
(ii) Explain worst and average case behavior of an algorithm with an
example. (5)
12. (a) (i) Explain integer constants and real constants in C language with an
example. (6)
(ii) Write a C program that converts the given temperature in
Fahrenheit to Celsius using the following conversion formula.
F 32
C (3)
1 .8
Or
(b) (i) Write a C program to print the first ‘N’ Fibonacci numbers. (5)
Note : The Fibonacci numbers are 0, 1, 1, 2, 3, 5, 8, 13, 21, 34,.....N
where each number is the sum of the preceding two.
(ii) Write a C program to perform computation of sin (x) as given
below : (8)
3 5 7 9
x x x x
sin x x .......... . N terms.
3! 5! 7! 9!
13. (a) (i) Explain entry-controlled loop and exit-controlled loop with an
example. (7)
(ii) What is a function? Explain with an example. (3)
(iii) Write a C program to compute factorial of a given number using
recursion. (3)
Or
(b) (i) Write a C program to store ‘N’ names in an array. (6)
(ii) Write a C program to sort an array of ‘N’ numbers in ascending
order. (7)
14. (a) (i) Write a C program using pointers to find the length of a character
string. (5)
(ii) What is array of pointers? Explain with an example in C language.
(5)
(iii) Explain enumerated types in C language with examples. (3)
Or
(b) Explain structures and unions in C language with an example. (13)
2 BS2353
15. (a) What is a file? Explain with an example the file handling functions. (13)
Or
(b) A file with name DATA contains a series of integer numbers. Write a C
program to read these numbers and then write all odd numbers to a file
called ODD and all even numbers to a file called EVEN. (13)
PART C — (1 × 15 = 15 marks)
16. (a) Write a C program to accept student personal and academic details and
store in it a file. Print students’ mark sheet.
Or
(b) (i) With example explain pointers to function. (10)
(ii) Give an account on predefined symbolic constants. (5)
—————————
3 BS2353