0% found this document useful (0 votes)
10 views10 pages

JAVA IMP

The document outlines various topics related to Java programming, including basic syntactical constructs, inheritance, interfaces, exception handling, multithreading, event handling using AWT and Swing, network programming, and database interaction. It includes questions and tasks that cover Java features, error handling, thread management, and applet creation. The content is structured into units with specific focus areas and practical programming exercises.

Uploaded by

rajkirdath369
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
0% found this document useful (0 votes)
10 views10 pages

JAVA IMP

The document outlines various topics related to Java programming, including basic syntactical constructs, inheritance, interfaces, exception handling, multithreading, event handling using AWT and Swing, network programming, and database interaction. It includes questions and tasks that cover Java features, error handling, thread management, and applet creation. The content is structured into units with specific focus areas and practical programming exercises.

Uploaded by

rajkirdath369
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 10

2 MARKS

Unit - I: Basic Syntactical Constructs in Java

a) List any eight features of Java.

b) State the use of finalize() method with its syntax.

c) Name the wrapper class methods for the following:

(i) To convert string objects to primitive int.

(ii) To convert primitive int to string objects.

d) List the types of inheritances in Java.

e) Write the syntax of try-catch-finally blocks.

f) Give the syntax of <param> tag to pass parameters to an


applet.

g) Define stream class. List its types.

a) Define constructor. List its types.

b) Define class and object.

c) List the methods of File Input Stream Class.

d) Define error. List types of error.

e) List any four Java API packages.

f) Define array. List its types.

g) List access specifiers in Java.

a) Enlist the logical operators in Java.

b) Give the syntax and example for the following functions:

i) min()

ii) sqrt()

a) Define the terms with example:

i) Class

ii) Object

b) Enlist any two access specifiers with syntax.


c) Give a syntax to create a package and access a package in
Java.

a) Enlist any two logical operators and two bitwise operators.

b) Define constructor.

c) Write down the syntax of array declaration, initialization.

a) State the significance of Java Virtual Machine (JVM) in the Java


programming environment.

Unit - II: Inheritance, Interface, and Packages

a) Define the interface in Java.

d) Enlist any four inbuilt packages in Java.

a) Define the interface in Java. Write the syntax.

c) Give a syntax to create a package and access a package in


Java.

d) List the types of inheritances in Java.

Unit - III: Exception Handling and Multithreading

e) Write the syntax of try-catch-finally blocks.

a) Define error. List types of error.

e) Differentiate between starting a thread with run() method and


start() method.

f) State the classes that an applet can extend.

e) Write the syntax of try-catch-finally blocks.

d) Define the interface in Java. Write the syntax.

e) Define thread. Mention 2 ways to create a thread.

Unit - IV: Event handling using Abstract Window Toolkit (AWT) &
Swing Components
f) Give the syntax of <param> tag to pass parameters to an
applet.

e) Explain any two methods of the File Class.

f) Write the syntax of ellipse().

d) Give the syntax of the following thread methods:

i) notify()

ii) sleep()

f) Write the syntax of drawRect().

Unit - V: Basics of Network Programming

g) Define stream class and list types of stream class.

c) List the methods of the File Input Stream Class.

g) Give syntax to open a file using InputStream class.


4 MARKS
Unit - I Basic Syntactical Constructs in Java
1. Explain the concept of platform independence and portability
with respect to Java language.
2. Explain the types of constructors in Java with suitable
example.
3. Explain the four access specifiers in Java.
4. Differentiate between String and String Buffer.
5. Define type casting. Explain its types with syntax and example.
6. Explain any four features of Java.
7. Write a Java program to find out the even numbers from 1 to
100 using for loop.
8. Explain any four visibility controls in Java.
9. Explain switch case and conditional operator in java with
suitable example.
10. Describe type casting in java with example.
11. Write a program to print all the Armstrong numbers from
0 to 999.
12. Describe any four features of java.
13. Write a program to display ASCII value of a number 9.
14. Explain implicit and explicit type conversion with example
in detail.
15. Explain the concept of platform independence in Java and
discuss how it is achieved. Give example to illustrate the
concept.
16. What happens if you don't define any constructor in a
class? Can you still create objects of that class? Explain with
example.
17. Explain any two logical operators in Java with example.
18. What is constructor? List types of constructor. Explain
parameterized constructor with suitable example.
19. Write a program to count the number of words from a
text file using stream classes.
20. Write a program to copy content of one file to another
file.

Unit - II Inheritance, Interface and Packages


1. Explain dynamic method dispatch in Java with suitable
example.
2. Differentiate between method overloading and method
overriding.
3. Explain single and multilevel inheritance with proper example.
4. Describe final variable and final method.
5. Explain how to create a package and how to import it.
6. Explain how the "super" keyword can be used in inheritance?
Give an example to demonstrate its usage.
7. Implement the following inheritance. Refer Fig. No. 01.

8.
9. Describe interface in java with suitable example.
10. Describe interface in java with suitable example.

Unit - III Exception Handling and Multithreading


