SlideShare a Scribd company logo
2
Most read
3
Most read
4
Most read
INTERNATIONAL SCHOOL
Shaikpet, Hyderabad-500008
COMPUTER APPLICATIONS(Sample Practical Questions)
2022-23
1. Write a program to accept the year of graduation from school as an integer value from the user.
Using the Binary Search technique on the sorted array of integers given below, output the
message “Record exists” if the value input is located in the array. If not, output the message “
Record does not exist”.
{1982,1986, 1987, 1993, 1996, 1999, 2003, 2006, 2007, 2009, 2010}
2. Write a program to initialize the seven wonders of the world along with their locations in two
different arrays. Search for a name of the country input by the user. If found, display the name of
the country along with its Wonder, otherwise display “Sorry Not Found”.
Seven wonders- CHICKEN ITZA, CHRIST THE REDEEMER, TAJ MAHAL, GREAT
WALL OF CHINA,
MACHU PICCHU, PETRA, COLOSSEUM.
Locations- MEXICO, BRAZIL, INDIA, CHINA, PERU, JORDAN, ITALY
Example- Country Name: INDIA OUPUT: INDIA- TAJMAHAL
Country Name: USA Output: Sorry not found.
3. The annual examination results of 50 students in a class is tabulated as follows.
Roll No. Subject A Subject B Subject C
---- --- ---- ----
Write a program to read the data, calculate and display the following:
a. Average marks obtained by each student.
b. Print the roll number and average marks of the students whose average mark is above 80.
c. Print the roll number and average marks of the students whose average mark is below 40.
4. Write a java program to input 10 elements in an array and sort them using Bubble sort technique.
5. (i) double area(double a. double b, double e) with three double arguments, returns the
area of a scalene triangle using the formula:
where
(ii) double area(int a, int b, int height) with three integer arguments, returns the area of trapezium
using the formula:
(iii) double area(double diagonal1, double diagonal2) with two double arguments, returns the area
of a rhombus using the formula:
6. Design a class to overload a function polygon() as follows:
(i) void polygon(int n, char ch) : with one integer argument and one character type argument
that draws a filled square of side n using the character stored in ch.
(ii) void polygon(int x, int y) : with two integer arguments that draws a filled rectangle of
length x and breadth y, using the symbol ‘@’
(iii)void polygon( ) : with no argument that draws a filled triangle shown below.
Example:
(i) Input value of n=2, ch=’O’
Output:
OO
OO
(ii) Input value of x=2, y=5
Output:
@@@@@
@@@@@
(iii) Output:
*
**
***
7. Define a class named movieMagic with the following description:
Instance variables/data members:
int year – to store the year of release of a movie
String title – to store the title of the movie.
float rating – to store the popularity rating of the movie.
(minimum rating = 0.0 and maximum rating = 5.0)
Member Methods:
(i) movieMagic() Default constructor to initialize numeric data members to 0 and String data
member to “”.
(ii) void accept() To input and store year, title and rating.
(iii) void display() To display the title of a movie and a message based on the rating as per the
table below.
RATING MESSAGE TO BE DISPLAYED
0.0 to 2.0 Flop
2.1 to 3.4 Semi-hit
3.5 to 4.5 Hit
4.6 to 5.0 Super Hit
Write a main method to create an object of the class and call the above member methods.
8. 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”.
9. Using the switch statement. write a menu driven program to calculate the maturity amount of a
Bank Deposit.
The user is given the following options:
(i) Term Deposit
(ii) Recurring Deposit
For option (i) accept principal(P), rare of ¡interest(r) and time period in years(n). Calculate and
output the maturity amount(A) receivable using the formula
For option (ii) accept Monthly Installment (P), rate of interest(r) and time period in months (n).
Calculate and output the maturity amount(A) receivable using the formula
For an incorrect option, an appropriate error message should be displayed.
10. Write a program to input a string and print out the text with the uppercase and lowercase letters
reversed, but all other characters should remain the same as before.
Example:
INPUT: WeLcOmE TO School
OUTPUT: wElCoMe to sCHOOL
11. Design a class name ShowRoom with the following description:
Instance variables/data members:
String name: to store the name of the customer.
long mobno: to store customer’s mobile number.
double cost: to store the cost of the item purchased.
double dis: to store the discount amount.
double amount: to store the amount to be paid after discount.
Methods:
ShowRoom(): default constructor to initialize the data members
void input(): to input customer name, mobile number, cost
void calculate(): to calculate discount on the cost of purchased items, based on the following
criteria
Cost(in Rupees) Discount(In percentage)
Less than or equal to 10000 5 %
More than 10000 and less than or equal to ₹ 20000 10 %
More than 20000 and less than or equal to ₹ 35000 15 %
More than 35000 20%
void display()- To display customer, mobile number, amount to be paid after discount.
Write a main() method to create an object of the class and call the above methods.
12. Write a Java program to print the following pattern using Switch case. Prompt the user to choose
an option between numeric or string pattern.
a. 666666
55555
4444
333
22
1
b. HELLO
HELL
HEL
HE
H

