0% found this document useful (0 votes)
24 views16 pages

Practical-C QN Edit

Uploaded by

ereyeage02
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)
24 views16 pages

Practical-C QN Edit

Uploaded by

ereyeage02
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/ 16

1.a.

Smart Thermostat Setting


A smart thermostat adjusts the room temperature based on input from sensors.
Write a program to set the temperature as follows:
* Below 18°C: Turn on the heater.
* Between 18°C and 24°C: Maintain the current setting.
* Above 24°C: Turn on the cooler.
b. Write a C program that accepts two item's weight and number of purchases
(floating point values) and calculates their average value.

2.a. Cyber Cafe Billing System


A cyber cafe charges ₹20 for the first hour and ₹10 for every additional hour.
Write a program to calculate the total bill based on usage time.
b. Sujith is going to Goa this week end. As the train tickets are unavailable, he
decides to go by bus. He books his tickets through a website. Write a program to
find whether he booked a window seat or not. Assume that there are maximum 11
rows in a bus.

3.a. Traffic Light System


A traffic light system changes colors based on time input:
* Green: 1–30 seconds
* Yellow: 31–40 seconds
* Red: 41–60 seconds
Write a program to determine the light color based on input time.
b. Input the number of days taken to cultivate both rice and wheat in turns in an
agricultural land from the user. Write a C program to display the days as years,
months and days using simple operators.

4. a.ATM PIN Verification


An ATM verifies the user’s 4-digit PIN. Write a program to check if the entered
PIN matches the stored PIN, with a maximum of 3 attempts.
b. Lilly,Rose and Jas are going to an amusement park. They chose a roller coaster
ride to enjoy. The ride operator asked the tallest among them to sit at the last seat.
Help the ride operator to find the tallest among the three by getting the height from
each of them(get height values in integer).
5.a. Average Rainfall Calculator
Scenario: A weather monitoring system records rainfall for a month. Write a
program to calculate the average monthly rainfall from the daily data provided.
b. Write a C program to calculate the sum of N natural numbers and analyze the
space and time complexity of the program.

6.a. Determine Triangle Type


Scenario: Given the lengths of three sides of a triangle, write a program to
determine if it is equilateral, isosceles, or scalene.
b. You have a rectangular plot for building an apartment. Get the input from the
user for the plot and write a C program to calculate the area and perimeter of the
plot.

7. a.Bank Denomination Distributor


Scenario: A bank ATM dispenses ₹2000, ₹500, and ₹100 notes. Write a program
to distribute the amount requested by a user using the least number of notes.
b. Write an algorithm, flowchart, pseudocode followed by a simple C code to do
find the Factorial using recursion.

8.a. Palindrome Word Checker


Scenario: A word is input to a word game. Write a program to check if the word is
a palindrome (ignoring case).
b. You have a circular plot for building play ground. Get the input from the user
for the plot and write a C program to calculate the area and perimeter of the plot.

9.a. Student Attendance Manager


Scenario: A university calculates attendance percentage to check exam eligibility.
Write a program to determine if a student (attendance >= 75%) is eligible for
exams.
b. Write an algorithm, flowchart, pseudocode followed by a simple C code to do
find the Fibonacci series using iteration.
10.a. Cafeteria Meal Planner
Scenario: A cafeteria provides different meals:
* Monday–Friday: Regular meals
* Saturday: Snacks
* Sunday: Special meals
Write a program to display the meal plan for a given day.
b. Write a C program to find if a given number is even or odd using if - else
statement.

11.a. Flight Ticket Price Calculator


Scenario: An airline offers ticket prices based on days left to departure:
* <10 days: ₹5000
* 10–20 days: ₹4000
* 20 days: ₹3000
Write a program to calculate the ticket price.
b. Glen and Mark were worried because they have shifted to a new house. As usual
there was confusion in the house as the AC in their room was not working. They
had to stay at some other room tonight. Out of the two rooms, one belongs to their
parents' and one belongs to their sister. Mark feels cold so he prefers a warm room
to sleep. Given the room temperature of the rooms , help them to select their room.

12.a. Count Words in a Sentence


Scenario: Write a program to count the number of words in a sentence.
b. Write a C program to find if a given number is positive, negative or zero using
nested if - else statement.

