Computer Project Questions Gr 10_AY 22_23
Computer Project Questions Gr 10_AY 22_23
Computer Project Questions Gr 10_AY 22_23
Question 1:
For Loop Pattern Program using switch-case
Write a program to generate a pattern of numbers in the form of a triangle or in the form of an
inverted triangle depending upon User’s choice. For an incorrect choice, an appropriate error
message should be displayed.
1 A A A A A
2 3 C C C C
4 5 6 E E E
7 8 9 10 G G
I
Question 2:
Write a program to calculate and print the sum of each of the following series within one
class:
𝑎 𝑎4 𝑎7 𝑎10
(i) S1 = 2! - + - + ………..upto n terms
4! 6! 8!
Question 3:
Write a menu driven program to accept a number from the user and check whether it is a
Special number or a Harshad number.
a) A number is said to be a special number, if the sum of the factorial of each digits of the
number is same as the original number. Eg.1! + 4! + 5! = 1 + 24 + 120 = 145
1
b) A Harshad number is an integer that is divisible by the sum of its digits.
Eg.171
Sum of digits = 1 + 7 + 1 =9
171 is divisible by 9
Question 4:
String flavour: stores the flavour of the juice (e.g. orange, apple, etc.).
String packType: stores the type of packaging (e.g. tetra-pack, PET bottle, etc.).
Member functions:
(i) void input(): to input and store the productCode, flavour, packType, packSize and
productPrice.
(iii) void display(): to display the productCode, flavour, packType, packSize and productPrice.
Write a main method to create an object of the class and call the above member methods.
Question 5:
Function (Parcel)
int calculate(int w1) : To calculate and return the service charge for the
2
transportation of any parcel according to the
following criteria:
void display(int w2, String name2) : Invoke the calculate(int) to display the
below:
Write a main method to create an object par of the class and call the required method.
Question 6:
3
long evenDigit() : to find the sum of the factorial of even digits of a given
number and return the value.
Write a main method to call the above required function and print the value.
Sample Input: 754921
(4!+2!)
Sample Output : 26
Question 7:
Function Overloading - 1
Create the following overloaded functions and write a main method to call the functions
based on the user’s choice:
(i) int volume (int side) – to find and return volume of cube using (side*side*side)
(ii) double volume(double l, double b, double h) – to find and return volume of cuboid using
(length*breadth*height)
(iii) double volume(double r,double h) – to find and return volume of cylinder using (𝜋𝑟 2 ℎ)
Question 8:
Function Overloading - 2
(i) void num_cal(int num, char ch) with one integer argument and one character argument. It
computes the square of an integer if choice ch is ‘s’ or ‘S’ else computes its cube.
(ii) void num_cal(int a, int b, char ch) with two integer arguments and one character
argument. It computes the product of integer arguments if ch is ‘p’ or ‘P’ else adds the
integers.
(iii) void num_cal(String str1, String str2) with two String arguments prints whether the two
strings are equal or not.
4
Question 9:
Question 10:
String 2: WORD
Output: BWAOLRLD
Question 11:
5
Output path: C:\Users\admin\pictures\
File name : flower
Extension: jpg
Question 12:
Question 13:
Output: aplictons
Question 14:
Write a program to declare an array to accept and store five words. Display the number of
palindrome words.
TEACH
RACECAR
6
EXAM
MALAYALAM
Question 15:
Bubble sort
Write a program in Java to input five city names in an array. Using bubble sort arrange them
in descending order and display the same.
Sample input: AGRA
MUMBAI
CHENNAI
DELHI
PUNE
Sample output:
PUNE
MUMBAI
DELHI
CHENNAI
AGRA
Question 16:
Write a program to create two separate arrays A and B. Accept 6 numbers for each array A
and B. Find Sum1 and Sum2 as follows and print Sum1 and Sum2:
7
Question 17:
Linear Search - 1
Write a program to initialize an array of 10 names and initialize another array with their
respective telephone numbers. Using linear search technique, search for a name given by
the user in the list. If found, display “Search successful” and print the name along with the
telephone number, otherwise display “Search Unsuccessful. Name not enlisted”.
Question 18:
Linear Search - 2
Write a program to accept name and monthly salary of 5 employees and store them in two
separate arrays. Display the names of the employees who earn more than Rs.50000 per
month, using linear search.
Question 19:
Binary Search - 1
Write a program to input 5 numbers in an array in ascending order. Take another input num,
search it in the array using binary search technique and print the position of the num if
found in the array, otherwise print the message “Element not found”.
Question 20:
Binary Search – 2
Write a program to initialize the String array name[ ] with the values {“Vijay”, ”Subha”, “Ria”,
”Hari”, “Anita”}. Accept a name of the student from the user. Using the binary search
technique, find whether the name is present in the given list of elements or not. If the name is
present, then print “Name is found in the index __” else print the message “Name is not
found in the list “. (Note: Elements are arranged in descending order).
********