More Related Content

PPTX
Templates in C++
PPTX
Constructor and destructor
PPTX
Array in c#
PPTX
Java string handling
PPTX
Python variables and data types.pptx
PPTX
Mysql Crud, Php Mysql, php, sql
PPTX
C++ programming (Array)
Templates in C++
Constructor and destructor
Array in c#
Java string handling
Python variables and data types.pptx
Mysql Crud, Php Mysql, php, sql
C++ programming (Array)

What's hot (20)

PPTX
ML_Unit_1_Part_B
PPTX
C# 101: Intro to Programming with C#
PDF
Enumeration in Java Explained | Java Tutorial | Edureka
PPTX
Collections in-csharp
PPTX
C# classes objects
PPTX
PPTX
Virtual function in C++ Pure Virtual Function
PPTX
Java abstract class & abstract methods
PDF
Functions in C++
PPT
PPTX
Strings in Java
PPTX
Pure virtual function and abstract class
PDF
Class and Objects in Java
PPTX
String, string builder, string buffer
DOC
Final JAVA Practical of BCA SEM-5.
PPTX
Enumeration in c#
PPT
Inheritance in java
PPTX
Working with Methods in Java.pptx
PPT
Java collection
ML_Unit_1_Part_B
C# 101: Intro to Programming with C#
Enumeration in Java Explained | Java Tutorial | Edureka
Collections in-csharp
C# classes objects
Virtual function in C++ Pure Virtual Function
Java abstract class & abstract methods
Functions in C++
Strings in Java
Pure virtual function and abstract class
Class and Objects in Java
String, string builder, string buffer
Final JAVA Practical of BCA SEM-5.
Enumeration in c#
Inheritance in java
Working with Methods in Java.pptx
Java collection
Ad

Similar to JAVA practical Exam Questions (1).docx (20)

DOC
Practical java
PDF
Computer Practical
PPTX
class 11 chapter Program error and document.pptx
PDF
Lab exam question_paper
PDF
computer science sample papers 2
DOCX
Java Practice Set
DOCX
Lab exam question_paper
DOCX
Sl no.docx
DOCX
Chapter 8Exercise1.Design an application that accept.docx
PDF
OOP Assignment 03.pdf
DOC
project report in C++ programming and SQL
PPTX
Lab01.pptx
DOCX
Oop lab assignment 01
DOC
Sp 1418794917
PDF
CBSE Question Paper Computer Science with C++ 2011
DOC
Report in Java programming and SQL
PDF
Computer Science Sample Paper 2015
DOCX
List of programs to practice for ICSE
PDF
2021 icse reducedsylabiix-computer applications
DOC
Java programming lab assignments
Practical java
Computer Practical
class 11 chapter Program error and document.pptx
Lab exam question_paper
computer science sample papers 2
Java Practice Set
Lab exam question_paper
Sl no.docx
Chapter 8Exercise1.Design an application that accept.docx
OOP Assignment 03.pdf
project report in C++ programming and SQL
Lab01.pptx
Oop lab assignment 01
Sp 1418794917
CBSE Question Paper Computer Science with C++ 2011
Report in Java programming and SQL
Computer Science Sample Paper 2015
List of programs to practice for ICSE
2021 icse reducedsylabiix-computer applications
Java programming lab assignments
Ad

