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
String, string builder, string buffer
PPTX
Array of objects.pptx
PPTX
Java RMI
PPT
Php essentials
DOCX
PRACTICA 7 ALICE
PPTX
functions of C++
PDF
Classes and Objects
PPT
Class 5 - PHP Strings
String, string builder, string buffer
Array of objects.pptx
Java RMI
Php essentials
PRACTICA 7 ALICE
functions of C++
Classes and Objects
Class 5 - PHP Strings

What's hot (20)

PPTX
Applets in java
PPTX
Windows form application_in_vb(vb.net --3 year)
PPTX
Android Services
PPTX
Basic Concepts of OOPs (Object Oriented Programming in Java)
PPT
Pre defined Functions in C
PPT
PHP variables
PDF
jQuery Essentials
PDF
Android datastorage
PDF
Chapitre 4 heritage et polymorphisme
PPTX
Statements and Conditions in PHP
PPTX
PHP FUNCTIONS
PPTX
Java string handling
PPT
DOT Net overview
PPT
Polymorphism in java, method overloading and method overriding
PDF
Java keywords
PPTX
Data Abstraction.pptx
PPT
Java eventhandling
PPT
16 virtual function
PPTX
Domain Driven Design (DDD)
PPTX
Python-Classes.pptx
Applets in java
Windows form application_in_vb(vb.net --3 year)
Android Services
Basic Concepts of OOPs (Object Oriented Programming in Java)
Pre defined Functions in C
PHP variables
jQuery Essentials
Android datastorage
Chapitre 4 heritage et polymorphisme
Statements and Conditions in PHP
PHP FUNCTIONS
Java string handling
DOT Net overview
Polymorphism in java, method overloading and method overriding
Java keywords
Data Abstraction.pptx
Java eventhandling
16 virtual function
Domain Driven Design (DDD)
Python-Classes.pptx
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
“Getting Started with Data Analytics Using R – Concepts, Tools & Case Studies”
PPTX
Introduction-to-Cloud-ComputingFinal.pptx
PPTX
1_Introduction to advance data techniques.pptx
PDF
Foundation of Data Science unit number two notes
PDF
Mega Projects Data Mega Projects Data
PDF
168300704-gasification-ppt.pdfhghhhsjsjhsuxush
PPTX
Introduction to Basics of Ethical Hacking and Penetration Testing -Unit No. 1...
PPTX
oil_refinery_comprehensive_20250804084928 (1).pptx
PPTX
climate analysis of Dhaka ,Banglades.pptx
PPTX
01_intro xxxxxxxxxxfffffffffffaaaaaaaaaaafg
PPT
Reliability_Chapter_ presentation 1221.5784
PPTX
Microsoft-Fabric-Unifying-Analytics-for-the-Modern-Enterprise Solution.pptx
PPTX
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
PDF
Galatica Smart Energy Infrastructure Startup Pitch Deck
PPTX
Qualitative Qantitative and Mixed Methods.pptx
PPTX
IBA_Chapter_11_Slides_Final_Accessible.pptx
PPTX
Business Ppt On Nestle.pptx huunnnhhgfvu
PPTX
Introduction to machine learning and Linear Models
PPTX
MODULE 8 - DISASTER risk PREPAREDNESS.pptx
PPTX
iec ppt-1 pptx icmr ppt on rehabilitation.pptx
“Getting Started with Data Analytics Using R – Concepts, Tools & Case Studies”
Introduction-to-Cloud-ComputingFinal.pptx
1_Introduction to advance data techniques.pptx
Foundation of Data Science unit number two notes
Mega Projects Data Mega Projects Data
168300704-gasification-ppt.pdfhghhhsjsjhsuxush
Introduction to Basics of Ethical Hacking and Penetration Testing -Unit No. 1...
oil_refinery_comprehensive_20250804084928 (1).pptx
climate analysis of Dhaka ,Banglades.pptx
01_intro xxxxxxxxxxfffffffffffaaaaaaaaaaafg
Reliability_Chapter_ presentation 1221.5784
Microsoft-Fabric-Unifying-Analytics-for-the-Modern-Enterprise Solution.pptx
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
Galatica Smart Energy Infrastructure Startup Pitch Deck
Qualitative Qantitative and Mixed Methods.pptx
IBA_Chapter_11_Slides_Final_Accessible.pptx
Business Ppt On Nestle.pptx huunnnhhgfvu
Introduction to machine learning and Linear Models
MODULE 8 - DISASTER risk PREPAREDNESS.pptx
iec ppt-1 pptx icmr ppt on rehabilitation.pptx

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