0% found this document useful (0 votes)
3 views6 pages

Important Questions in Java

Uploaded by

indhuja.m
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views6 pages

Important Questions in Java

Uploaded by

indhuja.m
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

UNIT – I

Part A – 2 Marks (Short Answer Type)

1. What are the key features of Java?


2. List any four primitive data types in Java.
3. What is the use of the this keyword?
4. Define constructor overloading with an example.
5. What is the difference between == and equals()?
6. Mention any two differences between while and do-while loops.
7. What is meant by recursion in Java?
8. Write the syntax of the if-else-if ladder.
9. What is the purpose of the break and continue statements?
10. Define an abstract class.

Part B – 5 Marks (Short/Medium Answer Type)

1. Explain the origin and challenges of Java programming.


2. Write a Java program to read and display a string using Scanner class.
3. Compare and contrast if, if-else, and nested if statements with suitable examples.
4. Explain the different types of constructors with examples.
5. Describe combined assignment operators in Java with code examples.
6. Discuss the scope of variables in Java.
7. What is method overloading? Illustrate with an example.
8. Write a Java program using a switch statement to display a day name based on day
number.
9. Explain any five features of Object-Oriented Programming (OOP).
10. Write a program to demonstrate nested loops.

Part C – 10 Marks (Essay Type)

1. Discuss the features of Java and how it overcomes the challenges of earlier languages.
2. Explain Java data types, type conversions, and scope of variables in detail.
3. Write a Java program using all control statements: if, else, switch, while, and for.
4. What are classes and objects in Java? Explain with syntax and example program.
5. Describe in detail about constructors and constructor overloading in Java with example.
6. Explain abstract classes and methods with example programs.
7. Illustrate static members and their usage with example code.
8. What are nested and inner classes? Explain with a Java program.
9. Describe the steps to create and use packages in Java.
10. Discuss in detail about recursion with a Java program to calculate factorial.
UNIT – II
Part A – 2 Marks (Short Answer Type)

1. Define an array. How is it declared in Java?


2. What is the purpose of the StringBuilder class?
3. Mention any two methods of the String class.
4. What is method overriding?
5. How do you call a superclass constructor?
6. What is the difference between String and StringBuffer?
7. Define an interface. Give syntax.
8. What is the use of access specifiers in Java?
9. What is the use of final keyword in inheritance?
10. List any two advantages of using packages.

Part B – 5 Marks (Short/Medium Answer Type)

1. Write a Java program to find the sum of elements in a two-dimensional array.


2. Compare and contrast String, StringBuffer, and StringBuilder.
3. Explain how arrays are passed and returned from a method in Java.
4. Describe the concept of polymorphism with an example.
5. What is multiple inheritance using interfaces? Illustrate with an example.
6. Write short notes on the StringTokenizer class with example.
7. Explain how to access packages in NetBeans IDE.
8. Write a Java program using an interface and show how it supports multiple inheritance.
9. Differentiate between abstract class and interface.
10. Explain static import and its significance with example.

Part C – 10 Marks (Essay/Long Answer Type)

1. Explain the various types of arrays in Java including one-dimensional, two-dimensional,


and multi-dimensional arrays with examples.
2. Discuss in detail about String, StringBuffer, and StringBuilder classes with examples of
their methods.
3. Write a Java program to demonstrate inheritance and method overriding.
4. Explain interfaces in Java. Write a Java program to demonstrate multiple inheritance
using interfaces.
5. Describe the concept of abstract classes and final classes with suitable examples.
6. Explain how packages are created and accessed in Java, especially in NetBeans IDE.
7. Write a Java program to demonstrate the use of a multilevel interface.
8. How is polymorphism achieved in Java? Illustrate with a Java program.
9. Write a Java program to demonstrate returning an array from a method.
10. Explain the purpose and use of access specifiers in Java with examples.
UNIT - III
Part A – 2 Marks (Short Answer Type)

1. What is an exception in Java?


2. Write the syntax of a try-catch block.
3. What is the use of the finally block?
4. Define custom exception.
5. Mention any two built-in exceptions in Java.
6. What is a thread?
7. What is the use of the join() method in threads?
8. What is a daemon thread?
9. Differentiate between byte stream and character stream.
10. What is the purpose of the File class in Java?

Part B – 5 Marks (Short/Medium Answer Type)

1. Explain exception propagation with an example.


2. Differentiate between throw and throws with examples.
3. Write a Java program to demonstrate multiple catch blocks.
4. Describe the life cycle of a thread with a neat diagram.
5. What is synchronization? Explain with a small Java program.
6. Write short notes on thread pool and thread group.
7. Explain inter-thread communication with an example.
8. Write a Java program to read a file using FileReader class.
9. What is the difference between byte stream and character stream?
10. Discuss the role of the RandomAccessFile class in Java.

