0% found this document useful (0 votes)
5 views

CBP list

The document outlines multiple programming problem statements for students, covering various topics including student information tracking, car service charge calculations, negative number analysis in arrays, integer sorting, travel statistics, series summation, multiplicative persistence, and character conversions. Each problem includes input and output formats, constraints, and sample inputs and outputs to guide the implementation. The problems are designed to enhance programming skills through practical applications.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

CBP list

The document outlines multiple programming problem statements for students, covering various topics including student information tracking, car service charge calculations, negative number analysis in arrays, integer sorting, travel statistics, series summation, multiplicative persistence, and character conversions. Each problem includes input and output formats, constraints, and sample inputs and outputs to guide the implementation. The problems are designed to enhance programming skills through practical applications.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 23

Total – 62 students

2 students are not turning up 18 & 53


No of batches = 60/4 = 15
Problem Statement – 1 (Roll numbers 2401-2404)

Reo, a diligent student, is working on a program to keep track of student


information including name, marks, and grade. Help Reo develop a program that
takes input for a student's name, marks, and grade, and then prints a report
format
Input Format
The first line of input consists of a string, representing the name of the student.
The second line of input consists of a float value, representing the mark of the
student.
The third line of input consists of a character, representing the grade of the
student.
Output Format
The output prints the given name, mark(rounded up to 2 decimal places), and
grade of the student in the following format:
"Name: <name>
Mark: <marks>
Grade: <grade>"

Refer to the sample output for the formatting specifications.


Constraints
The name can have a maximum length of 249 characters.
0.0 <= marks <= 100.0
The grade is a single character.
Sample Input Sample Output
Alan
56.5
D
Name: Alan
Mark: 56.50
Grade: D
Sample Input Sample Output
Bob
98.35
A
Name: Bob
Mark: 98.35
Grade: A

Problem Statement – 2 (Roll numbers 2405-2408)

Rahul manages a car service facility and wants to calculate the service charges
for cars based on the time they have spent at the facility. The program takes the
number of cars 'n' and the hours each car has been at the facility.

It then calculates the service charges according to specific conditions and


displays the car number, hours of service, and the corresponding charges for
each car. Rahul uses this program to efficiently manage his car service
operations.

1. Up to 3 hours: Rs. 30.0


2. Beyond 3 hours: Rs. 30.0 + (hours - 3) * Rs. 5.0
3. Exactly 24 hours: Rs. 80.0
Input Format
The first line consists of an integer n, representing the number of cars.
The next n lines consists of two integers, representing the car number and the
number of hours that the respective car has spent at the facility.
Output Format
For each car, the output displays three values separated by spaces, representing
the car number, the hours of service, and the corresponding service charges.
The service charges are a float value, rounded to two decimal places.

Refer to the sample output for the formatting specifications.


Constraints
In the given scenario, the test cases fall under the following constraints:
2 ≤ n ≤ 10
1 ≤ hours ≤ 24
Sample Input -1
3
1867 3
5382 5
2407 24
Sample Output -1
1867 3 30.00
5382 5 40.00
2407 24 80.00
Sample Input -2
2
3245 1
7851 15
Sample Output -2
3245 1 30.00
7851 15 90.00
Sample Input-3
10
1234 4
1245 8
1456 10
7896 23
1111 12
2244 15
3247 20
1478 6
1498 10
3457 24
Sample Output - 3
1234 4 35.00
1245 8 55.00
1456 10 65.00
7896 23 130.00
1111 12 75.00
2244 15 90.00
3247 20 115.00
1478 6 45.00
1498 10 65.00
3457 24 80.00
Time Limit: - ms Memory Limit: - kb Code Size: - kb

Problem Statement – 3 (Roll numbers 2409-2412)

Raveena is developing a program to analyze an integer array. Her task is to


identify and tally the negative numbers within this array. This analysis is crucial
for Raveena's dataset, as negative values might represent specific conditions or
anomalies that require further investigation.

Write a program that assists Raveena in counting and displaying the number of
negative elements in an integer array.
Input Format
The first line of input consists of an integer n, representing the number of
elements in the array.
The second line of input consists of n space-separated integers, representing the
elements of the array.
Output Format
If there are no negative elements in the array, the output prints "No negative
elements in the array".
Otherwise, the output prints "Total negative elements in array = " followed by an
integer which is the total count of negative elements in the array.
Refer to the sample output for the formatting specifications.
Constraints
In this scenario, the test cases will fall under the following constraints:
3 ≤ n ≤ 10
-1000 ≤ elements ≤ 1000
Sample Input - 1
10
10 -2 5 -20 1 50 60 -50 -12 -9
Sample Output -1
Total negative elements in array = 5
Sample Input - 2
5
63219
Sample Output - 2
No negative elements in the array
Sample Input - 3
3
-1000 -99 1000
Sample Output -3
Total negative elements in array = 2
Time Limit: - ms Memory Limit: - kb Code Size: - kb

