0% found this document useful (0 votes)
2K views2 pages

Ues103 Est 23

Ues103 ues 103 ues 103

Uploaded by

Timmy L
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views2 pages

Ues103 Est 23

Ues103 ues 103 ues 103

Uploaded by

Timmy L
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Thapar Institute of Engineering and Technology, Patiala

Computer Science and Engineering Department


End Semester Examination (EST) 2023-24 Even Semester

B.E. II Sem Course Name: Programming for Problem Solving


Course Code: UES103 Date: 20th May, 2024 Time: 2:00PM – 5:00PM
Maximum Marks: 40 Faculty: Dr. Raman, Dr. Ravneet, Dr. Saif, Dr. Rahul,
Dr. Seemu, Dr. Deep Mann, Dr. Tanu, Dr. Himika,
Dr. Mahak, Dr. Saurabh

Note: Attempt any 8 questions. Explain theory questions with examples.

Q1. a) Convert the following binary numbers to decimal numbers CO1 L2


i. 111001
ii. 100101 (2+3 =
b) Write a program in C to divide two numbers of integer data 5marks)
type and store the result in the variable of float data type.

Q2. Write a program in C to find the transpose of a matrix. (5 marks) CO2 L3


Q3. Differentiate between call by reference and call by value. Write a CO3 L3
(5 marks)
C program to demonstrate call by reference.

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.

For example, canchange(7) will return –1. On the other hand,


canchange(14) will return 4 because 14 can be paid as 3+3+3+5,
and there is no other way to pay with fewer coins. Finally, 15 can (5 marks)
be changed as 3+3+3+3+3, 5+5+5, 5+10, so canchange(15) will
return 2.

Bloom's Level wise Marks


Distribution
Level 4
11%

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

You might also like