Registration No.
Total Number of Pages: 02
- 1 1 Course: IDD ([Link] and [Link])
5-
0 2 Sub_Code: RPL2B001
nd 2
2 Semester/Back Examination: 2024-25
5 For Problem Solving Using C
SUBJECT: Programming / 0
4 CIVIL, CSE, CSEAI, CSEAIML, CSEDS, CSIT, CST, ECE, EEE,
BRANCH(S): AEIE, AUTO, BIOTECH,
- 2
217
EIE, ELECTRICAL, ELECTRICAL & C.E, ETC, IT, MECH, METTA, MINING, MME, PLASTIC
Time: 3 Hours
Max Marks: 100
[Link]: S324
Answer Question No.1 (Part-I) which is-compulsory,
- 11 III. any eight from Part-II and any two from Part-
The figures0 2 5
in the right hand margin indicate marks.
5 / 2
4 / 0 Part-I
Q1
- 2
Answer the following questions: (2 x 10)
217 between syntax errors and logical errors in C programming. 1
a) What is an algorithm? How is it represented?
b) Differentiate
- - 1
c) Find the output:
0 2 5
#include <stdio.h>
int main() { 5 / 2
int x = 5;
4 / 0
printf("%d %d %d", x++, ++x, x);
7 - 2
}
return 0;
2 1
d) Explain the difference between an interpreted and a compiled language. Why is C a compiled
language?
- 1 1
e) Explain the difference between call by value5
2 - call by reference.
and
f) What is dynamic memory allocation? Name
/ 2 0 two functions used for it in C.
g) Define a self-referential structure with
h) Which ASCII and binary file formats / 0 5 are used in file handling?
an example.
i) Compare structures and 2
- 4 in C with examples.
unions
j) Define pointers. How7 do they differ from arrays? 1
21 1 - - 1
1 Part-II
- Answer Type Questions- (Answer Any Eight 2 5
0out of Twelve)
Q2 -
Only Focused-Short
5 / 2 (6 x 8)
b) Write/2
02
a) Write a program to count the occurrences of each
a C program to check whether a number is prime or 4
character in
/
not.
05
a given string.
c) 0
/ 5 recursion. Write a recursive C program to find
Describe
7 - 2the GCD of two numbers.
- 2 4 Implement a function to reverse a string without2using
d) 1 built-in functions.
21 7 e) Write a program in C to implement the binary search algorithm for a sorted array of integers.
f) What is a dangling pointer in C? Write 2 pros and 2 cons of a dangling pointer.
g) Explain function prototypes, parameter passing, and return types with examples.
h) Write a program in C to take the message as user input and print a ciphertext for the message
below by using the given encryption key.
Message: Your syllabus provides a strong foundation in C programming, covering key
concepts from basic algorithms to advanced file handling
Encryption Key: Shift all the alphabet by 3 positions.
i) Write a menu-driven program to simulate a banking system allowing users to deposit,
withdraw, and check their balance.
- 1 1
j)
The eligibility rules are: 0 2 5-
Write a program that accepts a person's age and checks their eligibility for a driving license.
5/ 2
Age < 18 → Not eligible, Age = 18 → Eligible for learner's permit, Age > 18 → Eligible for full
license
4 / 0
k) -2
Take a number as input from the user and display its multiplication table (up to 10)
l)
217
Write an algorithm to calculate the total cost of fruits bought from a market.
The algorithm should: 1) Ask the user to enter the price per kg of apples, 2) Ask for the
number of kgs bought, 3) Multiply the two to get the total cost, 4) Display the total amount to
be paid.
- 1 1
25 - Part-III
Only Long Answer Type / 0
2Questions (Answer Any Two out of Four) (16 x 2)
/ 5
0to simulate a loan approval system that takes monthly income (MI), credit
Q3 a) Write a C program
- 2 4 (8)
score (CS),
2 1 7 and requested loan amount (RLA) as input from the user and determines loan
1 1
eligibility.
Eligibility Criteria: 1) MI > = Rs. 80,000, CS > = 750, and RLA 5 -
- > = 10 times of MI: High
Eligibility to get loan, 2) MI > = Rs. 50,000, CS > = 650, and
2 2
0 RLAto >get= loan.
5 times of MI: Moderate
Eligibility to get loan, 3) MI < Rs. 50,000, CS < 650: Not/Eligible
b) You are organizing a running competition. Write a/0
5
minutes) of 10 participants and display the - 2 4 and slowest times using arrays.
fastest
C program to input the completion times (in (8)
2 1 7
Q4 a) A restaurant tracks the number of customers visiting each day over a week. Write a program (8)
to input daily customer counts for 7 days and calculate the total and average number of
customers.
- 1 1
2
b) Write a program in C that calculates the electricity 5 - bill of a household. Use a user-defined (8)
function that takes the number of consumed
/ 2 0 units and returns the total bill amount based on
0 5 Next 100 units: ₹7/unit, Above 200 units: ₹10/unit
the tariff rates: First 100 units: ₹5/unit,
/
- 2 4if a given city name entered by the user starts with the letter 'S'.
Q5 a) Design a program to check
1 7
2 1 conditional statements. 1 1 (8)
Use string functions and
5 - -
b) Simulate an ATM 1
-
PIN entry system. Allow a maximum of 3 attempts using
- granted"; otherwise, print "Card blocked". /20 2 a loop. If the PIN is (8)
NOTE: Use
0 2 5
correct, print "Access
compile-time initialization to store the correct pin and5 match the pin by using run-
2
time/initialization.
4/ 0
0 5
/ Make a flowchart for a laptop charging reminder1system. 7 - 2
Q6 a)
- 2 4 2 The system should: (8)
21 7 If the battery is below 20 %, display a message: “Battery Low – Please Charge.”
If the battery is between 20 % and 80 %, display: “Battery Level Normal.”
If the battery is above 80%, display: “Battery Sufficient – Unplug Charger if
Connected.”
b) Write a program in C using a union to store vehicle information. Each vehicle can either be a (8)
car (with a number of seats) or a truck (with load capacity in tons). Input the type of vehicle
and its specific data, then display the details accordingly.