QuestionBank 1to6

Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

Assignment 1 : Foundation of Enterprise Programming

1) What is JDBC?

2) Explain JDBC Architecture

3) Explain JDBC Components

4) How to configure Eclipse to use MySQL database

5) What is XML and Where it will use?

6) Explain Build Automation Tool and its Types

7) What is Maven & POM.xml file, write example of POM file to use MySQL Connector.

8) Explain RowSet and its Types

9) What is Design Patterns, explain its Types

10) What is ERP ,explain involved key components

11) Explain execute,executeUpdate,executeQuery,executeLargeUpdate,executeBatch methods

12) What is rule need to follow to write XML

13) Differences between Statement and PreparedStatement

14) Explain Maven Lifecycle

15) What is System Requirements to install Apache Maven-3.9.8

Assignment 2 : Servlet

---------------------------------------------------------

1. What is HTTP protocol?

2. What is the architecture of HTTP protocol?

3. What is a web client and web server?

4. What is a web application?

5. Explain client-server architecture?

6. What is CGI and how does it handle requests?

7. What is a servlet?

8. What is a deployment descriptor?

9. How do you create a dynamic web project?


10. How do you modify the web descriptor file?

11. What is the use of an Apache Tomcat server?

12. How do you add a project to a web server and run the first servlet?

13. What is the servlet lifecycle?

14. What are servlet lifecycle event methods?

15. What are other ways to create a servlet application?

16. What is the servlet API?

17. What are the packages of the servlet API?

18. Explain the jakarta.servlet classes, interfaces, and exceptions.

19. What is ServletConfig and its use in an application?

20. Explain servlet context and its use in a web application.

21. What is Cookies?

22. What is Session?

23. How many number of ways there to track user?

24. What is requestDispatcher?

25. In tomcat, what is catalina_home and why we use it?

Assignment 3 : JSP

-----------------------------------------------------------------------

1) Explain the architecture of JSP) How does it compare to servlets in terms of request handling?

2) Describe the role of JSP in a web application and how it interacts with other components such as
servlets and databases.

3) Illustrate the lifecycle of a JSP page with a detailed explanation of each phase.

4) What are the different methods involved in the lifecycle of a JSP page? Explain each method with its
purpose.

5) What are directive tags in JSP? List and explain the three main types of directive tags.

6) How does the `<%@ page %>` directive influence the behavior of a JSP page? Provide examples.

7) What is a scriptlet in JSP? How is it different from an expression? Provide an example of each.

8) Discuss the scope of variables declared inside a scriptlet. How does it affect the JSP page?
9) Explain the purpose of expressions in JSP) How are they evaluated and outputted on the client side?

10) Write a JSP page using expressions to calculate and display the sum of two numbers.

11) What is a declarative tag in JSP? How is it used to define methods and variables? Provide an example.

12) Discuss the scope and lifecycle of methods and variables defined using declarative tags in JSP.

13) List and explain the various implicit objects available in JSP) How do they facilitate web
development?

14) Write a JSP page demonstrating the use of at least three different implicit objects.

15) What are action tags in JSP? Describe their purpose and usage with examples.

16) Explain the `<jsp:include>` and `<jsp:forward>` action tags. How do they differ in functionality?

17) What is JSTL? How does it simplify JSP development?

18) Provide examples of using JSTL core tags for iteration and conditional operations

19) What is Expression Language (EL) in JSP? How does it enhance the readability and maintainability of
JSP pages?

20) Write a JSP page that demonstrates the use of EL to access and display data from request and session
attributes

Assignment UNIT – 4 ( Hibernate )


Q1 : What is hibernate ? List out the advantages of Hibernate.

Q2 : Difference between Hibernate and EJB.

Q 3 : Explain the Hibernate architecture in details ( Explain all persistence objects. )

Q4 : Consider the below class, DataMembers and create a hibernate mapping file.

Class Name : Employee

Data Members: EmpID, EmpName, Designation, DateOfBirth, Deptno….

Q5 : What is a collection ? Explain set and list collection with an example.

Q6 : What is association ( Relationship ) ? Explain types of associations (One-to_One, One-to-Many,

Many-to-Many, and Many-to_one) in detail.

Q7 : Consider the below class, DataMembers and implement java based configuration.

Class Name : Customer

Data Members: CustomerID, Custfullname, custaddress, custcity, custmobile, custstate, custemail,

custmobile etc.
Q8 : What is HQL ? Explain the usage of HQL in hibernate.

Q9 : Explain the below methods

createQuery(), executeUpdate(), setParameter()

Q10 : Write a code to implement one-to-one relation.

Assignment Unit – 5 ( Spring )


Q1 : What is the difference between BeanFactory and ApplicationContext ? Give an example how to

implement Bean factory in spring.

Q2 : What is Spring Framework ? Explain different modules of Spring framework ?

Q3 : What is autowire ? Explain types of autowire.