1. Define exception. State built-in exceptions.
2. Explain exception handling mechanism. w.r.t. try, catch, throw
and finally.
3. Write a program to create a user defined exception in java.
4. Explain life cycle of thread.
5. Explain life cycle of Thread.
6. Define Thread. Draw life cycle of Thread.
7. Explain the two ways of creating threads in Java
8. Write a Java program in which thread A will display the even
numbers between 1 to 50 and thread B will display the odd
numbers between 1 to 50. After 3 iterations thread A should go
to sleep for 500 ms.
9. Write a program to input name and salary of an employee and
throw a user-defined exception if entered salary is negative.
10. Write a program to create two threads. One thread will
display the numbers from 1 to 50 (ascending order) and the
other thread will display numbers from 50 to 1 (descending
order).

Unit - IV Event handling using Abstract Window Toolkit (AWT) &


Swings Components
1. Describe the use of following methods:
o (i) Drawoval()
o (ii) getFont()
o (iii) drawRect()
o (iv) getFamily()
2. Explain the following with syntax:
o i) drawLine
o ii) drawOval
o iii) drawArc
o iv) drawstring
3. Write a java applet to display the following output in Red color.
Refer Fig No. 1.

4. Explain any four font methods with example.


5. Write an applet program for following graphics method.
o i) Drawoval ( )
o ii) Drawline ( )
6. Explain the following with syntax:
o i) drawLine
o ii) drawOval
o iii) drawArc
o iv) drawstring
Unit - V Basics of Network Programming
1. Distinguish between Input stream class and output stream
class.
2. Explain the following classes.
o (i) Byte Stream Class
o (ii) Character Stream Class
3. Enlist types of Byte stream class and describe input stream
class and output stream class.
4. Write a program to read a file and then count number of
words.
5. Differentiate between Byte Stream Class and Character Stream
Class. (Any four points)
6. Write a program to append content of one file into another file.
7. What is the concept of streams in Java? How do streams
facilitate input and output operations?
8. Create a new test file named ''data.txt'' using the File class.
Write a program to count number of words of "data.txt" using
stream classes.

6 MARKS
Unit - I: Basic Syntactical Constructs in Java
1. Explain the concept of Dynamic method dispatch with a
suitable example.
2. Explain the command line arguments with a suitable example.
3. Describe the applet life cycle in detail.
4. Write a program to create a vector with five elements as (5,
15, 25, 35, 45). Insert a new element at the 2nd position.
Remove 1st and 4th element from the vector.
5. Write a Java program to count the number of words from a text
file using stream classes.
6. Explain the difference between string class and string buffer
class. Explain any four methods of string class.
7. Write a program to copy all elements of one array into another
array.
8. Write a program to print even and odd numbers using two
threads with a delay of 1000ms after each number.
9. Write a program that throws an exception called
“NoMatchException” when a string is not equal to “India”.
10. Write a Java applet to draw a bar chart for the following
values.
11. Write a Java program to define class Employee with
members as id and salary. Accept data for five employees and
display details of employees getting highest salary.
12. Write a program to design an Applet showing three
concentric circles filled with three different colors.

Unit - II: Inheritance, Interface, and Packages


1. Define packages. How to create a user-defined package?
Explain with an example.
2. How to create a user-defined package in Java? Explain with a
suitable example.
3. Implement the following inheritance.
4. What is a constructor? List types of constructors. Explain
parameterized constructor with a suitable example.
5. Write a program to perform the following tasks:
o (i) Create a text file and store data in it.
o (ii) Count the number of lines and words in that file.
6. Write a Java program in which thread A will display the even
numbers between 1 to 50 and thread B will display the odd
numbers between 1 to 50. After 3 iterations, thread A should
go to sleep for 500 ms.
7. Write a program to implement the following inheritance. (Refer
Fig. No. 1)

8. Write a program to print the sum, difference, and product of


two complex numbers by creating a class named "Complex"
with separate methods for each operation whose real and
imaginary parts are entered by the user.
9. Write a program to define and implement an interface to
calculate Simple Interest and Compound Interest with a static
final field of rate 25%.
Unit - III: Exception Handling and Multithreading
1. What is constructor? List types of constructors. Explain
parameterized constructor with a suitable example.
2. i) Explain Errors and their types in detail. ii) Explain thread
methods to set and get priority.
3. Explain the concept of exception handling in Java and its
importance in robust programming. Provide an example to
illustrate the implementation and benefits of exception
handling.
4. Write a program to throw a custom exception called
“NoMatchException” when a string is not equal to “India”.
5. Explain thread life cycle with a neat diagram.
6. Write a program to generate the following output using the
drawLine() method. (Refer Fig. No. 2)

Unit - IV: Event Handling using Abstract Window Toolkit (AWT) &
Swing Components
1. Explain the concept of argument passing and the usage of the
'this' keyword in Java. Give an example to illustrate their usage
and benefits.
2. Write a program to create two threads: one thread will print
even numbers between 1 to 50, and the other will print odd
numbers between 1 to 50.
3. Write a program to design an Applet showing three concentric
circles filled with three different colors.
4. Write a program to draw a chessboard in Java Applet.
5. Write a Java applet to draw a bar chart for the following
values.

Unit - V: Basics of Network Programming


1. Write a program to define class Employee with members as id
and salary. Accept data for five employees and display details
of employees getting highest salary.

Unit - VI: Interacting with Database


1. Write a Java program to count the number of words from a text
file using stream classes.
----------++::::++---------

You might also like