13.a. Daily Temperature Tracker


Context:
You are building a temperature tracker for a small community center to monitor
the daily temperature over a period of time. The system will store the temperature
readings for a specified number of days and allow the user to calculate statistics
like the maximum, minimum, and average temperature for that period.
UseCase:
The center's staff will input daily temperature readings into the program. The
system will process this data and allow the staff to view the maximum, minimum,
and average temperatures over a period of days.
b.Write a C program to print weekday based on given number using Ladder If -else
statement.
14.a. Stock Price Analyzer
Scenario: Fluctuations in Stock market is a common in a daily basis. Write a C
program to analyze stock prices to find the highest and lowest price.
b. Develop a simple scientific calculator using Switch case statement.

15.a. Analyze Voting Data


Scenario: A voting system records the votes for three candidates. Write a program
to determine the winner based on vote counts.
b. A Cartesian co-ordinate system has four quadrants. Write a C program to find
the quadrant of the co-ordinate points given by the user using both if-else and
nested if-else control structure.

16.a. Check for Strong Numbers


Scenario: Write a C program to check if a number is a strong number (sum of
factorials of its digits equals the number itself).
b. Write a C program to reverse the given number using while loop.

17.a. Calculate Age from Date of Birth


Scenario: A new employee has joined your company, and you are tasked with
verifying their date of birth to determine their current age. The employee provides
their date of birth as 15th March 1995. Today’s date is 23rd November 2024.
b. Write a C program to print the multiplication table using do-while loop.

18.a. Bank Account Interest Calculator


Scenario: A bank offers simple interest on savings accounts. Write a program to
calculate the interest earned for a given principal, rate, and time.
(Note: S.I. = (P × R × T)/100)
b. Write a C program to print Half Pyramid of * using for loop.
19. a.Warehouse Inventory Manager
Scenario: A warehouse stores items in an array. Write a program to add, delete, or
update the quantity of a specific item based on user input.
b. Product of two large prime numbers is used as encryption key in encryption
algorithms. Write a C program to display all the prime numbers between 1 to 100
and give the first two largest numbers as the output
warehouse stores items in an array. Write a program to add, delete, or update the

20.a. GPA Calculator for Students


A university is developing a system to calculate the Grade Point Average (GPA) of
its students based on their performance in 5 subjects. Each subject has an
associated grade (on a scale of 4.0) and credit hours. The GPA is calculated using
the formula:
GPA= Total Grade Points / Total Credit Hours
where total grade points for a subject are obtained by multiplying the grade with its
credit hours.
b. Given a rose flower to you, dismantle the petals of the flower from inside, if you
notice – it follows the sequence of Fibonacci. Now, try to arrange the word
"PIZZA" in several ways without repeating and calculate number of ways it can be
done using factorial concept. Write a C program to find both Fibonacci and
factorial by getting the mentioned input.

21.a. You are working on an online quiz application, and you want to include a
feature where a user is asked to input a number, and the application checks if the
number is prime or not. This helps the user learn about prime numbers as part of
the educational content. The system needs to determine if the number provided by
the user is prime. A prime number is one that is greater than 1 and has no divisors
other than 1 and itself.

b. You're playing UNO cards, suddenly a person is getting a rev card. Write a C
program to reverse the round by storing the number of players in the array.
22.a. You are building a mathematical learning tool for students that demonstrates
how to generate sequences in mathematics. One of the features is showing the
Fibonacci sequence, where each number is the sum of the two preceding ones. The
student can input a number N, and the tool will display all Fibonacci numbers up to
N. The system will generate the Fibonacci sequence up to a user-defined N to help
visualize the growth of the sequence.

b. Write a C program for Vehicle Regulation System where odd number ending
vehicles can use the road on odd days and even number ending vehicles can use the
road on even days using two separate arrays to store and display the odd and even
numbers.

23.a. Library System - Book Search

You are developing a simple library management system for a local library. The
library has a small collection of 5 books, and they want to create a feature where
users can quickly check if a specific book is available. This feature is particularly
useful for library staff or library visitors who want to see if a book is in stock
without having to browse physically through the shelves.A user (or library staff)
will input the title of a book they are looking for, and the system will check if that
book is available in the library's predefined list of books. If the book is available,
the system will inform the user, and if it's not, the system will notify the user that
the book is not available.