Recently uploaded (20)

PDF
Foundation of Data Science unit number two notes
PDF
Data Analyst Certificate Programs for Beginners | IABAC
PDF
Mastering Financial Analysis Materials.pdf
PDF
Digital Infrastructure – Powering the Connected Age
PDF
Chad Readey - An Independent Thinker
PPTX
LESSON-1-NATURE-OF-MATHEMATICS.pptx patterns
PDF
Launch Your Data Science Career in Kochi – 2025
PPT
Chapter 3 METAL JOINING.pptnnnnnnnnnnnnn
PPTX
Measurement of Afordability for Water Supply and Sanitation in Bangladesh .pptx
PPTX
artificial intelligence deeplearning-200712115616.pptx
PPT
Chapter 2 METAL FORMINGhhhhhhhjjjjmmmmmmmmm
PPTX
Azure Data management Engineer project.pptx
PPTX
Extract Transformation Load (3) (1).pptx
PDF
Company Presentation pada Perusahaan ADB.pdf
PDF
345_IT infrastructure for business management.pdf
PPTX
Economic Sector Performance Recovery.pptx
PDF
CH2-MODEL-SETUP-v2017.1-JC-APR27-2017.pdf
PPTX
Major-Components-ofNKJNNKNKNKNKronment.pptx
PDF
Mastering Query Optimization Techniques for Modern Data Engineers
PPTX
Machine Learning Solution for Power Grid Cybersecurity with GraphWavelets
Foundation of Data Science unit number two notes
Data Analyst Certificate Programs for Beginners | IABAC
Mastering Financial Analysis Materials.pdf
Digital Infrastructure – Powering the Connected Age
Chad Readey - An Independent Thinker
LESSON-1-NATURE-OF-MATHEMATICS.pptx patterns
Launch Your Data Science Career in Kochi – 2025
Chapter 3 METAL JOINING.pptnnnnnnnnnnnnn
Measurement of Afordability for Water Supply and Sanitation in Bangladesh .pptx
artificial intelligence deeplearning-200712115616.pptx
Chapter 2 METAL FORMINGhhhhhhhjjjjmmmmmmmmm
Azure Data management Engineer project.pptx
Extract Transformation Load (3) (1).pptx
Company Presentation pada Perusahaan ADB.pdf
345_IT infrastructure for business management.pdf
Economic Sector Performance Recovery.pptx
CH2-MODEL-SETUP-v2017.1-JC-APR27-2017.pdf
Major-Components-ofNKJNNKNKNKNKronment.pptx
Mastering Query Optimization Techniques for Modern Data Engineers
Machine Learning Solution for Power Grid Cybersecurity with GraphWavelets

