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

Java practice question for viva

The document outlines a Java project focused on displaying IPL match data through a GUI, utilizing MySQL for database management and API integration for live data. It details the technologies used, GUI design with Swing, database connectivity via JDBC, and the implementation of OOP principles. Additionally, it covers security measures, testing, and future enhancements for the project.

Uploaded by

vasusharma070
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)
10 views

Java practice question for viva

The document outlines a Java project focused on displaying IPL match data through a GUI, utilizing MySQL for database management and API integration for live data. It details the technologies used, GUI design with Swing, database connectivity via JDBC, and the implementation of OOP principles. Additionally, it covers security measures, testing, and future enhancements for the project.

Uploaded by

vasusharma070
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/ 8

Viva Cheat Sheet: IPL Java Project

1. Project Overview

Q: What is the main objective of your project?


A: To create a Java application that displays IPL match data, team details, and results using a
GUI, MySQL database, and live API integration.

Q: Technologies used?

• Java (Swing for GUI)

• MySQL (Database)

• HTTP & JSON (API data handling)

• JDBC (Database connectivity)

2. GUI with Swing

Q: How did you design your GUI?


A: Using Java Swing components like JFrame, JPanel, JTable, JTextField, and JButton.

Q: What layout managers did you use?


A: Mostly BorderLayout and GridLayout for organizing components.

Q: How is event handling implemented?


A: Using ActionListener interface and overriding actionPerformed() to handle button clicks.

3. Database

Q: How is database connectivity implemented?


A: With JDBC using Connection, PreparedStatement, and ResultSet.

Q: Which file manages database connection?


A: DatabaseConnection.java

Q: What is the structure of your database?


A: Tables like teams, matches, and results with fields like team_id, match_date, winner, etc.

4. API Integration

Q: Which API is used and how?


A: IPL match schedule API (fetched via HttpURLConnection, HttpClient, or OkHttp in files like
DownloadJSON.java, TestHttpClient.java).
Q: How do you parse JSON?
A: Using built-in JSON parsing methods or libraries (e.g., org.json.JSONObject).

Q: What is SSLHelper.java?
A: A helper to bypass SSL validation for easier API access in local testing.

5. Code & Design

Q: What is the purpose of ApiTestGui.java?


A: It displays API data in a GUI format.

Q: What is TeamDAO.java used for?


A: It handles team data access from the database using DAO (Data Access Object) pattern.

Q: Role of IPLMatchResultGUI.java?
A: To show match results in a GUI table format.

6. OOP Principles

Encapsulation: Classes like TeamDAO hide database logic behind methods.


Abstraction: GUI hides the backend logic from users.
Inheritance: May be used in custom GUI components or extended classes.
Polymorphism: Through interface implementations like ActionListener.

7. Security

Q: How do you secure your API calls?


A: Used SSL Helper to manage HTTPS. In real-world, would use authentication and token-
based headers.

8. Testing & Validation

Q: What is DatabseConnectionCheck.java?
A: A test file to verify if the DB connection is successfully established.

Q: How did you test features?


A: By running modules individually (team fetch, match add, API fetch) and verifying with DB
and GUI outputs.

9. Deployment
Q: How to run your project?

1. Setup MySQL with IPL DB

2. Run Java files (starting with GUIIPL.java or IplSwingApp.java)

3. Ensure internet access for API-based modules

Q: Future scope?

• Add login/registration

• Use charts for data visualization

• Enhance GUI with JavaFX or web-based frontend

ChatGPT said:

Absolutely! Here's an expanded list of fundamental and technical viva questions (with
answers) including Java basics, AWT/Swing, database, API, OOP, and project-related
concepts that you might be asked.

Expanded Viva Questions with Answers

GUI Basics (AWT & Swing)

Q: What is AWT?
A: AWT (Abstract Window Toolkit) is Java’s original platform-dependent GUI toolkit used for
creating windows, buttons, and other GUI components.

Q: What is Swing?
A: Swing is a part of Java Foundation Classes (JFC) and is used to create lightweight,
platform-independent GUIs.

Q: Difference between AWT and Swing?

Feature AWT Swing

Dependency Platform dependent Platform independent

Look & Feel Native OS look Pluggable Look & Feel

Components Heavyweight Lightweight

Package java.awt javax.swing


Q: What is JFrame?
A: It's a top-level Swing container used to create windows.

Q: What is JPanel?
A: A generic container inside a JFrame to group UI elements.

Q: What is an ActionListener?
A: An interface used to receive action events like button clicks.

Java & OOP Concepts

Q: What is a class and an object?


A: A class is a blueprint; an object is an instance of a class.

Q: What are constructors?


A: Special methods used to initialize objects.

