KEMBAR78
Class 10 Computer | PDF | Data Type | Interest
0% found this document useful (0 votes)
9 views7 pages

Class 10 Computer

The document contains a series of programming exercises for Class 10 students, focusing on Java programming concepts. Each question requires the student to write a specific Java program to solve various problems, including calculating interest, converting units, and working with mathematical formulas. The exercises cover a wide range of topics, such as loops, conditionals, and user input handling.

Uploaded by

yadavdarsh020310
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)
9 views7 pages

Class 10 Computer

The document contains a series of programming exercises for Class 10 students, focusing on Java programming concepts. Each question requires the student to write a specific Java program to solve various problems, including calculating interest, converting units, and working with mathematical formulas. The exercises cover a wide range of topics, such as loops, conditionals, and user input handling.

Uploaded by

yadavdarsh020310
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/ 7

Class 10

Question 1. Write a program in Java that takes input using the Scanner class to
calculate the Simple Interest and the Compound Interest with the given values:
i. Principle Amount = Rs.100000
ii. Rate = 11.5%
iii. Time = 5 years
Display the following output:
i. Simple interest
ii. Compound interest
iii. Absolute value of the difference between the simple and compound interest.

Question 2. Write a program to compute the Time Period (T) of a Simple Pendulum
as per the following formula:
T = 2π√(L/g)
Input the value of L (Length of Pendulum) and g (gravity) using the Scanner class.

Question 3. Write a program that takes the distance of the commute in kilometres, the car
fuel consumption rate in kilometre per gallon, and the price of a gallon of petrol as input.
The program should then display the cost of the commute.

Question 4. Write a program in Java that accepts the seconds as input and converts
them into the corresponding number of hours, minutes and seconds. A sample output is
shown below:
Enter Total Seconds:
5000
1 Hour(s) 23 Minute(s) 20 Second(s)

Question 5. Write a program in Java, using the Scanner methods, to read and display
the following details:
Name - as a String data type
Roll Number - as an integer data type
Marks in 5 subjects - as a float data type
Compute and display the percentage of marks.

Question 6. Write a program in Java to find the maximum of three numbers using
Math.max() method.

Question 7. Write a program to compute and display the value of expression:


2 3 4
1/x +1/y +1/z
where, the values of x, y and z are entered by the user.

Question 8. Write a program to generate random integers in the following ranges:


i. 10 to 20 (both inclusive)
ii. 25 to 50 (both inclusive)
Question 9. Write a program in Java to compute the final velocity of a vehicle using
the following formula:
v2=u2+2as
where, u = initial velocity, a = acceleration and s = distance covered; they are entered by
the user.

Question 10. Create a program to find out if the number entered by the user is a two,
three or four digits number.
Sample input: 1023
Sample output: 1023 is a 4 digit number.

Question 11. Write a program in Java to read three integers and display them in
descending order.

Question 12. Using the ternary operator, create a program to find the largest of three
numbers.

Question 13. Write a program that reads a month number and displays it in words.

Question 14. Admission in a professional course is subject to the following criteria:


Marks in Physics >= 70
Marks in Chemistry >= 60
Marks in Mathematics >= 70
Total marks in all subjects >= 225
Or
Total marks in Physics and Mathematics >= 150
Write a program in Java to accept marks in these 3 subjects (Physics, Chemistry, and
Mathematics) and display if a candidate is eligible.

Question 15. Using the switch statement in Java, write a program to display the name
of the city according to the user's choice.
D — Delhi, M — Mumbai, K — Kolkata, C — Chennai

Question 16. Employees at ABC Consulting earn the basic hourly wage of Rs.500. In
addition to this, they also receive a commission on the sales they generate while tending the
counter. The commission given to them is calculated according to the following table:
Total Sales Commmision Rate
Rs. 100 to less than Rs. 1000 1%
Rs. 1000 to less than Rs. 10000 2%
Rs. 10000 to less than Rs. 25000 3%
Rs. 25000 and above 3.5%
Write a program in Java that inputs the number of hours worked and the total sales.
Compute the wages of the employees.
Question 17. Write a program in Java to compute the perimeter and area of a triangle,
with its three sides given as a, b, and c using the following formulas:
Perimeter=a+b+c
Area=√𝑠(𝑠 − 𝑎)(𝑠 − 𝑏)(𝑠 − 𝑐)
𝑎+𝑏+𝑐
Where s=
2

Question 18. Mayur Transport Company charges for parcels as per the
following tariff:
Weight Charges
Upto 10 Kg. Rs. 30 per Kg.
For the next 20 Kg. Rs. 20 per Kg.
Above 30 Kg. Rs. 15 per Kg.
Write a program in Java to calculate the charge for a parcel, taking the weight of the parcel
as an input.

Question 19. The electricity board charges the bill according to the number of units
consumed and the rate as given below:
Units Consumed Rate Per Unit
First 100 units 80 Paisa per unit
Next 200 units Rs. 1 per unit
Above 300 units Rs. 2.50 per unit
Write a program in Java to accept the total units consumed by a customer and calculate the
bill. Assume that a meter rent of Rs. 500 is charged from the customer.

Question 20. Write a menu driven program to accept a number from the user and
check whether it is a Buzz number or an Automorphic number.
i. Automorphic number is a number, whose square's last digit(s) are equal to that number.
For example, 25 is an automorphic number, as its square is 625 and 25 is present as the last
two digits.
ii. Buzz number is a number, that ends with 7 or is divisible by 7.