Part C – 10 Marks (Essay/Long Answer Type)

1. Explain the different ways of handling exceptions in Java with examples.


2. Write a Java program to create a custom exception.
3. Discuss multithreading in Java. Explain thread creation, thread life cycle, and thread
control methods.
4. Explain the concept of synchronization and inter-thread communication with Java
programs.
5. Write a Java program to demonstrate the use of a thread pool.
6. Describe the different types of I/O streams in Java with suitable examples.
7. Explain the working of byte streams and filtered byte streams with examples.
8. Write a detailed note on file handling in Java using the File, FileReader, and
FileWriter classes.
9. Explain how to create and manage daemon threads with a sample program.
10. Compare and contrast built-in exceptions and custom exceptions with proper examples.
UNIT - IV
Part A – 2 Marks (Short Answer Type)
1. What is an applet?
2. List the stages in the life cycle of an applet.
3. How do you pass parameters to an applet?
4. Name any two methods of the Graphics class.
5. What is event handling in Java?
6. Define a layout manager.
7. Differentiate between AWT and Swing components.
8. What is the use of the paint() method in an applet?
9. Name two AWT component classes.
10. What is a dialog box in Java?

Part B – 5 Marks (Short/Medium Answer Type)


1. Explain the life cycle methods of an applet with a neat diagram.
2. Write a simple Java applet program to display a message.
3. Explain how values are passed to an applet using parameters.
4. Discuss different types of layout managers in Java.
5. Compare AWT and Swing components.
6. Write a Java program to draw basic graphics (like lines, rectangles) using the Graphics
class.
7. Explain the event delegation model in Java.
8. How are dialog boxes created and used in Java GUI applications?
9. Write short notes on any four AWT component classes.
10. List the applications of AWT controls.

Part C – 10 Marks (Essay/Long Answer Type)


1. Describe the complete life cycle of an applet with a flow chart and explain each method.
2. Write a Java applet program to accept two numbers through parameters and display their
sum.
3. Explain how graphics are handled in applets using the Graphics class with a sample
program.
4. Discuss the concept of event handling in Java with examples of action events and mouse
events.
5. Write a Java program using AWT controls to create a simple calculator GUI.
6. Explain the different types of layout managers and their usage with examples.
7. Compare and contrast AWT and Swing. Write a simple Swing-based Java program.
8. Describe the steps involved in creating windows and dialog boxes using AWT/Swing.
9. Explain the structure and working of a simple Java GUI application using AWT and
Swing.
10. How does event handling work in Java GUI programming? Illustrate with an example for
handling a button click.
UNIT - V
Part A – 2 Marks (Short Answer Type)
1. What is event handling in GUI?

2. List any two AWT graphics classes.

3. Mention any two Swing controls.

4. What is the difference between AWT and Swing?

5. Define JDBC.

6. What are the types of JDBC drivers?

7. Mention any two JDBC interfaces.

8. What is the role of DriverManager in JDBC?

9. Write the syntax to load a JDBC driver.

10. What is the use of the executeUpdate() method in JDBC?

Part B – 5 Marks (Short/Medium Answer Type)


1. Explain the hierarchy of AWT component classes.

2. Write a Java program using Swing controls (e.g., JButton, JLabel) to perform a basic
operation.

3. Describe event handling in Java with a simple example (e.g., handling button click).

4. Compare AWT and Swing components with examples.

5. What are layout managers? Explain any two with examples.

6. Write a short note on JDBC architecture.

7. List and explain the steps involved in establishing a JDBC connection.

8. Write a Java code snippet to connect to a MySQL database using JDBC.

9. What are the different JDBC interfaces? Explain their uses.

10. Explain how to create a table using JDBC with a program.


Part C – 10 Marks (Essay/Long Answer Type)
1. Write a Java program using AWT components to design a login window and handle
events.

2. Explain event handling in detail using both AWT and Swing components with code
examples.

3. Compare AWT and Swing with advantages, disadvantages, and suitable Java examples.

4. Write a Java application using Swing controls to accept two numbers and display their
sum/difference.

5. Explain the JDBC architecture in detail with a neat diagram.

6. Describe different types of JDBC drivers. Discuss their pros and cons.

7. Write a complete Java JDBC program to create a database and a table and insert data into
it.

8. Explain various JDBC classes and interfaces involved in database connectivity.

9. Describe step-by-step how to perform CRUD operations using JDBC with examples.

10. Write a Java GUI application using Swing and JDBC to perform student record entry into
a database.

You might also like