0% found this document useful (0 votes)
5 views

Java_Programming_QA_Sample_Answers

The document outlines predicted questions for a Java Programming exam, covering various topics such as basic syntax, inheritance, exception handling, event handling, network programming, and database interaction using JDBC. It includes specific questions about Java features, constructors, methods, and classes, along with programming tasks and definitions. Each unit is structured with questions that vary in marks, indicating their importance and complexity.

Uploaded by

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

Java_Programming_QA_Sample_Answers

The document outlines predicted questions for a Java Programming exam, covering various topics such as basic syntax, inheritance, exception handling, event handling, network programming, and database interaction using JDBC. It includes specific questions about Java features, constructors, methods, and classes, along with programming tasks and definitions. Each unit is structured with questions that vary in marks, indicating their importance and complexity.

Uploaded by

sanadeprajwal94
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Q: Predicted Questions (Java Programming 314317 - Exam 2025)

Q: UNIT 1: Basic Syntactical Constructs in Java

Q: 2 Marks

Q: List any four features of Java.

A: 1. Platform Independent

2. Object Oriented

3. Robust

4. Secure

Q: Write syntax of type casting with an example.

A: Syntax: dataType variableName = (dataType) value;

Example: int a = (int) 10.5;

Q: Enlist any four compile-time errors.

Q: State the use of finalize() method with syntax.

Q: Define wrapper classes. Give examples.

Q: Write syntax of declaring and initializing an array.

Q: Define symbolic constant and give an example.

Q: 4 Marks and 6 Marks

Q: Features of Java. (Any four points)

Q: What is a Constructor? Explain Parameterized Constructor with example.

A: A constructor is a special method used to initialize objects. A parameterized constructor takes

arguments.

Example:

class MyClass {

int x;

MyClass(int i) { x = i; }

Q: Write a Java Program to print all Armstrong numbers from 0 to 999.


Q: Describe the features of Java (any 4 features).

Q: Write a Java Program to create a class Employee with data members id, name, and salary.

Accept details of 5 employees and display the employee having the highest salary.

Q: Difference between String and StringBuffer. (Any four points)

Q: Describe any four methods of String class.

Q: Explain this and super keyword usage.

Q: Explain Vector class with 4 methods and examples.

Q: UNIT 2: Inheritance, Interface and Packages

Q: 2 Marks

Q: State two advantages of using Inheritance.

Q: Differentiate between method overloading and method overriding. (Any 2 points)

Q: State syntax for creating and importing a package.

Q: Give use of 'super' keyword with one example.

Q: Define Interface with syntax.

A: An interface is a reference type in Java, similar to a class, that can contain only constants,

method signatures, default methods, static methods, and nested types.

Syntax: interface MyInterface { void method(); }

Q: List any two types of inheritance in Java.

Q: 4 Marks or 6 Marks

Q: Differentiate between Method Overloading and Method Overriding.

Q: Explain Single and Multilevel Inheritance with example.

Q: Define Interface and explain with syntax.

Q: How to create and access user-defined Package?

Q: Explain the use of super keyword with example.

Q: Define the interface Shape with two methods: area() and perimeter(). Create two classes Circle

and Rectangle implementing the interface and write a program to demonstrate polymorphism.

Q: Explain Packages with example. How to create and import?


Q: Describe Packages in Java. Explain how to create and import a package with example.

Q: UNIT 3: Exception Handling and Multithreading

Q: 2 Marks

Q: Differentiate between Error and Exception.

A: Errors are serious issues not intended to be caught by applications (e.g., OutOfMemoryError).

Exceptions are conditions that applications may want to catch (e.g., IOException).

Q: List any two built-in exceptions in Java.

Q: Write syntax to create a thread by implementing Runnable interface.

Q: State any two thread methods with syntax.

Q: List thread priority constants.

Q: 4 Marks or 6 Marks

Q: Program to create a user-defined Exception (example: NoMatchException or MIN_BAL

Exception).

Q: Write a program to print even and odd numbers using two threads.

Q: Explain the Life Cycle of a Thread with neat diagram.

Q: Write a Java Program using two Threads:

Q: Thread A prints even numbers from 1 to 50.

Q: Thread B prints odd numbers from 1 to 50.

After 3 numbers, Thread A should sleep for 500 ms.

Q: Write a Java Program to create a user-defined exception named InvalidPasswordException that

is thrown when the password entered is not "MSBTE2025".

Q: Explain the concept of Exception Handling with syntax of try-catch-finally blocks. Provide a

suitable example.

Q: Define exception called 'No Match Exception' that is thrown when the password accepted is not

equal to 'MSBTE'. Write the program.

Q: UNIT 4: Event Handling, AWT & Swing

Q: 2 Marks
Q: Enlist any two layout managers.

Q: State two differences between AWT and Swing.

Q: Give syntax of using ActionListener interface.

Q: Write syntax to add a button using AWT.

Q: 4 Marks or 6 Marks

Q: Write an applet to take inputs from TextFields and perform an action.

Q: Create a GUI with JTabbedPane with multiple tabs.

Q: Write a program to create JTree with nodes and sub-nodes.

Q: Explain JScrollPane and JTable with constructors.

Q: UNIT 5: Basics of Network Programming

Q: 2 Marks

Q: State any two methods of InetAddress class.

Q: Define reserved socket with example.

Q: State the use of URLConnection class.

Q: List any two factory methods of URL class.

Q: 4 Marks or 6 Marks

Q: Explain InetAddress with example.

Q: Write server-client steps of program using TCP sockets.

Q: Difference between TCP and UDP

Q: Explain use of URLConnection class with program.

Q: List and explain URL class methods.

Q: UNIT 6: Interacting with Database (JDBC)

Q: 2 Marks

Q: State any two JDBC driver types.

Q: Write steps to establish a JDBC connection. (List form)

Q: Differentiate between two-tier and three-tier architecture (any 2 points).

Q: Give syntax for creating Statement and ResultSet.


Q: 4 Marks or 6 Marks

Q: Write a JDBC program to connect and perform Insert/Delete/Update.

Q: Explain PreparedStatement interface with program.

You might also like