Problem Statement – 4 (Roll numbers 2413-2416)


Philip needs a program that reads 10 integers from the user and checks if all the
integers are the same. If they are not the same, the program should sort the
integers in ascending order and display the sorted array. If all integers are the
same, it should simply indicate this.

Help Philip by writing a program to achieve this functionality.


Input Format
The input consists of an array of 10 integers separated by space.
Output Format
If the numbers are not the same, the output displays "Arranged elements are: "
followed by the input array sorted array in ascending order separated by space.
If the numbers are the same, the output displays "All numbers are the same".

Refer to the sample output for the formatting specifications.


Constraints
-105 ≤ each element ≤ 105
Sample Input -1
10 12 13 234 45 34 67 78 76 12
Sample Output -1
Arranged elements are: 10 12 12 13 34 45 67 76 78 234
Sample Input - 2
12 12 12 12 12 12 12 12 12 12
Sample Output -2
All elements are the same
Sample Input - 3
1 2 -3 -4 5 -6 7 -8 9 10
Sample Output - 3
Arranged elements are: -8 -6 -4 -3 1 2 5 7 9 10

Problem Statement – 5 (Roll numbers 2417-2421)

Angela, a transportation manager, is responsible for tracking the travel statistics


of vehicles in a fleet. She seeks your help to write a program that inputs the total
number of segments travelled by the vehicles.

For each segment, input the distance travelled (in kilometres) and the speed (in
kilometres per hour) of the vehicle. Calculate the total distance travelled and the
total time taken by all vehicles in the fleet.

Formula: Time = Distance / Speed


Input Format
The first line of input consists of an integer N, representing the total number of
segments each vehicle travels.
The next N lines of input consist of two space-separated double values D and S,
representing the distance traveled and speed of the vehicle on each segment.
Output Format
The first line of output prints "Total Distance: X km", where X is a double value
rounded off to two decimal places.
The second line prints "Total Time: Y hours", where Y is a double value rounded
off to two decimal places.

Refer to the sample output for formatting specifications.


Constraints
In this scenario, the test cases fall under the following constraints:
1 ≤ N ≤ 10
1.0 ≤ D, S ≤ 150.0
Sample Input -1
2
10.5 60.5
15.3 45.4
Sample Output -1
Total Distance: 25.80 km
Total Time: 0.51 hours
Sample Input -2
3
20.9 50.2
30.7 40.5
25.5 55.3
Sample Output -2
Total Distance: 77.10 km
Total Time: 1.64 hours
Sample Input -3
1
20.1 55.3
Sample Output - 3
Total Distance: 20.10 km
Total Time: 0.36 hours

Problem Statement – 6 (Roll numbers 2422-2425)


Jonathan is working on a task that involves calculating the sum of a series for a
given number of terms. The series consists of alternating positive and negative
even numbers starting from 2. (2 - 4 + 6 - 8 + 10 - ... for n terms)

Jonathan needs assistance in creating the program using loops to accomplish his
task.
Input Format
The input consists of an integer N, representing the number of terms the sum is
to be calculated.
Output Format
The output prints "Sum of the series: " followed by an integer representing the
total sum.

Refer to the sample output for the formatting specifications.


Constraints
In this scenario, the test cases fall under the following constraints:
2 ≤ N ≤ 100
Sample Input -1
10
Sample Output -1
Sum of the series: -10
Sample Input -2
5
Sample Output -2
Sum of the series: 6

Problem Statement – 7 (Roll numbers 2426-2429)


Elisa wants to develop a program to calculate the multiplicative persistence of a
number M, which is the number of times you must multiply the digits of M until
you get a single digit, then multiply this result by N and print the output.

Since she finds this calculation as a complicated process, she seeks your help in
developing the program. Assist her in completing the program using looping
statements.

Example

Input:
M = 123
N=2

Output:
Step 1: 6
Final result after multiplying by 2: 12