Q4 : Explain @Component, @Bean with an example.

Q5 : What is Spring MVC ? Advantages of Spring MVC

Q6 : What is Inversion of Control (IoC) in the context of the Spring Framework, and howdoes it

facilitate loose coupling?

Q7 : What is Spring IOC Container? Explain the role of IoC container in spring application.

Question Bank
Spring Core

1. What is Spring Framework?

Spring is a comprehensive framework for Java-based enterprise applications, providing support for
dependency injection, aspect-oriented programming, transaction management, and more.

2. What is Dependency Injection (DI) in Spring?

DI is a design pattern that allows the inversion of control, where the framework handles object creation
and dependencies.

3. What are the two types of DI in Spring?


Constructor-based and setter-based dependency injection.

4. What is Inversion of Control (IoC)?

IoC is a principle where the control of object creation and management is transferred from the
application code to the Spring framework.

5. What is a Spring Bean?

A Spring Bean is an object managed by the Spring IoC container.

6. What is the default scope of a Spring Bean?

Singleton.

7. How do you define a Spring Bean in XML configuration?

By using the <bean> tag with id and class attributes.

8. What is @Component in Spring?

@Component is an annotation to indicate that a class is a Spring-managed bean.

9. What does @Autowired do?

@Autowired automatically injects dependencies into a bean.

10. What is the difference between @Component and @Bean?


@Component is used for auto-detection and auto-wiring, while @Bean is used in Java configuration for
explicit bean declaration.

11. What is the role of ApplicationContext in Spring?

ApplicationContext is the Spring IoC container that manages beans and their dependencies.

12. What is @Configuration in Spring?

@Configuration indicates that a class contains bean definitions for the Spring IoC container.

13. How do you enable component scanning in Spring?

By using @ComponentScan annotation.

14. What is @Scope used for?

@Scope defines the scope of a Spring bean (e.g., singleton, prototype).

15. What is the prototype scope in Spring?

In prototype scope, a new bean instance is created each time it is requested.

16. What is Aspect-Oriented Programming (AOP)?

AOP is a programming paradigm that allows separation of cross-cutting concerns (e.g., logging,
transactions).
17. What is a JoinPoint in AOP?

A JoinPoint is a point in the program execution, such as a method execution or object creation.

18. What is a PointCut in AOP?

A PointCut is an expression that matches JoinPoints to apply advice.

19. What is advice in Spring AOP?

Advice is the action taken at a JoinPoint, such as before, after, or around a method execution.

20. What is the purpose of @Transactional in Spring?

@Transactional is used to manage transactions declaratively.

21. What is Spring's BeanPostProcessor?

BeanPostProcessor is an interface that allows custom logic before and after Spring bean initialization.

22. What is @Qualifier used for?

@Qualifier is used to resolve ambiguity when multiple beans of the same type exist.

23. What is Spring's FactoryBean?

FactoryBean is a special bean that allows customization of bean creation logic.

24. What is the difference between ApplicationContext and BeanFactory?


ApplicationContext is a more advanced container that supports additional features like event
propagation and internationalization, while BeanFactory is a simpler, more basic container.

25. What is Spring's Proxy pattern used for?

It is used in AOP to apply advice to a target method execution.

Spring Boot

26. What is Spring Boot?

Spring Boot simplifies Spring application development by providing defaults and auto-configuration.

27. What is the purpose of @SpringBootApplication?

@SpringBootApplication is a combination of @Configuration, @EnableAutoConfiguration, and


@ComponentScan.

28. What is auto-configuration in Spring Boot?

Auto-configuration automatically configures Spring beans based on the classpath and other settings.

29. What is the default embedded server in Spring Boot?

Tomcat.

30. How can you change the embedded server in Spring Boot?
By excluding the Tomcat dependency and adding a different server, like Jetty or Undertow.

31. What is Spring Boot Starter?

A starter is a set of dependencies to include commonly used libraries (e.g., spring-boot-starter-web for
web applications).

32. What is application.properties used for?

It is used for externalized configuration in Spring Boot.

33. What is @RestController in Spring Boot?

@RestController is a specialized @Controller that automatically returns JSON/XML responses.

34. How do you run a Spring Boot application?

By using the main method with SpringApplication.run().

35. What is Actuator in Spring Boot?

Actuator provides production-ready features like monitoring and management of a Spring Boot
application.

36. How do you enable Spring Boot Actuator?

By adding the spring-boot-starter-actuator dependency.


37. What is the default port for Spring Boot application?

Port 8080.

38. How can you change the default port in Spring Boot?

By setting server.port in application.properties.

39. What is @Value in Spring Boot?

@Value is used to inject values from properties files into Spring beans.

40. What is @Profile used for in Spring Boot?

@Profile is used to configure beans or properties based on the environment.

41. What is the purpose of CommandLineRunner in Spring Boot?

CommandLineRunner is used to execute code after the application startup.

42. How can you handle exceptions in Spring Boot?

By using @ControllerAdvice or @ExceptionHandler.

43. What is spring-boot-devtools?

spring-boot-devtools provides features for developer productivity, like automatic restarts and live
reloads.
44. What is Spring Boot's JPA starter?

It is a starter for configuring Spring Data JPA with Hibernate as the default ORM.

45. How do you enable scheduling in Spring Boot?

By adding the @EnableScheduling annotation and @Scheduled methods.

46. How do you create a custom banner in Spring Boot?

By placing a banner.txt file in the resources directory.

47. What is a Spring Boot starter parent?

The parent provides common configurations and dependency management for Spring Boot applications.

48. How do you enable SSL in Spring Boot?

By configuring SSL properties in application.properties and providing keystore details.

49. What is Spring Boot's initializer (start.spring.io)?

It is an online tool to generate Spring Boot project structure.

50. What is @EnableAutoConfiguration?

It enables Spring Boot’s auto-configuration feature to configure Spring beans automatically based on
classpath contents.
Q.1 Objective Type Questions - (State, Define, List, etc)
1. State the directive used to import classes, interfaces, or packages in a JSP page.

2. Define the default embedded server in Spring Boot.


3. List the tag used to map a URL pattern to a servlet in the web.xml file.

Q.2 Answer the following questions.


A) Explain hibernate DTD Schema (DTD) and its importance in hibernate.cfg.xml
documents.

B) Explain the Spring IoC Container and its role in Spring applications (6)

Q.3 Answer the following questions.


A) What is Seevlet container ? What tasks does a servlet container perform usually?

B) Explain the mapping strategies used in Hibernate.

Q.4 Answer the following questions.


A) What is session tracking ? Explain the various techniques with an example

B) What are Spring's Stereotype Annotations, and how do they help in component
scanning?
Q.5 Answer the following questions.
A) What are the JSP lifecycle phases?
B) What is RowSet interface and explain its types?

Q.6 Objective Type Questions - (State, Define, List, etc)


1.State the first method called when a servlet is initialized.
2. Define the role of SessionFactory in Hibernate.
3. List the packages that form the basis for Spring Framework’s IoC container

Q.7 Answer the following questions.


A) Compare Hibernate Query Language (HQL) and SQL.
B) How can you define beans using annotation-based configuration in your application's
component classes in Spring?
Q.8 Answer the following questions.
A) What is Dependency Injection in Spring, and how does it differ from traditional object
creation?
B) Describe Hibernate project structure (6)
Q.9 Answer the following questions.
A) Explain Hibernate Criteria Query Language (HCQL).
B) What are primary goals of spring boot framework
Q.10 Answer the following questions.
A) What are Spring Beans, and how are they managed by the Spring IoC Container?

B) What is Hibernate and how does it simplify database interactions in Java applications?

Q.1 Objective Type Questions - (State, Define, List, etc)


1. State the name of the markup language used to encode documents in a format that is
both human-readable and machine-readable
2. Define the purpose of the @GeneratedValue annotation in Hibernate.

3. List the annotation used in Spring Boot to inject dependencies automatically.


Q.2 Answer the following questions.
A) Explain the typical structure of a Maven project. What are the key files and directories
in a Maven project?

B) Explain the role of JPA (Java Persistence API) in Hibernate.


Q.3 Answer the following questions.
C) What is the role of the @Component, @Service, @Repository, and @Controller
annotations in Spring? How do they differ from one another
D) Describe the purpose of @RestController in Spring Boot. How is it different from
@Controller, and what role does it play in building RESTful services?
Q.4 Answer the following questions.
A) What is the difference between sendRedirect() and Forward() in a Servlet?

B) What is the purpose of the page directive in a JSP page?


Q.5 Answer the following questions.
A) Explain the Maven build lifecycle phases and their sequence. How can you customize
build lifecycle in Maven?

B) Explain how Spring Boot manages external configuration. What are the different ways
to provide configuration to a Spring Boot application?

Q.6 Objective Type Questions - (State, Define, List, etc)

1.State the main purpose of the @SpringBootApplication annotation in Spring Boot.

2. Define what JSP pages are compiled into.


3. List what the @Table annotation specifies in an entity class.
Q.7 Answer the following questions.
A) Explain the concept of Dependency Injection (DI) in Spring Framework. How does it
differ from traditional programming approaches?
B) What are Hibernate Annotations and how are they used?
Q.8 Answer the following questions.
A) What are PreparedStatement objects in JDBC? How are they different from Statement
objects?
B) What is the difference between Spring Boot and the traditional Spring Framework?

Q.9 Answer the following questions.


A) How does Spring Boot simplify the development process?
B) Differentiate between JSP and servlet.
Q.10 Answer the following questions.
A) What is the ServletConfig object? Explain with an example
B) Differences between ServletConfig and ServletContext

You might also like