b. Write a C program to do the following applications in array to get a set of


positive and negative integers from the user, replace positive integers by 0 in the
array.

24.a. Restaurant Menu Selector


You are designing a simple ordering system for a restaurant, allowing customers to
select items from a menu, calculate the total cost of their order, and generate a
receipt. The system is intended to be used by both customers at a self-order kiosk
and wait staff taking orders in a fast-casual restaurant environment. A customer or
waiter selects items from a list of menu options, and the program calculates the
total cost based on the items chosen. This system should allow the user to easily
add multiple items to their order, such as appetizers, entrees, and drinks, and
automatically update the total cost.
b. Write a C program to do the following applications in array to reverse the
floating point numbers stored in the array.
25.a. ATM Withdrawal
You are designing a basic ATM system for a bank where customers can check
their account balance and withdraw money. The system will check whether the
customer has sufficient funds in their account to complete the withdrawal. If the
balance is insufficient, the system will notify the customer. If the balance is
sufficient, the system will deduct the requested amount from the account and
update the balance.A customer visits an ATM to withdraw a certain amount of
money. The ATM system verifies if the customer’s account balance is enough to
cover the withdrawal. If it is, the ATM dispenses the money and updates the
balance. If not, the customer is informed that the withdrawal cannot be completed
due to insufficient funds.
b. Write a C program to do the following applications in array to return the
smallest value and largest value position in the array.

26.a.Student Grades Calculator

You are building a student management system for a school that calculates the
average grade of a group of students and determines whether each student passes
or fails based on a given threshold (e.g., passing grade is 50%).A teacher enters the
grades of N students, and the system calculates the average grade for the class.
Based on the average grade, it also determines if each student has passed or
failed.If a student's grade is above the threshold (e.g., 50%), the system marks
them as “Pass,” otherwise “Fail.”
b. Write a C program to do the following applications in array to Search the
number '5' in array and replace it with '10'

27.a. Employee Payroll System


Scenario: You are developing a payroll system for a company that calculates
employee salaries based on their working hours. The system needs to account for
overtime by applying a higher hourly rate for hours worked beyond 40 hours in a
week.
Use Case:
Hourly Rate & Overtime: Employees are paid a regular hourly rate, but any
hours worked beyond 40 hours in a week are paid at an overtime rate (typically
1.5x the regular rate).
Payroll Calculation: The system asks for the number of hours worked by an
employee and calculates their weekly salary accordingly.
b.Write C program to do the following string handling applications to get favourite
actor and actress name, concatenate it and display .
28.a. E-Commerce Shopping Cart
Scenario: You are developing an e-commerce platform where customers can
browse items, add them to a shopping cart, and view the total cost of the items in
their cart, including any applicable discounts or taxes.
Use Case:
Adding Items: Customers can add multiple products to their cart, each with a
price.
Calculating Total: The system dynamically calculates the total cost of the cart
based on the added items, possibly factoring in discounts or taxes.
b. Write C program to do the following string handling applications to display your
name in uppercase, lowercase and as fname and lname.

29.a. Flight Booking System


Context:
You are building a flight booking system for an airline. The system allows
passengers to book seats on a flight, ensuring that no two passengers are assigned
the same seat. Each passenger will select a seat, and the system will keep track of
which seats are already booked. Once a seat is booked, it becomes unavailable for
other passengers.
UseCase:
A passenger will interact with the system to choose a seat from the available
options. The system will ensure that the seat is not already taken. If the seat is
available, it will be booked for the passenger, and the system will update the
availability of that seat. If the seat is already taken, the system will prompt the
passenger to choose another seat.
b. Write C program to do the following string handling applications to count the
frequency of "the" in any sentence and delete it from the sentence.

30.a. Employee Attendance System


Scenario:
You need to create a system to track the attendance of employees. The system
should mark the attendance of employees for a particular day and display who is
present and who is absent.
Input/Output Example:
 The user enters employee names and marks them as present or absent for the
day.
 The system displays the attendance status.