Explanation:
The initial value of M is 123 and the multiplier N is 2. The multiplicative
persistence of 123 is 1, as it takes one step to multiply its digits (1 * 2 * 3 = 6)
and obtain a single-digit number. Then, the final result is obtained by multiplying
the persistence result (6) by the multiplier N (2), resulting in a final product of
12.
Input Format
The first line of input consists of an integer M.
The second line of input consists of an integer N.
Output Format
For each step, the output prints "Step X: Y", where X represents the current step
count, and Y represents the current product value after computing the product of
its digits.
After the loop terminates, the output prints "Final result after multiplying by N: "
followed by an integer representing the final product value.

Refer to the sample output for the formatting specifications.


Constraints
In this scenario, the test cases fall under the following constraints:
100 < M < 109
1 ≤ N ≤ 10
Sample Input -1
123
2
Sample Output-1
Step 1: 6
Final result after multiplying by 2: 12
Sample Input -2
9999999
2
Sample Output -2
Step 1: 4782969
Step 2: 217728
Step 3: 1568
Step 4: 240
Step 5: 0
Final result after multiplying by 2: 0

Problem Statement – 8 (Roll numbers 2430-2433)


Raksha loves to learn twisted maths questions. She wants to find the sum of all
integers less than N that are divisible by X.

Write a program to obtain N and X as input from the user and print the sum of all
the integers less than N(exclusive) that are divisible by X.
Input Format
The input consists of two integers N and X in separate lines.
Output Format
The output prints the sum of all the integers less than N (exclusive) that are
divisible by X.

Refer to the sample output for formatting specifications.


Constraints
In this scenario, the test cases fall under the following constraints:
3 ≤ N ≤ 100
2 ≤ X ≤ 10
Sample Input -1
3
2
Sample Output -1
2
Sample Input -2
10
2
Sample Output-2
20
Sample Input -3
100
10
Sample Output-3
450

Problem Statement – 9 (Roll numbers 2430-2433)


Imagine you are designing a game-level progression system where players
attempt to complete levels with two chances. The player can earn bonus points
based on their performance in each level. You are given

1. Bonus points are awarded for each successful level.


2. The player attempts to complete a level by entering their response (Y for
Yes, N for No).

The program should then simulate the following scenario:

1. If the player completes the level in the first attempt, they earn 10 times
the bonus points.
2. If the player completes the level in the second attempt, they earn 5 times
the bonus points.
3. If the player fails to complete the level within the maximum attempts
allowed, the program skips to the next level.
Input Format
The first line of input consists of a positive integer, P representing the bonus
points awarded for each level.
The second line of input consists of a character (Y for Yes, N for No) representing
the player's first attempt to complete a level.
If the second line of input is 'N', the third line of input consists of another
character(Y for Yes, N for No) representing the result of the second attempt.
Output Format
The output prints one of the following:

If the player passes the level on the first attempt,


1. The first line of output prints "Level completed successfully in the first
attempt!"
2. The second line of output prints "Bonus points awarded: " followed by an
integer.

If the player passes the level on the second attempt,


1. The second line of output prints "Level completed successfully in the
second attempt!"
2. The third line of output prints "Bonus points awarded: " followed by an
integer.

Otherwise, the output prints "Maximum attempts reached."

Refer to the sample output for the formatting specifications.


Constraints
In this scenario, the test cases fall under the following constraints:
1 ≤ P ≤ 100
Sample Input -1
25
Y
Sample Output-1
Level completed successfully in the first attempt!
Bonus points awarded: 250
Sample Input -2
10
n
y
Sample Output -2
Level completed successfully in the second attempt!
Bonus points awarded: 50
Sample Input -3
20
N
N
Sample Output-3
Maximum attempts reached.
Time Limit: - ms Memory Limit: - kb Code Size: - kb

Problem Statement – 10 (a) (Roll numbers 2434-2437)

James is working on a fitness app that helps weightlifters track their progress.
One of the app's essential features is that it allows users to enter the weight they
lift in pounds and then display the weight in kilograms for accurate tracking.

Write a program that takes the weight lifted in pounds as input and converts it to
kilograms as float using the type conversion factor

Forumula: 1 pound = 0.453592 kilograms


Input Format
The input consists of an integer value that represents the weight lifted in pounds,
n.
Output Format
The output should display the float weight in kilograms rounded off to four
decimal places as shown in the sample outputs.

Refer to the sample output for the formatting specifications.


Constraints
0 < n <= 500
Sample Input 1
1
Sample Output1
0.4536 kg
Sample Input 2
5
Sample Output 2
2.2680 kg

Problem Statement – 11 (Roll numbers 2438-2441)


