Grade X – Computer Applications Project Work / Assignments for the year 2021-22
Q1. Define a class named BookFair with the following description:
Instance variables/Data members:
String Bname — stores the name of the book
double price — stores the price of the book Member methods :
(i) BookFair() — Default constructor to initialize data members
(ii) void Input() — To input and store the name and the price of the book.
(iii) void calculate() — To calculate the price after discount. Discount is calculated based
on the following criteria.
Price Discount
Less than or equal to Rs. 1000 2% of price
More than Rs. 1000 and less than or equal to Rs. 3000 10% of price
More than % 3000 15% of price
(iv) void display () — To display the name and price of the book after discount. Write a
main method to create an object of the class and call the above member methods.
Q2. The annual examination results of 50 students in a class is tabulated as follows:
Write a program to read the data, calculate and display the following:
(a) Average marks obtained by each student.
(b) Print the roll number & average marks of students whose average mark is above 80.
(c) Print the roll number and average marks of students whose average mark is below 40
Q3. Write a program to perform binary search on a list of integers given below, to search
for an element input by the user, if it is found display the element along with its position,
otherwise display the message “Search element not found”.
5, 7, 9, 11, 15, 20, 30, 45, 89, 97
Q4. Design a program to accept a day number (between 1 and 366), year (in 4 digits)
from the user to generate and display the corresponding date.
Also, accept ‘N’ (1 <= N <= 100) from the user to compute and display the future date
corresponding to ‘N’ days after the generated date.
Display an error message if the value of the day number, year and N are not within the
limit or not according to the condition specified.
Test your program with the following data and some random data:
Example 1
INPUT: DAY NUMBER: 255
YEAR: 2018
DATE AFTER (N DAYS): 22
OUTPUT: DATE: 12 TH SEPTEMBER, 2018 DATE AFTER 22 DAYS: 4 TH
OCTOBER, 2018
31 + 28/29 + 31 + 30 + 31 + 30 + 31 + 31 + 12 = 255
Q5. Write a program to store 6 elements in any array P, and 4 elements in an array Q and
produce a third array R, containing all the elements of array P and Q. Display the
resultant array.
Q6. Write a program to input a string in uppercase and print the frequency of each
character. Example:
Q7. Design a class to overload a function area( ) as follows:
(i) double area (double a, double b, double c) with three double arguments, returns the
area of a scalene triangle using the formula:
area =
where s=
(ii) double area (int a, int b, int height) with three integer arguments, returns the area of a
trapezium using the formula:
area =
(iii) double area (double diagonal 1, double diagonal 2) with two double arguments,
returns the area of a rhombus using the formula:
area =
Q8. Write a program to assign a full path and file name as given below. Using library
functions, extract and output the file path, file name and file extension separately as
shown.
Input C: / Users / admin / Pictures / [Link]
Output path: C: / Users/admin/Pictures/
File name: flower
Extension: jpg
Q9. A special two-digit number is such that when the sum of its digits is added to the
product of its digits, the result is equal to the original two-digit number. Example:
Consider the number 59.
Sum of digits = 5 + 9=14
Product of its digits = 5 x 9 = 45
Sum of the sum of digits and product of digits = 14 + 45 = 59
Write a program to accept a two-digit number. Add the sum of its digits to the product of
its digits. If the value is equal to the number input, output the message “Special 2-digit
number” otherwise, output the message “Not a special 2-digit number”.
Q10. Define a class called mobike with the following description:
Instance variables /data members:
int bno — to store the bike’s number
int phno — to store the phone number of the customer
String name — to store the name of the customer
int days — to store the number of days the bike is taken on rent
int charge — 4 calculate and store the rental charge
Member methods:
void input() — to input and store the detail of the customer
void compute() — to compute the rental charge.
The rent for a mobike is charged on the following basis:
First five days Rs. 500 per day.
Next five days Rs. 400 per day.
Rest of the days Rs. 200 per day.
void display() — to display the details in the following format:
Q11. Write a program to accept a word and convert it into lowercase if it is in uppercase,
and display the new word by replacing only the vowels with the character following it :
Example :
Sample Input : computer
Sample Output : cpmpvtfr
Q12. Write a program to accept a string. Convert the string to uppercase. Count and
output the number of double letter sequences that exist in the string.
Sample Input: “SHE WAS FEEDING THE LITTLE RABBIT WITH AN APPLE”
Sample Output: 4
Q13. Write a program to accept the names of 10 cities in a single dimension string array
and their STD (Subscribers Trunk Dialing) codes in another single
dimension integer array. Search for a name of a city input by the user in the list. If found,
display* “Search successful” and print the name of the city along with its STD code, or
else display the message “Search Unsuccessful, No such city in the list”.
Q14. The International Standard Book Number (ISBN) is a unique numeric book
identifier which is printed on every book. The ISBN is based upon a 10-digit code. The
ISBN is legal if:
1 × digit1 + 2 × digit2 + 3 × digit3 + 4 × digit4 + 5 × digit5 + 6 × digit6 + 7 × digit7 + 8 ×
digit8 + 9 × digit9 + 10 × digit10 is divisible by 11.
Example: For an ISBN 1401601499
Sum = 1×1 + 2×4 +3×0 + 4×1 + 5×6 + 6×0 + 7×1 + 8×4 + 9×9 + 10×9 = 253 which is
divisible by 11.
Write a program to :
(i) Input the ISBN code as a 10-digit integer.
(ii) If the ISBN is not a 10-digit integer, output the message, “Illegal ISBN” and
terminate the program.
(iii) If the number is 10-digit, extract the digits of the number and compute the sum as
explained above.
If the sum is divisible by 11, output the message, “Legal ISBN”. If the sum is not
divisible by 11, output the message, “Illegal ISBN”
Q15. Write a program that encodes a word into Pig Latin. To translate word into a Pig
Latin word, convert the word into uppercase and then place the first vowel of the original
word as the start of the new word along with the remaining alphabets. The alphabets
present before the vowel being shifted towards the end followed by “AY”.
Sample input (1) : London, Sample output (1) : ONDONLAY
Sample input (2) : Olympics, Sample output (2) : OLYMPICSAY
Q16. Design a class to overload a function Joystring( ) as follows :
(i) void Joystring (String s, char ch1 char ch2) with one string argument and two
character arguments that replaces the character argument ch1 with the character argument
ch2 in the given string s and prints the new string. (use library functions)
Example:
Input value of s = “TECHNALAGY”
ch1=‘A’,
ch2=‘O’
Output: TECHNOLOGY
(ii) void Joystring (String s) with one string argument that prints the position of the first
space and the last space of the given string s.
Example:
Input value of = “Cloud computing means Internet based computing”
Output: First index : 5
Last index : 36
(iii) void Joystring (String s1, String s2) with two string arguments that combines the two
string with a space between them and prints the resultant string. Example :
Input value of s1 =“COMMON WEALTH”
Input value of s2 =“GAMES”
Output: COMMON WEALTH GAMES
Q17. Special words are those words which starts and ends with the same letter.
Examples:
EXISTENCE
COMIC
WINDOW
Palindrome words are those words which read the same from left to right and vice versa
Examples:
MALAYALAM
MADAM
LEVEL
ROTATOR
CIVIC
All palindromes are special words, but all special words are not palindromes. Write a
program to accept a word check and print whether the word is a palindrome or only
special word.
Q18. Design a class to overload a function check ( ) as follows:
(i) void check (String str, char ch) – to find and print the frequency of a character in a
string.
Example: *
Input:
str = “success”
ch = ‘s’ .
Output:
number of s present is = 3
(ii) void check(String si) – to display only vowels from string si, after converting it to
lower case.
Example:
Input:
s1 = “computer”
Output:
oue
Q19. A tech number has even number of digits. If the number is split in two equal halves,
then the square of sum of these halves is equal to the number itself. Write a program to
generate and print all four digit tech numbers.
Example:
Consider the number 3025
Square of sum of the halves of 3025 = (30+25)2
= (55)2
= 3025 is a tech number.
Q20. Design a class to overload a function series () as follows:
(a) void series (int x, int n) – To display the sum of the series given below:
x1 + x2 + x3 + ……………. xn terms
(b) void series (int p) – To display the following series:
0, 7, 26, 63 p terms.
(c) void series () – To display the sum of the series given below: