List of Questions : For the preparation of BCA semester 5 examination theory/practical
Old Question papers
CS-25 ADV. JAVA Programming (J2EE) OCT- 2019
CS-25 ADV. JAVA Programming (J2EE) OCT- 2019 New
J2EE Platform
- Enterprise Architecture Style
- Web Container
- J2EE APIs
- Logical Layers in Multi tier applications
JDBC (Java Database Connectivity)
- JDBC Driver Types
- Explain Driver Manager class
- Connection Interface
- Statement Inteerface with its methods
- Prepared Statement Interface with its methods
- Callable Statement Interface with its methods
- DatabaseMetaData and its methods
- ResultsetMetaData and its methods
- Develop JDBC code to connect with Access, MySql and Oracle Database
RMI (Remote Method Invocation)
- RMI Architecture
- Explain Stub and Skeleton
- Usage of RMI
Servlet
- Ways to Create Servlet
- Servlet Life Cycle
- Servlet config Vs Servlet Context
- Explain HttpRequest and HttpResponse
- Explain any 5 Request header attributes
- Usage setContentType() method
- Explain Session Managements Techniques
- Session with example (start and expire session with methods)
- Cookies with example (try to add variables and objects)
- Explain Request Dispatcher with Include and Forward method
JSP (Java Server Pages)
- Servlet Vs JSP
- JSP implicit objects
- JSP Elements
- Scope of JSP variables
- Develop a JSP code to display oracle table data in a tabular format
Java Beans
- Write a note on Java Beans
- Usage of Java Beans
- Set Property vs Get Property
- Types of Properties in Bean
MVC (Model View Controller)
- Write a note on MVC Architecture
- MVC types
EJB (Enterprise Java Beans)
- Explain EJB with its Benefits
- Write a note on types of EJB
- Explain Timer Service
- State full vs Stateless beans
Hibernate Framework
- Need of Hibernate
- Feature of Hibernate
- Jar files of Hibernate
- Hibernate Configuration and Mapping file
- Hibernate Inheritance
- Hibernate Annotations
- Hibernate Sessions
Spring Framework
- Spring Architecture
- Components of Spring
- Advantage of Spring Framework
- Dependency Injection (IoC) with example
- AOP vs OOP
- Write a note on AOP
- Explain Application with Spring
Struts Framework
- Struts Features
- Advantages & Dis Advantages of Struts
- Basic Components of Struts
- MVC 1 vs MVC 2
Answers of above…
J2EE Platform:
- A Java-based platform for building enterprise applications.
- Provides APIs and services for various functionalities like web services, database access, and distributed computing.
Enterprise Architecture Style:
- A framework for designing and implementing enterprise applications.
- Common styles include layered, event-driven, and service-oriented architectures.
Web Container:
- A runtime environment that handles HTTP requests and responses.
- Implements the Servlet API and provides services like session management and security.
J2EE APIs:
- A set of standard APIs that define how components interact.
- Includes APIs for servlets, JSPs, EJBs, JDBC, JMS, and more.
Logical Layers in Multi-tier Applications:
- Presentation layer: Handles user interaction and displays data.
- Business logic layer: Implements the core business rules and logic.
- Data access layer: Interacts with databases and other data sources.
JDBC (Java Database Connectivity):
- An API for connecting Java applications to databases.
- Provides classes and interfaces for interacting with databases.
JDBC Driver Types:
- Type 1: JDBC-ODBC Bridge
- Type 2: Native API
- Type 3: Pure Java
- Type 4: Thin Driver
Explain Driver Manager class:
- A class that manages database drivers.
- Used to register drivers and obtain connections.
Connection Interface:
- Represents a connection to a database.
- Provides methods for creating statements, executing queries, and committing/rolling back transactions.
Statement Inteerface with its methods:
- Represents a SQL statement.
- Methods: executeQuery(), executeUpdate(), execute(), close().
Prepared Statement Interface with its methods:
- Represents a precompiled SQL statement.
- Methods: executeQuery(), executeUpdate(), execute(), close(), setXXX() methods for parameter binding.
Callable Statement Interface with its methods:
- Represents a callable SQL statement.
- Methods: executeQuery(), executeUpdate(), execute(), close(), setXXX() methods for parameter binding and return parameter registration.
DatabaseMetaData and its methods:
- Provides information about the database.
- Methods: getCatalogs(), getSchemas(), getTables(), getColumns(), etc.
ResultsetMetaData and its methods:
- Provides information about a result set.
- Methods: getColumnCount(), getColumnLabel(), getColumnType(), etc.
Develop JDBC code to connect with Access, MySql and Oracle Database:
- Refer to JDBC tutorials and documentation for specific examples.
RMI (Remote Method Invocation):
- A mechanism for distributed object-oriented programming.
- Allows objects to invoke methods on remote objects.
RMI Architecture:
- Client: Invokes methods on remote objects.
- Stub: Local proxy that represents the remote object.
- Skeleton: Server-side component that handles method calls.
- Registry: Stores the mapping between object names and remote references.
Explain Stub and Skeleton:
- Stub: A local object that acts as a proxy for the remote object.
- Skeleton: A server-side object that receives method calls from the stub and forwards them to the actual remote object.
Usage of RMI:
- Building distributed applications that require communication between different machines.
- Creating remote services that can be accessed by other applications.
Servlet:
- A Java class that extends the HttpServlet class.
- Handles HTTP requests and generates HTTP responses.
Ways to Create Servlet:
- Extending the HttpServlet class.
- Implementing the Servlet interface.
Servlet Life Cycle:
- init(): Called when the servlet is first loaded.
- service(): Called for each HTTP request.
- destroy(): Called when the servlet is unloaded.
Servlet config Vs Servlet Context:
- ServletConfig: Provides configuration information for a specific servlet.
- ServletContext: Provides information about the entire web application.
Explain HttpRequest and HttpResponse:
- HttpRequest: Represents an HTTP request.
- HttpResponse: Represents an HTTP response.
Explain any 5 Request header attributes:
- User-Agent, Referer, Cookie, Content-Type, Accept.
Usage setContentType() method:
- Sets the content type of the HTTP response.
Explain Session Managements Techniques:
- Session tracking: Maintaining state across multiple requests.
- Techniques: HTTP sessions, cookies, URL rewriting.
Session with example (start and expire session with methods):
- Refer to Servlet API documentation for examples.
Cookies with example (try to add variables and objects):
- Cookies can only store strings.
- Use object serialization to store objects in cookies.
Explain Request Dispatcher with Include and Forward method:
- RequestDispatcher: Used to forward requests to other resources.
- include(): Includes the content of another resource.
- forward(): Forwards the request to another resource.
JSP (Java Server Pages):
- A technology for creating dynamic web pages.
- Combines HTML, JSP elements, and Java code.
Servlet Vs JSP:
- Servlets are Java classes, while JSPs are text-based files.
- Servlets are better for complex logic, while JSPs are better for simple dynamic content.
JSP implicit objects:
- Objects automatically available in JSP pages.
- Examples: request, response, session, application, out, config, pageContext.
JSP Elements:
- Directives: Control the processing of the JSP page.
- Scriptlets: Java code embedded in the JSP page.
- Expressions: Evaluate Java expressions and insert the result into the output.
Scope of JSP variables:
- Page: Within the current JSP page.
- Request: Within the current HTTP request.
- Session: Within the current HTTP session.
- Application: Within the entire web application.
Develop a JSP code to display oracle table data in a tabular format:
- Refer to JSP tutorials and JDBC examples for specific code.
Java Beans:
- Reusable Java components that encapsulate data and behavior.
- Follow specific conventions for properties, methods, and constructors.
Usage of Java Beans:
- Building modular and reusable components.
- Integrating with other technologies like JSP and EJB.
Set Property vs Get Property:
- Set Property: Sets the value of a property.
- Get Property: Gets the value of a property.
Types of Properties in Bean:
- Simple properties: Primitive types or simple objects.
- Indexed properties: Arrays or collections.
- Mapped properties: Maps.
MVC (Model View Controller):
- A design pattern for separating concerns in web applications.
- Model: Represents the data and business logic.
- View: Represents the user interface.
- Controller: Handles requests and coordinates the interaction between the model and view.
MVC types:
- Classic MVC: Strict separation of concerns.
- Page-based MVC: Model and view are combined in a single JSP page.
- Struts MVC: Uses a framework to implement MVC.
EJB (Enterprise Java Beans):
- A component-based framework for building enterprise applications.
- Provides services like transaction management, security, and persistence.
Explain EJB with its Benefits:
- Benefits: Simplified development, scalability, security, and transaction management.
Write a note on types of EJB:
- Session beans: Stateless or stateful.
- Message-driven beans: Receive and process messages.
- Entity beans: Represent persistent data.
Explain Timer Service:
- Allows EJBs to schedule tasks to be executed at specific times or intervals.
State full vs Stateless beans:
- Stateful beans: Maintain state across multiple method calls.
- Stateless beans: Do not maintain state.
Hibernate Framework:
- An ORM framework that maps Java objects to relational databases.
- Simplifies database interactions and provides features like lazy loading and caching.
Need of Hibernate:
- Reduces boilerplate code for database operations.
- Improves database performance.
- Provides object-relational mapping capabilities.
Feature of Hibernate:
- Object-relational mapping.
- Query language (HQL).
- Caching.
- Lazy loading.
- Transactions.
Jar files of Hibernate:
- hibernate-core.jar, hibernate-entitymanager.jar, hibernate-validator.jar, etc.
Hibernate Configuration and Mapping file:
- Configuration file: Specifies database connection details and other settings.
- Mapping file: Maps Java classes to database tables.
Hibernate Inheritance:
- Supports different inheritance strategies like single table, joined table, and table per subclass.
Hibernate Annotations:
- Alternative to XML mapping files.
- Annotate Java classes to define mappings.
Hibernate Sessions:
- Represent a unit of work with the database.
- Used for transactions, queries, and object persistence.
Spring Framework:
- A comprehensive framework for building enterprise applications.
- Provides features like dependency injection, AOP, transaction management, and web development.
Spring Architecture:
- Core container: Provides the foundation for the framework.
- Data access and integration: Simplifies database interactions.
- Web development: Supports web applications.
- AOP: Enables cross-cutting concerns.
Components of Spring:
- Core, context, beans, AOP, ORM, web, etc.
Advantage of Spring Framework:
- Simplifies development, promotes loose coupling, and provides a comprehensive set of features.
Dependency Injection (IoC) with example:
- A technique where the framework injects dependencies into components.
AOP vs OOP:
- AOP: Aspect-Oriented Programming, focuses on cross-cutting concerns.
- OOP: Object-Oriented Programming, focuses on objects and their interactions.
Write a note on AOP:
- A programming paradigm that allows you to modularize concerns that affect multiple parts of an application.
- Uses aspects to encapsulate cross-cutting concerns like logging, security, and transaction management.
Explain Application with Spring:
- A Spring application typically consists of:
- Configuration files (XML or annotations)
- Java classes (beans)
- Dependency injection mechanism
Struts Framework:
- A web application framework that follows the MVC pattern.
- Provides components for handling requests, responses, and views.
Struts Features:
- Action classes, tiles, validators, interceptors, etc.
Advantages & Dis Advantages of Struts:
- Advantages: Simplified development, MVC architecture, and large community.
- Disadvantages: Can be complex for small projects, tight coupling between components.
Basic Components of Struts:
- ActionServlet: The central servlet that dispatches requests.
- Action classes: Handle requests and return results.
- JSP pages: Represent the views.
- Struts configuration file (struts-config.xml): Defines the mapping between requests and actions.
MVC 1 vs MVC 2:
- MVC 1: Model and view are tightly coupled.
- MVC 2: Clear separation of concerns between model, view, and controller.
Viva question
What is J2ee?
- A Java-based platform for building enterprise applications.
What is JDBC?
- An API for connecting Java applications to databases.
What is ODBC?
- Open Database Connectivity, a standard API for accessing databases.
What JDBC driver?
- A software component that provides the interface between a Java application and a database.
What is Servlet?
- A Java class that handles HTTP requests and generates HTTP responses.
What is JSP?
- A technology for creating dynamic web pages.
What is hibernate?
- An ORM framework for mapping Java objects to relational databases.
What is EJB?
- A component-based framework for building enterprise applications.
What is POJO?
- Plain Old Java Object, a simple Java object without any special annotations or interfaces.
What is Spring?
- A comprehensive framework for building enterprise applications.
What is Struts?
- A web application framework that follows the MVC pattern.
What is HttpRequest?
- Represents an HTTP request.
What is HttpResponse?
- Represents an HTTP response.
What is Deployment Descriptor?
- An XML file that contains configuration information for a web application.
Servlet vs JSP
- Servlets are Java classes, while JSPs are text-based files.
- Servlets are better for complex logic, while JSPs are better for simple dynamic content.
What is Session?
- A mechanism for maintaining state across multiple requests.
What is Cookie?
- A small piece of data stored on the client’s machine.