Sarah is developing a program that needs to handle character conversions. Users
will input a character, and your program should convert it to its corresponding
ASCII value. This type conversion is essential for the data encoding process in
the application you are building.

Write a program that takes a single character as input from the user. The
program should then convert the character to its ASCII value using the Type
conversion and display it. Also, the output should print the next character of the
given input.
Input Format
The input consists of a character.
Output Format
The first line prints the ASCII value of the input character.
The second line prints the next character of the given input.

Refer to the sample output for the formatting specifications.


Constraints
The input character should be a printable character (ASCII values between 32
and 126).
The next character should wrap around if the input character is the last printable
character (i.e., if the input is ~ with ASCII 126, the next character will be with
ASCII 32).
Sample Input 1
S
Sample Output 1
83
T
Sample Input 2
8
Sample Output 2
56
9
Sample Input 3
"
Sample Output 3
34
#

Problem Statement – 12 (Roll numbers 2442-2445)

At the community center’s crafting workshop, you need to determine the final
cost of a new material based on its dimensions. First, calculate the initial cost by
multiplying the length and width of the material, resulting in a floating-point
number. This initial cost is then converted to an integer for further adjustments.

Based on the user’s choice, adjust the integer value as follows: If the choice is 1,
add 5 to the converted integer. If the choice is 2, subtract 5 from it. If the choice
is 3, divide the converted integer by 2. The choice is indicated by an integer
input (1, 2, or 3).

Your task is to output the initial cost formatted as a floating-point number with
two decimal places and the final adjusted integer cost according to the chosen
operation.
Input Format
The first line consists of two space-separated float values num1 and num2,
representing the first and second dimensions of the material.
The second line contains an integer choice, which indicates the adjustment
operation to be performed (1, 2, or 3).
Output Format
The first line displays "Multiplication Result (as float): " followed by the result of
multiplying num1 and num2 as a float value with two decimal values.
The second line displays "Converted Integer: " followed by the result as an
integer value after performing the required operation on the converted result
based on the choice.

Refer to the sample output for the formatting specifications.


Constraints
In the given scenario, the test cases fall under the following constraints:
1.0 ≤ num1, num2 ≤ 100.0
1≤n≤3
Sample Input 1
1.0 5.4
1
Sample Output 1
Multiplication Result (as float): 5.40
Converted Integer: 10
Sample Input 2
76.5 100.0
2
Sample Output 2
Multiplication Result (as float): 7650.00
Converted Integer: 7645
Sample Input 3
56.7 64.5
3
Sample Output 3

Multiplication Result (as float): 3657.15


Converted Integer: 1828
Problem Statement – 13 (Roll numbers 2446-2449)
You are the manager of a popular coffee shop that prides itself on offering a wide
variety of caffeinated beverages to its customers. To ensure that your customers
are well-informed about their caffeine intake, you decide to implement a caffeine
tracking system for your coffee shop.

Design a program for the coffee shop's caffeine tracking system. The program
should prompt the user to enter the caffeine content of a beverage in milligrams
and then display the equivalent caffeine content in grams.

Write a program that takes the input for the caffeine content in milligrams,
converts it into grams as float using type conversion, and prints the two decimal
points with the grams.
Input Format
The input consists of an integer representing the caffeine content of a beverage
in milligrams.
Output Format
The output displays the equivalent caffeine content in grams as a float value,
rounded off 2 decimal points.
Constraints
0 <= milligrams <= 1000
Sample Input 1
10
Sample Output 1
0.01
Sample Input 2
500
Sample Output 2
0.50

Problem Statement – 14 (Roll numbers 2450-2454)


In a small office, there's a unique challenge that the staff faces every day. They
have a special machine that helps them process letters, but the machine can
only display the ASCII values of characters.
Your task is to help the staff by creating a program that converts characters to
their opposite cases and shows the ASCII value of the resulting character. If they
enter any other character (e.g., a number or punctuation mark), the machine
should simply show the ASCII value of that character.
Input Format
The input consists of the character value c.
Output Format
The ASCII value of the resulting character after conversion or the original
character if no conversion is applicable.

Refer to the sample output for the formatting specifications.


Constraints
In the given scenario, the test cases fall under the following constraints:
Valid ASCII characters must be given as input.
Sample Input Sample Output
A
ASCII Value: 97
Sample Input Sample Output
~
ASCII Value: 126
Sample Input Sample Output
z
ASCII Value: 90
Sample Input Sample Output
3
ASCII Value: 51
Problem Statement – 15 (Roll numbers 2455-2458)
Fin is managing salary taxation and wants a program to determine the net
salaries based on the provided salary amount. Determine the net salary:

