Q1) Attempt any EIGHT of the following : (out of ten)
a) What is use of Javac?
=>javac is used complied java program
b) Give the name of any two wrapper classes.
=> 1. Converting primitive numbers to objects
2. Converting objects to primitive numbers.
c) What is use of 'implements' keyword?
=> It is ues to implement an interface.
d) List types of constructor.
=>
1.Non-parameterized constructor
2.parameterized constructor
3.default constructor.
e) what is use of array?
=>
Storing multiple vaule in a one variable.
f) Give the name of any two listeners.
=> 1. ActionListener Interface
2. WindowLinstener Interface
3.CompoentLinstener Interface.
g) What is exception?
=>An exception is an unwanted or unexpected event, which occurs during the
execution
of a program
h) Give the syntax of ends with( ) method?
=>boolean endsWith(String suffix)
i) What is Package?
• A Java package is a mechanism for organizing Java classes
• Packages are used in Java to avoid name conflicts and to control access of
class & interface
j) What is use of new operator?
=>The new operator dynamically allocates the memory for the object
Q2) Attempt any FOUR of the following. (Out of Five)
a) 'When constructor of class will be called?' Comment.
=>
• A constructor is called whenever an object of the class is created.
• ensuring the object is properly initialized.
• after that runs method/function in that constructor.
• constructor name is same as class name.
b) What is command line argument? Where they are stored in a program
=>
• The three common techniques for accepting input in Java are using
BufferedReader class, Scanner class and Command line arguments.
• An argument which is supplied/passed to the main() from the command line
at the time of calling the main() by the java interpreters is called command
line argument.
• The Java command line argument is an argument passed at the time of
running the Java program.
• Command line arguments are stored in the String[] args array passed to the
main method.
c) What is Frame? Give its any two methods.
=>
• A Frame in Java is a top-level window with a title and a border.
• It provides the ability to add components like buttons, text fields, labels,
and other controls
• Their is two method in frame
1.setSize().
2.setVisible().
d) Differentiate between method overloading and method overriding.
=>Method Overloading:
• Having multiple methods with the same name but different parameter lists
within the same class.
• It is use to increase readability of the program.
Method Overriding:
• Defining a method in a subclass that already exists in the superclass with
the same signature
• it is use to provide specific implementation in the subclass
e) Write any two access specifiers
=>
1.public
2.private
3.protected.
Q3) Attempt any two of the following. (Out of Three)
a) Define an interface shape with abstract method area( ). Inherit
interfaceshape into the class traingle.Write a Java Program to
calculate area of Triangle.
b) Design the following screen by using swing.Write a Java program
to accept the details of student & display an console by clicking on
Display button. Clear button should clear all the controls
c) Write a Java Program to copy the contents form one file into
another file. While copying, change the case of cell the alphabets &
replace all the digital by '*'.
Q4) Attempt any two of the following. (out of Three)
a) Differentiate between AWT & Swing.
AWT
• AWT components are platform dependent
• AWT components are heavy weight.
• Provide less component than swing
• AWT components require java.awt package.
• Advanced features is not available in AWT.
----------------------XX-----------------------
Swing
• swing components are platform independent.
• Light weight
• More component
• Swing components require javax.swing package.
• Available
b) Define user define exception zeronumber Exc. Write a Java program
to accept number from user. If it is zero then throw user define
exception "Number is zero" otherwise calculate the sum of first & last
digit of given number. (use Static Keyword).
c) Write a Java program to accept n number from user & store only
perfect numbers into array & display that array.
Q5) Attempt any ONE of the following. (out of Two)
a) Explain uses of final keyword with example
=>
• the final keyword is used to restrict the modification of classes,
methods, and variables.
• in three places final keyword is used
1)Final Variables: variable can only be initialized once
2)Final Method: method cannot be change/overridden by
subclasses
3)Final Classes: class cannot be subclassed
b) Define a class Emp with a member Eid and display() method, inherit
EmP class into the Emp Name class, Emp Name class having a member
Ename & display ( ) method. Write a Java program to accept details of
employee [Eid, Ename] & display it. (Use super keyword).