JAVA ASSIGNMENT
MODULE-II
Question 1 Short answer Question BL CO
a) What do you mean by a constructor? When it is being called? 2 2
b) How static methods are different from instance methods? 2 2
c) Explain this keyword with an example. 2 2
Question 2 Focused Short Answered question
a) Write a program to differentiate the feature of static variable and 3 2
instance variable.
b) Discuss all types of access specifiers used in java. 2 2
C) Explain constructor overloading with an example. 2 2
Question 3 Long question
a) Define a class Car with Following specifications: 3 2
Data Members
Carno,model,brand,colour and price
Member Methods
i) void input()- to accept all details of a car
ii) void display()- To display all details of a car
Write main() method to create an object of car and call above
methods.
b) Define a class Flight with following specifications-: 3 2
Data members
Flightno, flightname, sourceCity, Destination, Fare
Member Methods
i) Flight(….) – A parameterized constructor to initialize all
datamembers
ii) Void showData()- To display all data members
Write main() method to create an object of Flight and call above
methods.
MODULE-III
Question 1
a) Explain inheritance, base class and derived class. 2 3
b) Explain the use of super keyword regarding constructor in 2 3
inheritance
c) Write two differences between method overriding and method 2 3
overloading.
Question 2
a) Write all uses of final keyword with example. 2 3
b) Write all differences between abstract class and interface. 2 3
Question 3
a) Write an example code illustrating single inheritance 3 3
b) Define an abstract class Person having data members aadharno, 3 3
name, address and mobile no
Member methods
i) Person(----) – A parameterized constructor
ii) abstract void display()
Define a derived class Employee having datamember empno and
salary.
Member method:
i) A parameterized constructor
ii) Void display()- To display data members of both
classes.
Write a main method to create an object of Employee class and call
all methods.
Module-IV
Question 1
a) Define an exception. Give two examples of RuntimeException 1 4
b) Write difference between equals() and compareTo() functions of 2 4
String library class.
c) Find Output: 3 4
String S1=” HARDWARE”, S2=” HARDWORK”,
System.out.println(S1.substring(0,4).concat(S2.substring(4)));
System.out.println(S1.compareTo(S2));
Question2
a) Write a program in java to illustrate exception handling using try 3 4
and catch block.
b) Write difference between throw and throws with example. 2 4
Question 3
a) Write a program to input a Sentence and print number of capital 3 4
letters, small letters, digits and special symbols.
b) Write a Program to input a String in uppercase and print whether 4 4
or not it is a PALINDROME. i.e the string is same as its reverse.
Eg. MADAM,EYE etc.
MODULE-V
Question 1
a) What do you know by wrapper classes. Write the wrapper class 1 5
corresponding to char and int type.
b) Explain the concept of boxing and unboxing with an example. 2 5
c) What is an applet? Draw the state transition diagram of an applet. 2 5
Question 2
a) Write differences between an applet and application program 2 5
c) Write the hierarchy of all classes in awt. 2 5
b) Write differences between swing and awt components. 2 5
Question 3
a) Explain all methods responsible for maintaining life cycle of an 2 5
applet with state transition diagram.
b) Write a java program to design a login screen with appropriate 3 5
label, TextField and Buttons.