Class X Computer Project 2022-23
Class X Computer Project 2022-23
Instructions:
• Write all the answers in Computer Application Lab Manual
• For each program, write the question, the program (with necessary comments), Output and
Variable Description
• At the end, write Acknowledgement
• Write in both sides of the pages.
• No need to cover the lab manual. Just paste the name plate on top that includes Name, Class,
Section, Roll No., Index No., Session 2022-23, Computer Application Project
• You can use either blue or black ink.
Question 1
Write a menu-driven program using switch-case to perform the following:
a) To find and display the sum of the digits of an integer entered by the user
b) To find and display the reverse of the integer entered by the user
Display “Incorrect choice” for an invalid choice.
Question 2
Write a menu-driven program to input an integer and check whether it is a positive 2-digit number or not
using the conditional operator.
Question 3
Write a program to allow the user to input a character and then display the ASCII value of the character.
Question 4
Write a program to input any three integers and find and display the greatest among them using nested if -
else statement.
Question 5
Write a program to input a positive integer and check whether it is a prime number or not using a user-
defined method. The prototype of the method is given below:
public static boolean isPrime(int num)
Question 6
Write a program to input a positive integer and display all its factors using a user-defined method. The
prototype of the method is given below:
public static void listFactors(int num)
Question 7
Write a program to input any two integers and swap them without using a third variable, and then display
them.
Question 8
Write a program to overload a method volume() as follows:
double volume(double s) – to return the volume of a cube
double volume(double r, double h) – to return the volume of a cylinder
double volume(double l, double b, double h) – to return the volume of a cuboid
Note:
Volume of a cube = side 3
Volume of a cylinder = πr2h
Volume of a cuboid = l × b × h
Question 9
Write a program to store the following elements in a one-dimensional array:
{92, 12, 64, 80, 45, 20, 87, 90, 17, 50}
Now perform linear search on this array by asking the user to enter the element to be searched. If found,
display the index, otherwise display “Element not found”.
Question 10
Write a program to store the following elements in a one-dimensional array:
{12, 17, 20, 45, 50, 64, 80, 87, 90, 92}
Now perform binary search on this array by asking the user to enter the element to be searched. If found,
display “Available”, otherwise display “Unavailable”
Question 11
Write a program to store the following elements in a one-dimensional array:
{92, 12, 64, 80, 45, 20, 87, 90, 17, 50}
Now sort them in ascending order using the bubble sort technique. Display the sorted list horizontally.
Question 12
Write a program to input the marks scored in Computer Applications of 10 students in one array and their
corresponding names in another array. Now find and display the names of the highest scorers as well as
the names of the lowest scorers along with their name(s).
Question 13
Write a program to store the following elements in a one-dimensional array:
{92, 12, 64, 80, 45, 20, 87, 90, 17, 50}
Now sort them in ascending order using the selection sort technique. Display the sorted list horizontally.
Question 14
Write a program to design a class Taxi as follows:
Class name: Taxi
Data members/instance variables:
double distance – to store the distance covered by the taxi
double fare – to store the total fare to be paid by the passenger
Methods/Member functions:
void accept() – to input the distance covered
void calculate() – to calculate the total fare based on the following table:
First 10 km - ₹ 20 per km
Next 40 km - ₹ 18 per km
Above 50 km - ₹ 15 per km
void display() – to display the details (distance covered as well as the total fare)
Also include main() to create an object of the class and call the methods accordingly to enable the task.
Question 15
Write a program to design a class Fibonacci as follows:
Class name: Fibonacci
Data members/instance variables:
int a – to store the first term of the Fibonacci series
int b – to store the second term of the Fibonacci series
int c – to store the next term of the Fibonacci series
int n – to store the number of terms
Methods/Member functions:
Fibonacci() – Default constructor to initialize a as 0, b as 1, c as 1, and n as 3.
void input() – to input the number of terms to be displayed
void show() – to display the first n terms of the Fibonacci series horizontally.
Also include the main() method to create an object of the class and call the methods accordingly to enable
the task.
Note: The Fibonacci series starts with 0 and 1, and the next term is the sum of the previous two terms.
Example: 0, 1, 1, 2, 3, 5, 8, …
Question 16
Write a program to design a class PerfectSquare as follows:
Class name: PerfectSquare
Data members/instance variables:
int num – to store the number input by the user
double s – to store the square root of the number num
Methods/Member functions:
PerfectSquare(int num) – parameterized constructor to set the value of data member num and set s as 0.
void check() – to check and display whether the given number is a perfect square or not. A perfect square
is one whose square root is an integer.
Also include the main() method to create an object of the class and call the methods accordingly to enable
the task.
Question 17
Write a program to input a string and convert and display it in title case.
Example:
INPUT: Hello and welcome students!
OUTPUT: Hello And Welcome Students!
Question 18
Write a program to input a sentence that should either end with a full stop or a question mark or an
exclamation mark. Now find and display the length of the longest word in that sentence.
Question 19
Write a program to input a string from the user and count and display the number of vowels present in
that string.
Question 20
Write a program to input a word in uppercase and check whether it is a palindrome word or not. A
palindrome word is one that remains unchanged even when reversed. Example: MOM, DAD.
*******