Sie sind auf Seite 1von 5

# JAVA Programming LAB-QUESTIONS (MCA-3rd) Semester

## SL TOPIC PAGE Remarks and

NO Teacher’s Sign
OPERATORS
1 WAP input N numbers through command line to calculate sum and
average and also display.
2 WAP input a three digits number by command line argument find out
reverse and sum.
3 WAP input three numbers by command line argument find out
greatest and smallest using conditional operator.
4 WAP input a number to check the number is even or not using
conditional operator.
5 WAP input a four digits numbers by command line argument to check
the 1st and last digit are equal or not.
6 WAP input two numbers by command line argument to swap the
numbers by using 3rd variables.
7 WAP input two numbers by command line argument to swap the
numbers without using 3rd variables.
8 WAP to input Name, Age and Date of Birth and Display using Input
Method (Streams and Buffers)
9 WAP to find the sum, product, difference & division of two numbers
(initialize / input)
10 WAP input value of side of a square and display the Area & Perimeter
of the Square.
11 WAP to store / input the radius of a Circle, and calculate the Area and
Circumference.
12 WAP input the length and breadth of a Rectangle calculate and print
the area and Perimeter of Rectangle.
13 WAP to input the marks obtained by a student in English, Maths,
Science, Computers and calculate the Total and Percentage by a
student in the 4 subjects
14 WAP to input the time in seconds and split it into hours, minutes and
seconds.
15 WAP to the convert the amount entered by the user in denominations
of Rs. 1000, Rs. 500, Rs. 100, Rs. 50, Rs. 20, Rs. 10, Rs. 5, Rs. 2 and
Re.1 notes
16 WAP to input the Basic Salary of an employee and Calculate his
Gross and Net Salary based on the information given below
D.A. (Dearness Allowance) = 75% of Basic Salary
H.R.A. (House Rent Allowance)= 25% of Basic Salary
P.F. (Provident Fund) = 12% of (Basic + D.A.)
Gross Salary = Basic + D.A + H.R.A
Net Salary = Gross Salary – P.F.
SELECTION or CONDITIONAL statements
17 WAP to input two numbers to find out greatest and smallest using
simple if.
18 WAP to input two numbers and print the square of the smaller and
cube of the greater value.
19 WAP find out the smallest of 3 numbers using nested if statement
values entered by the user.
20 WAP input age of a person determine for how many years he has
been voting or how many years after will he be eligible to vote.
21 WAP input the age of a person and check if he is a Senior Citizen or
not.
22 WAP input a character and check whether it is an alphabet, number or
special character.
23 WAP input a character and check that whether it is a vowel or
consonant.
24 WAP input any year and check if it a leap year or not.
25 WAP input number from 1 to 7 and display the corresponding day of
the week using switch…case
26 WAP to enter number from 1 to 7 and display the corresponding day
of the week using if …else.
27 Write a menu driven program to input/assign/store 2 numbers and
perform the following mathematical operations on the two variables as
given below in the menu… 1. Addition (+) 2. Subtraction (-) 3.
Multiplication (x) 4. Division (/)
28 Write a menu driven program to calculate the area of
a. Circle (Π.r2)
b. Square (side * side)
c. Rectangle (l * b)
29 WAP to enter a three digits number to check the number is Armstrong
or not
30 WAP to enter a three digits number to check the number is
Palindrome or not
ITERATION or LOOPING statements
31 WAP to Display the first ten Even numbers in reverse order.
32 WAP Generate the table of any integer number. Follow the below
example
8x1=8
8 x 2 = 16
8 x 3 = 24 till 10…
33 WAP input any number and print its Factorial (Hint: 5! = 5 x 4 x 3 x 2
x 1)
34 WAP input a number and count the number of digits.
35 WAP to input any digits number to calculate sum and reverse them.
36 Input ten numbers and count the number of positive nos., negative
nos., even positive nos., even negative nos., odd positive nos., odd
negative and zeros
37 WAP to input a number and print the sum of all the digits that are
even. E.g. 456, output is 10
38 WAP generate Fibonacci Series up to N
39 WAP input any number and check if it is Prime or not.
40 WAP print all the Series of Prime numbers between x and y limits
41 WAP to calculate sum of series: S=1 + 1/2 + 1/3 + 1/4 + … till 10
terms.
42 WAP to calculate sum of series: S = 1 + 1/4 + 1/9 + … till 10 terms
42 WAP to calculate sum of series: S = 1 + 1/3 + 1/5 + … till 10 terms
44 WAP input any number and check if it is a Palindrome or not.
45 WAP input any number and check if it is an Armstrong number or not.
46 * 1 A 3 2 1
47 * * 1 2 A B 2 1
48 * * * till N 1 2 3 till N A B C till H 1 ITEtements
ARRAY or VECTOR
50 WAP to store 10 numbers in an array and print the sum of all the ten nos.
51 WAP to input 10 numbers in an array and display the element whose
position is entered by the user.
52 WAP to input 10 nos. in an array and search a given number from within
that array and print all its positions of occurrence using Linear Search
53 WAP to accept 10 integer type numbers in an array and sort the array in
ascending order using Bubble Sort Technique. Display the elements of
the array before and after sorting
54 WAP to accept 10 integer type numbers in an array and to find out
maximum and minimum number in the array and display them.
55 WAP display transpose of a 3x3 matrix, values input by the user and print
them.
56 WAP to calculate summation of left diagonal and right diagonal of a 3x3
matrix values and display them.
57 WAP to calculate summation of two matrixes (3x3)
58 WAP to calculate multiplications of two matrixes (3x3)
59 WAP how to add elements to Vector and how get the same from Vector.
60 WAP how to remove all elements from vector at once.
RECURSION
61 WAP finding factorial of a number in Java using recursion
62 WAP generate the Fibonacci series using recursion
63 WAP sum of any digits number using recursion
CLASSES & OBJECTS
64 WAP input two values through INPUT method to calculate sum and
display them in DISPLAY method.
65 WAP calculate sum of two numbers using passing by value method
and also display them.
66 WAP input a number through private method INPUT and calculate
square of the number and also display them.
67 WAP find out greatest of numbers using nesting of methods.
68 WAP input two numbers to swapping the numbers by using pass by
value method.
69 WAP input two numbers to swapping the numbers by using pass by
reference method.
70 WAP to calculate addition of two Distances (Feet and Inches) and also
display them. (Ex. Dist=Dist1+Dist2
71 WAP to calculate addition of Two Times (Hour, Minute and Seconds)
and also display them. (Ex. Time=Time1+Time2
72 WAP to calculate addition of Two Complex numbers (Real and
Imaginary) and also display them. (Ex. Comp=Comp1+Comp2
73 WAP based on method overloading to calculate (Area of Circle, Area
of Triangle, Area of Rectangle) and display the result separately.
74 WAP based on method overloading to find out max of two, three and
four numbers.
75 WAP input 10 students’ records (name, roll, course & sem) by INPUT
method and also display them using array of Objects.
76 WAP using static variable, member variable and static method give a
suitable program.
77 WAP give a suitable example use of final keyword.
CONSTRUCTOR
78 WAP to calculate sum of two numbers using default constructor
method and also display them.
79 WAP initialize two default values in default constructor and two values
input by input method to calculate max and display them.
80 WAP passing two values (feet and inches) to the parameterized
constructor method through an object and also display them.
81 WAP passing two values (feet and inches) by two different objects and
calculate sum of two objects and display them.
82 WAP based on constructor overloading to find out max of two, three
and four numbers and display the output separately.
83 WAP initialize a default value in default constructor, passing a value
by an object to parameterized constructor and input a value by input
method to calculate square, cube, and four and display them.
84 WAP a program to understand that the parameterized constructor of
the super class can be called from sub class using super()
85 WAP to use this to refer the current class parameterized constructor
as this(), its method as this.method() and its instance variable as
this.variable.
INHERITANCE
86 WAP to illustrate the use of single inheritance input name and roll in
class A: input 3 subject marks in class B and display them.
87 WAP where the names of instance variables and methods in super
and sub classes are same. Hence, by default only sub class members
are accessible.
88 WAP to illustrate the use of multilevel inheritance input name and
roll in class A: input 3 subject marks in class B: calculate total,
percentage and division in class C: (if per>=70 div=”Distinction”,
per>=60 and per<80 div=”First”, per>=50 and per<60 div=”Second”,
per>=40and per<50 div=”Third” other below 40 div=”Fail”) display
them.
89 WAP using the concept of hierarchical Inheritance give a suitable
example.
90 WAP using interface to implement multiple inheritances.

POLYMORPHISM
91 Write a program to create Compute class which contains two methods
with the same name but with different signatures.
92 WAP where calculate() method of super class is overridden by the
calculate() method of sub class. The behaviour of the calculate()
method is dynamically decided.
EXCEPTION HANDLING
93 WAP using try, catch and finally block give an example.
94 WAP which shows how to handle the ArithmeticException and
ArrayIndexOutOfBoundsException.
95 WAP displays the use of throws clause
96 WAP displays the use of throw clause for throwing the NullPointerException