Q: What is inheritance?
A: A mechanism where one class acquires properties of another.

Q: What is encapsulation?
A: Wrapping data and methods together, restricting direct access.

Q: What is abstraction?
A: Hiding internal details and showing only essential features.

Q: What is polymorphism?
A: The ability to take many forms, like method overloading and overriding.

Java Packages & Keywords

Q: What is a package in Java?


A: A namespace to organize classes and interfaces (e.g., java.util).

Q: What is static keyword?


A: Used for members that belong to the class rather than instances.

Q: What is final keyword?


A: Used to declare constants, prevent method overriding, and inheritance.

Q: What is this keyword?


A: Refers to the current object.

Q: What is super keyword?


A: Refers to the parent class object.
Database & JDBC

Q: What is JDBC?
A: Java Database Connectivity API to connect and interact with databases.

Q: What are the steps to connect Java with MySQL?

1. Load the driver

2. Establish connection

3. Create statement

4. Execute query

5. Close connection

Q: What is a PreparedStatement?
A: A precompiled SQL statement to improve performance and prevent SQL injection.

Q: What is ResultSet?
A: It holds the result of a query.

API & Networking

Q: What is an API?
A: An Application Programming Interface allows interaction between software.

Q: How do you make HTTP requests in Java?


A: Using HttpURLConnection, HttpClient, or third-party libraries like OkHttp.

Q: What is JSON?
A: JavaScript Object Notation, a lightweight data-interchange format.

Q: How did you parse JSON in your project?


A: Using libraries like org.json.JSONObject or built-in parsing with string methods.

Project-Specific Questions

Q: What does IPLMatchResultGUI.java do?


A: It displays IPL match results in a GUI window/table.

Q: How do you add a new match in your application?


A: Using AddMatchGUI.java, which takes user input and stores it in the database.
Q: What is the role of TeamDAO.java?
A: It follows the DAO pattern to access team data from the database.

Q: Why did you name it "ApiTest" initially?


A: To test the working of API integration before full GUI implementation.

Testing & Debugging

Q: How do you debug Java applications?


A: Using IDE breakpoints, logs, and console output.

Q: Did you use any version control system?


A: (Answer based on your use — e.g., Git, GitHub, or "No, it was local").

Here’s a list of important Java OOPs viva questions with brief answers to help you prepare
confidently:

Basic OOPs Concepts

1. What is Object-Oriented Programming (OOP)?


OOP is a programming paradigm based on the concept of "objects", which can
contain data (fields) and code (methods).

2. What are the 4 pillars of OOP?

o Encapsulation

o Inheritance

o Polymorphism

o Abstraction

3. What is a class and an object?

o Class: Blueprint for objects.

o Object: Instance of a class.


Encapsulation

4. What is encapsulation in Java?


Encapsulation is the process of wrapping data and code together. It hides the internal
state of the object and only exposes operations.

5. How is encapsulation implemented in Java?


Using private access modifiers for variables and public getters/setters.

Inheritance

6. What is inheritance?
It allows one class to acquire the properties and methods of another class using
extends.

7. What are the types of inheritance in Java?

o Single

o Multilevel

o Hierarchical
(Java doesn't support multiple inheritance with classes directly.)

8. Why doesn’t Java support multiple inheritance with classes?


To avoid ambiguity (Diamond Problem). It’s handled using interfaces instead.

Polymorphism

9. What is polymorphism?
Polymorphism means "many forms". It allows the same method to behave differently
based on the object.

10. Types of polymorphism in Java?

• Compile-time (Method Overloading)

• Runtime (Method Overriding)

11. Difference between overloading and overriding?

• Overloading: Same method name, different parameters (same class).

• Overriding: Same method in subclass with same signature.


Abstraction

12. What is abstraction?


Hiding the implementation details and showing only the functionality.

13. How is abstraction achieved in Java?

• Abstract classes

• Interfaces

14. Difference between abstract class and interface?

• Abstract class can have both abstract and non-abstract methods.

• Interface only has abstract methods (Java 8+ allows default/static too).

• A class can implement multiple interfaces but extend only one class.

Miscellaneous

15. What is the ‘super’ keyword in Java?


Refers to the immediate parent class object. Used to access parent class
methods/constructors.

16. Can constructors be inherited?


No, constructors are not inherited.

17. What is the difference between ‘this’ and ‘super’?

• this: Refers to current class instance

• super: Refers to parent class instance

18. What is dynamic method dispatch?


It is the process by which a call to an overridden method is resolved at runtime.

19. What is final keyword in Java?

• final variable: constant

• final method: cannot be overridden

• final class: cannot be extended

20. Can you instantiate an abstract class?


No, but you can have references to it.

You might also like