Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Subject: Programming in Java Subject Code: 18CS653

QUESTION BANK
MODULE 4

1. What is package? How to create and import package in java? Explain with an example.
OR
Write a simple program to create a package and import the package to make use of a class
declared in the package.
2. Define Interface. Explain how to define, implement and assign variable in interface to
perform “one interface multiple method”, with example.
3. What is the role of interface while implementing multiple inheritance in java?
4. Design an Interface called Polygon with a method called area. Implement this interface to
create different classes like Square, Rectangle and print their areas.
5. Write a short note on:
(a) Importing package
(b) Access Protection
6. What is an exception? Explain the following keywords with respect to exception handling
in Java:
a) try b) catch c) throw d) throws e) finally
OR
Define an exception. What are the key terms used in exception handling? Explain.
7. Write a simple program to generate arithmetic exception and print the description of
exception through the program.
8. What is nested try? Demonstrate the working of nested try block with an example.
9. Write a program which contains a method which will throw IllegalAccessException and use
proper execution handles so that exception should be printed.
10. Explain the following:
(a) Java’s Built-in Exception
(b) Uncaught Exception
(c) Creating your own exception class
11. Write a simple program to generate chained exception using throw.

MODULE 5:

1. What are enumerations in Java? How Java enumerations are different from other languages
like C, C++.
2. What are applets? Explain the different stages in the life cycle of Applet.
OR
What is an Applet? Explain the skeleton of an Applet.
3. Write a note on:
a) Type Wrapper
OR
What are type wrappers? Explain different type wrappers.
OR
What is an Applet? Write a Simple Applet program to print the message “My Simple
Applet” with suitable steps to execute on Applet.
b) Transient and Volatile modifier
4. Explain different streams supported to perform I/O.
5. Depict the usefulness of static import with the help of a program. Is it advantageous to
always make use of static import? Explain.
6. Explain the following with examples
a) String Comparison
b) Searching Strings
c) Modifying string
d) Overloading string constructors
OR
What is String? Explain different string class constructors.
7. Explain the following:
a) charAt() b) getBytes() c) compareTo() d) toCharArray()
8. Explain the difference between String and StringBuffer class. With proper syntax, explain
the following methods:
a) Method to extract particular character of a string
b) Reverse a string

You might also like