JAVA practical Exam Questions (1).docx

  • 1. INTERNATIONAL SCHOOL Shaikpet, Hyderabad-500008 COMPUTER APPLICATIONS(Sample Practical Questions) 2022-23 1. Write a program to accept the year of graduation from school as an integer value from the user. Using the Binary Search technique on the sorted array of integers given below, output the message “Record exists” if the value input is located in the array. If not, output the message “ Record does not exist”. {1982,1986, 1987, 1993, 1996, 1999, 2003, 2006, 2007, 2009, 2010} 2. Write a program to initialize the seven wonders of the world along with their locations in two different arrays. Search for a name of the country input by the user. If found, display the name of the country along with its Wonder, otherwise display “Sorry Not Found”. Seven wonders- CHICKEN ITZA, CHRIST THE REDEEMER, TAJ MAHAL, GREAT WALL OF CHINA, MACHU PICCHU, PETRA, COLOSSEUM. Locations- MEXICO, BRAZIL, INDIA, CHINA, PERU, JORDAN, ITALY Example- Country Name: INDIA OUPUT: INDIA- TAJMAHAL Country Name: USA Output: Sorry not found. 3. The annual examination results of 50 students in a class is tabulated as follows. Roll No. Subject A Subject B Subject C ---- --- ---- ---- Write a program to read the data, calculate and display the following: a. Average marks obtained by each student. b. Print the roll number and average marks of the students whose average mark is above 80. c. Print the roll number and average marks of the students whose average mark is below 40. 4. Write a java program to input 10 elements in an array and sort them using Bubble sort technique. 5. (i) double area(double a. double b, double e) with three double arguments, returns the area of a scalene triangle using the formula: where (ii) double area(int a, int b, int height) with three integer arguments, returns the area of trapezium using the formula: (iii) double area(double diagonal1, double diagonal2) with two double arguments, returns the area of a rhombus using the formula:
  • 2. 6. Design a class to overload a function polygon() as follows: (i) void polygon(int n, char ch) : with one integer argument and one character type argument that draws a filled square of side n using the character stored in ch. (ii) void polygon(int x, int y) : with two integer arguments that draws a filled rectangle of length x and breadth y, using the symbol ‘@’ (iii)void polygon( ) : with no argument that draws a filled triangle shown below. Example: (i) Input value of n=2, ch=’O’ Output: OO OO (ii) Input value of x=2, y=5 Output: @@@@@ @@@@@ (iii) Output: * ** *** 7. Define a class named movieMagic with the following description: Instance variables/data members: int year – to store the year of release of a movie String title – to store the title of the movie. float rating – to store the popularity rating of the movie. (minimum rating = 0.0 and maximum rating = 5.0) Member Methods: (i) movieMagic() Default constructor to initialize numeric data members to 0 and String data member to “”. (ii) void accept() To input and store year, title and rating. (iii) void display() To display the title of a movie and a message based on the rating as per the table below. RATING MESSAGE TO BE DISPLAYED 0.0 to 2.0 Flop 2.1 to 3.4 Semi-hit 3.5 to 4.5 Hit 4.6 to 5.0 Super Hit Write a main method to create an object of the class and call the above member methods. 8. 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.
  • 3. 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”. 9. Using the switch statement. write a menu driven program to calculate the maturity amount of a Bank Deposit. The user is given the following options: (i) Term Deposit (ii) Recurring Deposit For option (i) accept principal(P), rare of ¡interest(r) and time period in years(n). Calculate and output the maturity amount(A) receivable using the formula For option (ii) accept Monthly Installment (P), rate of interest(r) and time period in months (n). Calculate and output the maturity amount(A) receivable using the formula For an incorrect option, an appropriate error message should be displayed. 10. Write a program to input a string and print out the text with the uppercase and lowercase letters reversed, but all other characters should remain the same as before. Example: INPUT: WeLcOmE TO School OUTPUT: wElCoMe to sCHOOL 11. Design a class name ShowRoom with the following description: Instance variables/data members: String name: to store the name of the customer. long mobno: to store customer’s mobile number. double cost: to store the cost of the item purchased. double dis: to store the discount amount. double amount: to store the amount to be paid after discount. Methods: ShowRoom(): default constructor to initialize the data members void input(): to input customer name, mobile number, cost void calculate(): to calculate discount on the cost of purchased items, based on the following criteria
  • 4. Cost(in Rupees) Discount(In percentage) Less than or equal to 10000 5 % More than 10000 and less than or equal to ₹ 20000 10 % More than 20000 and less than or equal to ₹ 35000 15 % More than 35000 20% void display()- To display customer, mobile number, amount to be paid after discount. Write a main() method to create an object of the class and call the above methods. 12. Write a Java program to print the following pattern using Switch case. Prompt the user to choose an option between numeric or string pattern. a. 666666 55555 4444 333 22 1 b. HELLO HELL HEL HE H