Ues103 Est 23
Ues103 Est 23
Q4. Create a structure named Book to store book details like title, CO4 L3
author, and price. Write a C program to input details for five books
(5 marks)
using array of structures, find the most expensive and the lowest
priced books, and display their information.
Q5. Write a program in C to print a string in reverse using a pointer. CO2 L3
Input the string using a character array. Declare a pointer variable
(5 marks)
to the string (pointing to the character array). Now, print the string
in reverse using the pointer.
Q6. Write a program in C that merges lines alternately from two files CO4 L3
and writes the results to new file. If one file has less number of
lines than the other, the remaining lines from the larger file should (5 marks)
be simply copied into the target file.
Assume: Each line in a file ends with ‘.’ (full stop).
Q7. Explain the following with the help of code snippets/examples CO1 L2
(3+2 =
(a) Switch statement 5marks)
(b) Ternary Operator
Q8. a) Differentiate between structures and unions in C language. CO4 L2
(2+3 =
b) Write the syntax for opening the file named a.txt in
5marks)
(i) read mode (ii) write mode (iii) append mode
Q9. Write a program in C for the following scenario: CO3 L4
A country has coins of denomination 3, 5 and 10, respectively.
Define a recursive function canchange(k) that returns –1 if it is
not possible to pay a value of k using these coins. Otherwise, it
returns the minimum number of coins needed to make the
payment.
Level 2
33%
Level 3
56%
16 15
Course Outcomes wise Marks
14
Distribution
12
10 10 10
10
0
CO 1 CO 2 CO3 CO4