1. If the salary is less than 50000, print "No Tax."


2. For salaries between 50000 (inclusive) and 100000 (exclusive), apply 10%
tax and print the net salary after deduction.
3. For 100000 or more, apply 20% tax and print the net salary after
deduction.

Implement a program that takes Fin's salary as input (integer) and calculates the
net salary after converting it into float.
Input Format
The input consists of an integer value n, representing Fin's monthly salary.
Output Format
If no tax is applicable, the output prints "No Tax"
If a tax is applicable, the output prints "Salary after X% Tax: Y" where X
represents the applicable tax percent value and Y represents the net salary after
deduction with two decimal places.

Refer to the sample output for the formatting specifications.


Constraints
In this scenario, the test cases fall under the following constraints:
1000 ≤ n ≤ 120000
Sample Input Sample Output
40000
No Tax
Sample Input Sample Output
60000
Salary after 10% Tax: 54000.00
Sample Input Sample Output
120000
Salary after 20% Tax: 96000.00

Problem Statement – 16 (Roll numbers 2459-2462)

Raj, a budding programmer, is practicing array manipulation. He is working on a


program to find the largest element in a matrix. Can you assist him in creating
the code?
Write a program that takes the row and column size of the matrix as input and
finds the largest element in it. Raj wants to know the maximum value in the
matrix to understand array operations better.
Input Format
The first line consists of two space-separated integers r and c, representing the
row and column size of the matrix.
The next r lines consist of c space-separated integers, which represent the
elements of the matrix.
Output Format
The output displays a single line containing the message "Largest element: X",
where X is the largest element in the input matrix.

Refer to the sample output for the formatting specifications.


Constraints
In the given scenario, the test cases fall under the following constraints:
2 ≤ r, c ≤ 5
0 ≤ elements ≤ 100
Sample Input Sample Output
33
945
673
208
Largest element: 9
Sample Input Sample Output
53
58 79 45
14 18 67
14 25 100
14 28 63
13 24 71
Largest element: 100
Sample Input Sample Output
24
15 18 38 64
28 97 48 83
Largest element: 97

Problem Statement - 17

Ria is a football enthusiast who wants to keep track of her favourite team's
performance in a tournament. She needs to develop a program that calculates
the total points earned by the team based on the outcomes of their matches.

In the tournament, a win earns the team 3 points, a draw earns them 1 point,
and a loss earns them 0 points. As a programmer, assist Ria in developing the
program.

Example

Input:
5
20121
Output:
Total points: 8
Explanation:
Match 1: Win - 3 points
Match 2: Loss - 0 point
Match 3: Draw - 1 point
Match 4: Win - 3 points
Match 5: Draw - 1 point
Total points = 3 + 0 + 1 + 3 + 1 = 8 points.
Input Format
The first line of input consists of an integer N, representing the number of
matches played by the team.
The second line consists of N space-separated integers, representing the
outcome of each match (0, 1, or 2), where 0 means a loss, 1 means a draw and 2
means a win.
Output Format
The output prints "Total points: " followed by the total number of points earned
by the team in the tournament.

Refer to the sample output for formatting specifications.


Constraints
In this scenario, the test cases fall under the following constraints:
1 ≤ N ≤ 10
Sample Input Sample Output
5
20121
Total points: 8
Sample Input Sample Output
4
1210
Total points: 5
Sample Input Sample Output
3
002
Total points: 3

Problem Statement - 18

Claire, a software developer, is tasked with designing a program to calculate the


sum of all numbers less than a given limit that are multiples of either of two
specified numbers.

She requires a program wherein she can input three integers: N representing the
limit, M representing one multiple, and P representing another multiple. Upon
execution, the program should output the sum of these multiples within the
given limit for Claire's analysis.
Input Format
The input consists of three space-separated integers: an integer N representing
the limit, an integer M representing one of the multiples, and an integer P
representing another multiple.
Output Format
The output displays an integer which is the calculated sum.

Refer to the sample output for the formatting specifications.


Constraints
In this scenario, the test cases fall under the following constraints:
10 ≤ N ≤ 1000
2 ≤ M, P ≤ 10
Sample Input Sample Output
10 2 3
32
Sample Input Sample Output
156 2 5
7286
Time Limit: - ms Memory Limit: - kb Code Size: - kb

You might also like