b. Write C program to do the following string handling applications to check
whether the given string is a palindrome or not.
31.a. Hotel Room Reservation System
Scenario:
Create a system to manage hotel room reservations. The system allows the user to
book rooms by selecting a room number and ensure that no two guests are assigned
the same room.
Input/Output Example:
 The user can choose to book a room.
 The system confirms the booking and marks the room as reserved.
b. Write a C program to compute the sum of the two input values. If the two values
are the same, then return triple their sum.

32.a.Library Fine Calculator


Scenario:
Create a system to calculate the fine for overdue library books. The fine is $0.50
per day for each day the book is overdue. The user inputs the number of days the
book is overdue, and the system calculates the fine.
Input/Output Example:
 The user enters the number of days the book is overdue.
 The system calculates the fine.
b. Write a C program that will take a number as input and find the absolute
difference between the input number and 51. If the input number is greater than 51,
it will return triple the absolute difference.

33. a.Leap Year Checker with Function and Input Validation


Scenario: Write a program that checks if a given year is a leap year using function.
The program will:
1. Check if the year is a positive integer.
2. Use a function to determine if the year is a leap year.
3. If the year is divisible by 4, it checks additional conditions:
o If divisible by 100, it must also be divisible by 400.
o If not divisible by 100, it is a leap year.
b. Write a C program that checks two given integers and returns true if at least one
of them is 30 or if their sum is 30. In other words, if either of the two integers is 30
or if their sum equals 30, the program will return true.
34.a. Lasya bought a new volleyball in the sports shop. It looks like a medium
size. She somehow found the radius of the sphere. But she would like to know the
volume of that ball. Can you help him in finding the Volume of the ball?
Volume = (4.0/3.0) × π × r^3
π = 3.14
b. Write a C program that checks if a positive integer is divisible by either 3 or 7,
or both. If the integer is a multiple of 3, then the program will return true.
Similarly, if the integer is a multiple of 7, then also the program will return true. If
the integer is not a multiple of 3 or 7, then the program will return false.

35.a. Nathan works as an HR in a private company. He had an opportunity to


interview students from various disciplines. He asked the candidates to perform
the addition of 5 integer numbers given by him using functions and to print the
output as a decimal with three values after decimal point. But the students failed
the math test on addition. So many students could not complete the first
round. One day Nathan is invited as a chief placement trainer in a reputed
engineering college. He willing to know how many students are capable of solving
the same problem.
b. Write a C program that prompts the user to input a series of integers until the
user stops by entering 0 using a do-while loop. Calculate and print the sum of all
positive integers entered.

36.a. Write a program to receive values of latitude (L1, L2) and longitude (G1,
G2), in degrees, of two places on the earth and output the distance (D) between
them in nautical miles. The formula for distance in nautical miles is:
D = 3963 cos-1( sin L1 sin L2 + cos L1 cos L2 * cos ( G2 – G1 ) )
b. Write a C program that generates a random number between 1 and 100 and asks
the user to guess it. Use a do-while loop to give the user multiple chances until
they guess the correct number.

37.a.Paul has bought three tires for his vehicle. Now he wants to find the smallest
one. Help him to calculate the area and circumference of a circle in terms of a flow
chart and a C program with sample input and output.
(Note: Area=πr2 Circumference= 2πr)
b. Write a C program that prompts the user to enter a password. Use a do-while
loop to keep asking for the password until the correct one is entered.
38. a.Gauss was given a numerical problem to solve as an assignment. The input
given is an integer number. He has to find the sum of the values from 1 to n.
Devise an algorithm and Flowchart to help him.
b. Write a C program that calculates the compound interest for a given principal
amount, interest rate, and time period. Use a do-while loop to allow the user to
input values multiple times.(Note: ((P*(1+i)^n) - P))

39.a. Rathik organized technical round interview in Msoft for the set of computer
science candidates. The problem is to perform addition, subtraction, multiplication,
and find the quotient and remainder of division of given two numbers. Rathik have
given the deadline of only 2 minutes to complete the problem.Can you Help the
candidates to complete the problem within the specified time limit using a C
Program and Flow Chart?
b. Write a C program that calculates the average of a set of numbers input by the
user. The user should be able to input as many numbers as desired, and the
program should continue until the user decides to stop.

