Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

CLASS X (2023-24)

INTERNAL ASSESSMENT (PROJECT) -100 MARKS

Note: Programs 1 to 7 is to completed during summer vaccation

Programming Assignments:

• The students have to complete 20 laboratory (programming) assignment


during the whole year to reinforce the concept studied in class IX and X.
• The students should purchase a practical copy of minimum of 200 pages in which you have
to write 20 assignments.
• In first page write your details (i.e. Name, class, section, roll no.)
• In second page write acknowledgement
• Then make an index to write down the list of all assignment questions.
• In each assignment first, you write the program question then program code then variable
description list in ruled (lining) pages.
• The student has to mention the output of the program in white page in front of the program
code.
• Final Submission date : 01/12/2023

ASSIGNMENTS OF ACADMIC YEAR 2022-23


PROGRAM 1 :
Write a program to input the three sides of a triangle and check whether it forms a triangle or not.
If it forms a triangle, check whether it is an equilateral, isosceles or a scalene triangle. (Hint: To
form a triangle, each side should be less than the sum of the other two sides)

PROGRAM 2 :
Write a program to input a number and print whether the number is a niven number or not. A niven
number is the number which is divisible by the sum of its digits.
Example:
111
Sum of digits= 1+1+1=3
111 is divisible by 3, hence 111 is a niven number.

PROGRAM 3 :
Write a menu driven program to
a) find first 5 multiples of any number n.
Example: Input: n= 6
Output: First 5 multiples of 6 are: 6, 12, 18, 24, 30

b) find all factors of any number n


Example: Input: n=6
Output: All factors of 6 are: 1,2,3,6
PROGRAM 4 :
Write a program to accept any two numbers from the user and print their ‘GCD’ (Greatest Common
Divisor) and LCM (lowest common multiple).

PROGRAM 5:
Write a program to accept any three integers using Scanner class functions. Find out the greatest number
among them, using if else statements.

PROGRAM 6 :
A cloth showroom has announced the following festival discounts on the purchase of items, based on the total
cost of the items purchased:
Total Cost Discount (in Percentage)
Less than ₹ 2000 5%
₹ 2001 to ₹ 5000 25%
₹ 5001 to ₹ 10000 35%
Above ₹ 10000 50%
Write a program to input the total cost and compute and display the amount to be paid by the customer after
availing the discount.

PROGRAM 7 :
Write a program in java to print the following patterns:
Pattern 1:
*12345
**2345
***345
****45
*****5

Pattern 2:
9
87
654
3210

PROGRAM 8 :
Write a program to create an array of size m X n and print the sum of all the numbers row wise .

PROGRAM 9 :
Write a program to accept the marks in physics, chemistry and maths secured by 40 students of a class in
single dimensional array. Find and display the following
• Number of students securing 80% and above percentage
• Number of students securing 34 % and below percentage.
PROGRAM 10 :
Write a program to input 40 numbers in an array. Arrange them in descending order using selection sort
method. Print the sorted array.

PROGRAM 11 :

Define a class to declare a single dimensional array of size 20 (double datatype), accept the elements into the
array and perform the following:

• Calculate and print the sum of all the elements.

• Calculate and print the highest value of the array.

PROGRAM 12 :
Design a class to overload a function sum( ) as follows:

(i) int sum(int A, int B) – with two integer arguments to calculate and return sum of all the even numbers in the range
of A and B.
Sample input: A=4 and B=16
Sample output: sum = 4 + 6 + 8 + 10 + 12 + 14 + 16

(ii) int sum(int N) – with one integer argument to calculate and return sum of only odd digits of the number N.
Sample input : N=43961
Sample output : sum = 3 + 9 + 1 = 13
Write the main method to create an object and invoke the above methods.

PROGRAM 13:

Write a function fact(int n) to find the factorial of a number n. Write the main method to create an object and
invoke fact method to find the value of S where:
n!
S=
m!(n − m)!
where, n! = 1 x 2 x 3 x ………. x n
PROGRAM 14 :

Define a class called Library with the following description: [15]


Instance variables/data members:
int acc – stores the accession number of the book
double fine – stores the fine amount
String title – stores the title of the books
String author - stores the name of the author
Member Methods:
(i) void input() – to input and store the accession number, title and author.
(ii)void compute(int d) – to accept the number of days late, and calculate the fine charged.
For first 5 days --------fine is 40 paisa per day
For next 5 days --------fine is 65 paisa per day
For more than 10 days --------fine is 80 paisa per day.
(iii) void display()- To display the details in the following format:
Acc. No. Title Author Fine
…… …… …… …..
Write a main method to create an object of the class and call the above member methods.

PROGRAM 15 : An electronics shop has announced a special discount on the purchase of Laptops as given
below:
Category Discount on Laptop
Up to ₹25,000 5.0%
₹25,001 - ₹50,000 7.5%
₹50,001 - ₹1,00,000 10.0%
More than ₹1,00,000 15.0%
Define a class Laptop described as follows:

Data members/instance variables:


• name
• price
• dis
• amt
Member Methods:
• Laptop(): A parameterised constructor to initialize the data members
• void details(): To accept the details (name of the customer and the price)
• void compute(): To compute the discount
• void display(): To display the name, discount and amount to be paid after discount.
Write a main method to create an object of the class and call the member methods.
PROGRAM 16 :
Design a class to overload a function check( ) as follows:
(a) void check (String str,char ch) – To find and print the frequency of a character ch in a String str
Example:
Input: str= “success”
ch= ‘s’
output: number of s present is = 3

(b) void check (String v) – To check whether String v is starting and ending with letter ‘a’ or ‘A’
Example:
Input: v= “Arora”
output: Arora is starting and ending with A

PROGRAM 17 :
Write a program to input a sentence and print all the vowels present in it using function vowel(String) and
all consonants in it using function consonants(String).
Example:
Input: computer
Vowels: o u e
Consonants: c m p t r

PROGRAM 18 :
Write a program to initialize an array of 5 names and initialize another array with their respective telephone numbers.
Search for a name input by the users, in the list. If found, display "Search successful" and print the name along with
the telephone number, otherwise display "Search unsuccessful. Name not listed."

PROGRAM 19 :
Define a class to accept a string and print the string replacing the vowels with ‘*’ , consonants with ‘@’
and other characters with ‘#’

Sample Input: BEAUTIFUL@123


OUTPUT: @***@*@*@####

PROGRAM 20 :
Write a program to enter a sentence from the keyboard and count the number of times a particular
word occurs in it. Display the frequency of the search word.

Sample Input:
Enter a sentence: The quick brown fox jumps over the lazy dog.
Enter a word to search: the
Sample Output:
Search word: the - occurs 2 times

You might also like