Question 21. Write a Java program in which you input students name, class, roll
number, and marks in 5 subjects. Find out the total marks, percentage, and grade according
to the following table.
Percentage Grade
>=90 A+
>=80 and <90 A
>=70 and <80 B+
> =60 and <70 B
Percentage Grade
>=50 and <60 C
>=40 and <50 D
<40 E

Question 22. Write a program in Java to accept three numbers and check whether they
are Pythagorean Triplet or not. The program must display the message accordingly. [Hint:
h2=p2+b2]

Question 23. Using switch case, write a program to convert temperature from
Fahrenheit to Celsius and Celsius to Fahrenheit.
Fahrenheit to Celsius formula: (32°F - 32) x 5/9
Celsius to Fahrenheit formula: (0°C x 9/5) + 32

Question 24. Star mall is offering discount on various types of products purchased by
its customers. Following table shows different type of products and their respective code
along with the discount offered. Based on the code entered, the mall is calculating the total
amount after deducting the availed discount. Create a program to calculate total amount to
be paid by the customer.
Item Item Code Discount
Laptop L 5%
LCD D 7%
XBox X 10%
Printer P 11%

Question 25. Write a menu driven program to display the following menu:
Conversion Table
============
Milliseconds to Seconds
Milliseconds to Minutes
Seconds to Milliseconds
Seconds to Minutes
Minutes to Milliseconds
Minutes to Seconds
For an incorrect choice, display an appropriate error message.
Hint: 1 second = 1000 milliseconds

Question 26. Using the switch statement, write a menu driven program:
To check and display whether a number input by the user is a composite number or not.
A number is said to be composite, if it has one or more than one factors excluding 1 and the
number itself.
Example: 4, 6, 8, 9...
To find the smallest digit of an integer that is input:
Sample input: 6524
Sample output: Smallest digit is 2
For an incorrect choice, an appropriate error message should be displayed.

Question 27. Write a program to print the sum of negative numbers, sum of positive
even numbers and sum of positive odd numbers from a list of n numbers entered by the
user. The program terminates when the user enters a zero.

Question 28. Write a menu driven class to accept a number from the user and check
whether it is Palindrome or a Perfect number.
Palindrome number: A number is a Palindrome which when read in reverse order is same
as read in the right order Example: 11, 101, 151, etc.
Perfect number: A number is called Perfect if it is equal to the sum of its factors other than
the number itself.
Example: 6 = 1 + 2 + 3

Question 29. Write a program in Java to find the sum of the given series:
S = 1 + 3 + 7 + 15 + 31 + ..... n term.

Question 30. Write a program in Java to find the sum of the given series:
S = x /2!+x /3!+x /4!+...+xn/n!,where n = 10
2 3 4

Question 31. Write a program in Java to find the sum of the given series:
S = (x+1)/3+(x+2)/5+(x+3)/7+……………...to n terms.

Question 32. Write a program in Java to find the sum of the given series:
S = 1/2+2/3+3/4+...+49/50

Question 33. Write a program in Java to compute and display factorial of numbers up
to a number entered via the Scanner class. The output should look like as shown below
when 7 is input.
Enter a number: 7
1! (=1) = 1
2! (= 1 x 2) = 2
3! (= 1 x 2 x 3) = 6
4! (= 1 x 2 x 3 x 4) = 24
5! (= 1 x 2 x 3 x 4 x 5) = 120
6! (= 1 x 2 x 3 x 4 x 5 x 6) = 720
7! (= 1 x 2 x 3 x 4 x 5 x 6 x 7) = 5040

Question 34. Using the switch statement, write a menu driven program to:
Generate and display the first 10 terms of the Fibonacci series 0, 1, 1, 2, 3, 5.... The first
two Fibonacci numbers are 0 and 1, and each subsequent number is the sum of the previous
two.
Find the sum of the digits of an integer that is input.
Sample Input: 15390
Sample Output: Sum of the digits = 18
For an incorrect choice, an appropriate error message should be displayed.

Question 35. Write a program to accept a number and check and display whether it is
a Niven number or not. (Niven number, number which is divisible by the sum of its digits).
Example:
Consider the number 126.
Sum of its digits is 1 + 2 + 6 = 9 and 126 is divisible by 9.

Question 36. Write a program to determine if an entered number is a Happy Number.


A happy number is defined by the following process:
Starting with any positive integer, replace the number by the sum of the squares of its
digits, and repeat the process until the number is equal to 1.
For example, 19 is a happy number, as per the following calculation:
12 + 92 = 82,
82 + 22 = 68,
62 + 82 = 100,
12 + 02 + 02 = 1

Question 37. Write a program to print the series given below.


8 88 888 8888 88888 888888

Question 38. Write a program in Java to display the following patterns.


12345
2345
345
45
5
45
345
2345
12345

Question 39. Write a menu driven program in Java to display the following patterns.
1. $ $ $ $ 5
$$$4
$$3
$2
1
2. 1 * * * *
22***
333**
4444*
55555
Question 40. Write a menu driven program that prompts the user to select one of the
four triangle patterns (a, b, c, or d). The program then accepts number of rows and prints
the selected pattern as shown below:
Enter the size : 8
(a)
#
##
###
####
#####
######
#######
########
(b)
########
#######
######
#####
####
###
##
#

You might also like