40.a. Milina brought a water bottle and found its shape to be a cylinder. However,
she is sure of the quantity of water the bottle can hold. She somehow measured the
diameter and the height of the bottle. Help her to determine the capacity of the
bottle using a C Program and Flowchart. (Note: Volume: pi*r 2h)
b. Write a program in C to display the cube of the number up to an integer.

41.a. During the Test match between India and Srilanka, as a part of Asia Cup
tournament, a question was asked to the fans. Fans giving the correct answer will
get the free VIP box ticket to the inaugural match of upcoming ICC Men’s World
Cup. Help the fans to answer the question and to win free ticket by giving them the
solution in terms of flow chart and Program. Question: Who has got the more ODI
runs? [Biggest among three]

Sachin Tendulkar B. Brian Lara C. Ricky Ponting [Note: Run Scored by Sachin
Tendulkar – 18426, Brian Lara – 10405, Ricky Ponting– 13704]
b. Write a program in C to display the multiplier table vertically from 1 to n.
42.a. The management of a reputed engineering college has released the eligible
students list for the upcoming academic year. But Arpitha could not find her name
in the list. So, she gets confused about her eligibility for the admission. Can you
clarify her doubt by giving her the right solution using a flowchart and a program
using Functions? [Hint: Cut off mark above 190 is eligible. cutoff mark can be
calculated as follows (Physics mark/2 + Chemistry mark/2 +Mathematics mark).
b. Write a program in C to display the square of the number up to an integer.

43.a. A shop gives 30% discount to its customers if their birthday falls on a leap
year. So , Geeta wants to avail this offer help her to check whether her birth year is
leap year or not’.
b. Write a program in C to make such a pattern like a right angle triangle with a
number which will repeat a number in a row.

44.a. Lucky draw game is conducted in an exhibition , the winner is selected based
on the given criteria. Totally three numbers are placed , the person who gets the
highest number will be announced as the winner.
b. Write a C program to make such a pattern like a pyramid with a number which
will repeat the number in the same row.

45.a. A technical event is conducted in a college the incharge asked the participants
to find the ASCII value for their name, help them with a program to achieve it.
b. Write a C program that prompts the user to input a series of integers until the
user stops entering 0 using a while loop. Calculate and print the sum of all the
positive integers entered.

46.a. Geetha is given a task of writing her name in reverse order and then merge it
with her name . Help her to complete the task by using c program.
b. Write a C program that prompts the user to input a username. Use a while loop
to keep asking for a username until a valid one is entered (e.g., at least 8 characters
long).
47.a. King Indravarma ordered his servants to distribute gifts for the people. They
arranged for the gifts and kept them in a room. Dolu and Bolu is excited about
gifts. Kalia is up to his mischievous self again. He tied balloons to all the gifts that
the king had kept for distributing to the people. The balloons are tied in height of
50m to 90m above the ground. He challenged Bheem to shoot down the balloons
and collect all the gifts by blind folding his eyes. Write a program to help Bheem
to shoot down the balloons.
b. Write a Program to check if the given number is Even or Odd.

48.a. In Kolkata, every year during dhasara there will be a grand doll show. People
try to create new dolls of different varieties. The best sold doll's creator will be
awarded with a cash prize. So people break their head to create dolls innovatively.
Knowing this competition, Mr.Raju tried to create a doll which sings only when an
even number is pressed and the number should not be zero and greater than 100.
So write a C program to help Mr.Raju to win.
b. Write a C program that accepts two item's weight and number of purchases
(floating point values) and calculates their average value.

49. a.Mr. Vetri is a very rich businessman and he lost his family in the Gujarat
Earthquake. He lost interest in his business after the tragic incident and he decided
to serve the society. He started an NGO named after his only son Ishan to help the
earth-quake victims. Ishan Helpline will provide compensation to all earth quake
survivors. The compensation amount given to the survivors is not fixed and it
depends on the intensity of the earthquake. The expression Richter magnitude scale
refers to a number of ways to assign a single number to quantify the energy
contained in an earthquake.
Magnitude Type
2.4 or less Micro
2.5 to 5.4 Light
.5 to 6.0 Moderate
6.1 to 6.9 Strong
7.0 to 7.9 Major
8.0 or greater Great
Please help Ram to decide the intensity of the earthquake.
b. Write a Program to make a simple calculator.
50. a.A teacher tries to relate between the Angles inscribed in a circle and the
direction. Initially she wants to teach them the directions related with the angle’s
0,90,180,270 indicating East, North, West, South respectively. Write a C program
using selection statement to denote the direction graphically corresponding to the
angle entered.
b. Write a C program that prints “yes” if the given integer is divisible by 2 or 3 and
“no” otherwise.

51.a. Rangan is very weak in converting the numbers into months. But his friends
often tease him by asking him to convert a number into a month. To solve his
problem a close friend of him, suggested him to meet SIST students, who were
very good at programming. Can you please help him?
Input Format: Input consists of an integer.
Output Format: Output consists of the corresponding month and “There is no
month for this number” if the input is not in range between 1 and 12.
b. Write a C program using switch case to accept any single digit number and print
it in words.

52.a. THE CWG 2010 committee is bored with the usual long jump, high jump and
triple jump and they have decided to introduce a new game called staircase
climbing. The players need to climb a staircase. There are ‘n’ steps and each step is
1 meter higher than the previous one. The player who first reaches the top of the
staircase will be declared as the winner. The audio-visual committee is responsible
for placing pans and tilt cameras at all locations and one of their main objective is
to capture the winning moment in all the games. They were pondering on where to
place the camera for capturing the winning moment of the staircase climbing game.
Finally, they decided on placing the camera at the same height as the top of the
staircase. Given the number of steps 'n' and the height of the first step 'h', write a C
program to find the position where the camera needs to be placed.
Input Format: The input consists of 2 integers which correspond to n and h.
Output Format: Output consists of a single integer
b. Write a C program to print the series 1,4,7,10.... upto n terms.
53.a. A system checks whether the entered username and password are correct
before granting access. If the credentials match, access is allowed; otherwise,
access is denied. give answers for the above question using c program.
b. Write a C program to generate numbers between the given range and print the
numbers which are divisible by 2 and not divisible by 3 and 5.

54.a. Imagine you are working on a program for a math teacher who frequently
needs to swap two values for various calculations. The teacher asks you to create a
function that swaps two values (e.g., two numbers) using the Call by Value
method.
b. Write a ‘C’ Program using for loop to find the largest digit of a number.

55.a. Kavin was travelling from chennai to Hyderabad in car. The train has arrived
at the destination later than the estimated time due to inclement weather condition.
So, Kavin wants to know total number of hours and minutes the car was late. Help
him find using a C program Note: hrs=tot_min/60; min=tot_min%60.
b. Write a C program that accepts two item's weight and number of purchases
(floating point values) and calculates their average value.

56.a. Kaviya’s 6th birthday is coming in a week, her mother promised her that if
she find’s the total number of vowel in her name she will be gifted with a violin.
Help her to find the total number of vowels with the help of C program.
b. Write a C program to get the details of the student (roll no, name, date of birth,
state, 10th percentage and 12th percentage) using structure. Calculate the age of
the student and display the eligibility status for his admission. a. Eligibility criteria:
more than 60 percent in 10th and 12th, age>=17, state==TN

57.a. Numbers are displayed from 1 to 100 in a board .find the total of even
numbers and odd numbers using separate function.
b.Write a C program to create an employee Union with employee details (id, name,
salary) Accept the details of 'n' employees, rearrange the data in ascending order of
employee name, id and salary as three different functions and display it.
58.a. Rekha has completed her 10th board exams, she has to submit her overall
percentage along with next year’s application , help her to find the overall
percentage using c program.
b.Write a menu driven C program for library management system with ten entries:
a. (i). Add Book (ii). Add Author (iii). Add Category (iv). Book Cos (v). Display -
Book by Author, Book by Category, Book under cost

59.a. Book fair is conducted in school if a person buys 1 book the cost is 300, if the
person buys 2 books Rs.10 will be reduced from total cost, if a person buys 3
books Rs.20 will be reduced from total price,if a person buys 4 books Rs.30 will be
reduced from total bill and if a person buys more than 5 books Rs.60 will be
reduced from total price. Write this condition with the help of C program using
switch case.
b. Write a Program to Swap the values of two variables

60.a. Write a c program to find how many alphabets, numbers and special symbols
in the given string String=Cse@^10.
b. Write a Program to Calculate the Sum of Natural Numbers using recursion.

You might also like