Java Important Questions
Java Important Questions
2. a) Define Constructor
b) Illustrate constructor overloading concept with an example.
3. a) What is a Package?
b) How to import packages? Explain with illustrations
4. a) Differentiate between interface and class
b) Justify the concept of extending interfaces with example code.
5. Explain Costs and Benefits of Inheritance
6. What is thread? Explain with example? Benefits of multi-threading?
7.a) Define Recursion.
b) Illustrate Call-By-Reference Parameter Passing technique.
9. a) Define Inheritance?
b) Explain the various forms of inheritance with suitable code segments.
11. What is java package? What is CLASSPATH? Explain how to create and
access java package with an example?
12. Write a program to illustrate the use of multiple catch blocks for a try
block?
MCQs:
6. A constructor _____________. [ ]
a) May consist of a return type b) Doesn’t consist of any return type
c) Has some return type d) Of a derived class has a return type
7. The memory that is allocated for any objects is _________. [ ]
a) Cache b) HDD c) ROM d) RAM
13. Evaluate the following Java expression, if x=3, y=5, and z=10; [ ]
++z + y - y + z + x++
a) 23 b) 24 c) 25 d) 22
14. Which of these is correct way of inheriting class A by class B? [ ]
a) class B + class A {} b) class B inherits class A {}
c) class B extends A {} d) class B extends class A {}