Font size
WorksheetsContent Section
Total questions: 99
Worksheet time: 50mins
Which file is the default configuration?
application.properties (or .yml)
config.xml
web.xml
main.java
YAML format relies on…
Indentation/Spacing
Semicolons ;
Braces {}
Tags <>
@PropertySource is used to…
Define variable
Read XML
Load custom .properties file
Load YAML
@Transactional on private method?
Works if reflected
Works fine
Ignored (Proxies need public accessibility)
Throws Exception
Checked Exceptions trigger rollback by default?
Always
No
Maybe
Yes
DTO pattern helps to…
Slow down mapping
Add complexity
Connect to DB
Decouple API contract from Internal Domain Model
Default rollback behavior of @Transactional?
Rollback on Checked Exception
No rollback
Rollback on Exception
Rollback on RuntimeException only
How to rollback on Checked Exception?
rollback=true
rollbackFor = Exception.class
catch exception
throw new RuntimeException
Propagation.REQUIRED means?
Create new transaction always
Throw error if no transaction
Run without transaction
Join existing or create new
Propagation.REQUIRES_NEW means?
Start a new transaction and suspend any existing one
Join an existing transaction if present
Run without any transaction, never create one
Use the outer transaction and nest operations inside it
Self-invocation of @Transactional method?
Transaction ignored (Bypasses proxy)
Rolls back
Starts new transaction
Starts transaction
Service methods should be…
Depending on HttpServletRequest
Depending on UI
Stateless
Stateful
The Service Layer is responsible for…
Rendering HTML
Handling HTTP requests
Business Logic & Transaction boundaries
Saving to DB directly
Using MapStruct or ModelMapper avoids…
Boilerplate manual mapping code
Errors
Compilation
Writing code
What is ACID?
Database brand
Atomicity, Consistency, Isolation, Durability
A drug
Async, Code, Inversion, Data
What is Idempotency?
Operation is fast
Operation runs once
Multiple identical requests same effect
Operation fails twice
What is Isolation Level?
Thread isolation
Degree transaction sees changes from another
Server isolation
Network isolation
What is a Dirty Read?
Reading uncommitted changes from another transaction
Reading old data
Reading corrupt file
Reading null
What is a Fat Controller (Bad Practice)?
Controller containing Business Logic
Controller with too many dependencies
Controller with large fonts
Large file size
Where should mapping (Entity <-> DTO) happen?
Inside Controller
Inside Service or dedicated Mapper
Inside Database
Inside View
@RequestBody does what?
Deserializes HTTP request body to Java object
Returns body
Serializes object
Validates body
@ResponseBody does what?
Parses XML
Serializes Java object to JSON in HTTP response
Deletes body
Reads body
Annotation for URL path variable (/users/{id})?
@PathVariable
@Path
@RequestParam
@QueryParam
Annotation for query params (?q=search)?
@Path
@Query
@RequestParam
@Body
Best practice for REST API versioning?
No versioning
Change database
URL path (/api/v1/...) or header
Change domain
Default JSON library in Spring Boot?
Jackson
Gson
JsonB
Moshi
Global exception handling in REST?
System.exit
Try-catch in controller
@ControllerAdvice + @ExceptionHandler
web.xml logic
HTTP 500 means?
Banned
Not Found
Internal Server Error
Client Error
HTTP status 201 means?
OK
Created
Accepted
No Content
HTTP 401 vs 403?
401 Unauthorized, 403 Forbidden
401 Forbidden, 403 NotFound
401 Server Error
Same
How to ignore a field in JSON with Jackson?
@JsonIgnore
@Transient
@Ignore
@Expose
ResponseEntity allows you to…
Log errors
Customize Status Code, Headers, and Body
Send email
Connect DB
What does REST stand for?
Renewable Energy System
Real State Transfer
Representational State Transfer
Remote Execution Standard
What is HATEOAS?
HTML format
A protocol
A header
Hypermedia as Engine of Application State
Which HTTP method is IDEMPOTENT?
None
POST
PATCH
PUT (and GET, DELETE)
Can Thymeleaf generate non-HTML (e.g. XML, Text)?
No
Only PDF
Only CSS
Yes
Difference between Thymeleaf and React?
Thymeleaf faster
None
React is Java
Thymeleaf SSR, React CSR
Escaping HTML by default causes?
Slow rendering
Security against XSS
Errors
XSS vulnerability
Expression *{...} is for?
Variables
URLs
Selection on selected object (th:object)
Messages
How to include a fragment?
th:insert / th:replace
th:get
th:add
th:import
How to pass data from Controller to View?
Session only
Static variables
Magic
Using Model addAttribute()
Is Thymeleaf compiled?
Yes, cached
No, interpreted
No, parsed runtime
Yes, like JSP
Key attribute for conditional logic?
th:if / th:unless
th:show
th:check
th:when
Key attribute for iteration?
th:each
th:while
th:loop
th:for
Layout Dialect helps with?
Database
Sorting
Colors
Creating master page layouts
Natural Templating means?
HTML looks correct in browser without server
It writes itself
Compiles to C++
Uses nature photos
Syntax for URL (Link) expression?
@{...}
${...}
*{...}
...
Syntax for variable expression?
${...}
#{...}
*{...}
@{...}
Thymeleaf is a…
JSP replacement
Database
JavaScript framework
Java Template Engine (Server Side)
Where are templates stored by default in Spring Boot?
src/main/resources/templates
src/html
src/public
src/main/webapp
@PreAuthorize allows?
Logging
Method-level security expressions (SpEL)
Transaction management
Post processing
Best place to store passwords?
Encrypted (Reversible)
Plain text
Base64
Hashed (BCrypt/Argon2)
CORS stands for?
Cross-Origin Remote Service
Cross-Origin Resource Sharing
Core Operating Risk System
Cascading Origin Style
CSRF stands for?
Cross-Site Request Forgery
Common Security Risk Factor
Cascading Style Reference File
Central Server Request Filter
Core concept of Spring Security?
Aspect
Filter Chain
Controller
Interceptor
Default login form comes from?
Thymeleaf
Cannot have login form
Auto-generated by Spring Security
Windows
Difference between hasRole and hasAuthority?
Role is deprecated
Role adds 'ROLE_' prefix automatically
Authority adds prefix
No difference
How many filter chains can you have?
Multiple, matched by URL pattern
Exactly 2
Only 1
None
How to load users from DB?
Implement UserDetailsService
Use JDBC directly
Hardcode in xml
Use InMemoryUserDetailsManager
JWT (JSON Web Token) is?
Stateful session
Stateless, self-contained token for auth
Database key
Encrypted cookie
SecurityContextHolder stores?
Passwords
Database config
Authentication of the current thread
Cookies
What interface represents the User?
User
Account
UserDetails
Principal
What is OncePerRequestFilter?
Filter that runs twice
Standard Servlet Filter
Base class ensuring execution once per dispatch
Interceptor
What manages Authentication?
SecurityContext
AccessDecisionManager
UserDetails
AuthenticationManager
Why disable CSRF for REST APIs?
Because REST APIs are stateless/non-browser based usually
Because Browsers handle it
To be faster
Never disable it
@Email validates what?
String structure (Regex)
Email existence
Spam check
DNS record
@NotEmpty vs @NotBlank?
Same
NotBlank checks for spaces only
NotEmpty checks size>0, NotBlank checks trimmed length>0
NotEmpty is Collection only
@Pattern uses?
SQL
Java code
Glob
Regular Expression (Regex)
@Size is for?
Integers only
Strings, Collections, Arrays
Objects
Files
Annotation to check for null?
@CheckNull
@NotNull
@Null
@Exists
Can validation messages be internationalized?
Only in English
Yes, usually via ValidationMessages.properties
Yes but hard
No
Can you validate Service method parameters?
Yes, using @Validated on class
No
Yes, manually
No, only Controllers
Custom validation requires extending?
ValidatorBase
ValidationManager
CustomChecker
ConstraintValidator
Standard for Validation in Java?
JUnit
Bean Validation (JSR-380/Hibernate Validator)
Log4j
Spring Validator
Validating recursive objects (nested DTOs)?
Use @DeepValid
Not possible
Add @Valid to the field
Automatic
Validation groups are for?
Grouping errors
Performance
Grouping users
Applying partial validation (e.g., Create vs Update)
What does @AssertTrue do?
Checks if String is 'true'
Asserts in test
Nothing
Checks if boolean field/method returns true
What object captures validation errors in Controller?
Model
ErrorList
Exception
BindingResult
Where to put @Valid in Controller?
Inside the DTO
On Return type
On Method
Before the @RequestBody parameter
API Documentation tool?
Javadoc
Swagger / OpenAPI
Word
Excel
CI/CD stands for?
Code Integration / Code Deployment
Compile Immediately / Compile Daily
Computer Interface / Computer Design
Continuous Integration / Continuous Deployment
Containerization tool?
VMware
VirtualBox
Zip
Docker
DTO vs Entity separation avoids?
Over-exposing DB structure and LazyInitializationExceptions
Good design
Security
Performance
Database migrations tool?
Flyway or Liquibase
Manual SQL
Hibernate HBM2DDL only
Backup/Restore
Deploying Spring Boot app?
Run the executable JAR (java -jar app.jar)
Copy source code
Environment specific config is done via?
Different JARs
Profiles
Hardcoding
Magic
Frontend communicates with Backend via?
HTTP/REST APIs
Direct memory
Telepathy
Shared files
Input checking should happen?
Database only
Nowhere
Both Frontend (UX) and Backend (Security)
Frontend only
Integration Testing uses?
Unit tests
Manual testing
MockMvc only
@SpringBootTest (Loads full context)
Logging framework in Spring Boot default?
Log4j 1
Logback (via SLF4J)
System.out
Java Util Logging
Monitoring Spring Boot app?
Ping
Task Manager
Spring Boot Actuator
Print statements
Pattern Matching for switch (Java 17+) allows?
Only enums
Switching on types using guarded patterns
Switching databases
Regex in switch
Reverse Proxy example?
Spring
Tomcat
Nginx
MySQL
Stateless vs Stateful backend?
Stateless scales better (horizontal scaling)
Stateless uses sessions
No difference
Stateful scales better
Typical Spring Boot Layering?
View -> DB
Service -> View -> Controller
Controller -> Service -> Repository -> Database
Controller -> Repository
What is a 'sealed' class (Java 15+)?
Class in a JAR
Encrypted class
Class that restricts which other classes may extend it
Class with no methods
Key feature of Java 19/21 Virtual Threads (Project Loom)?
Faster UI
Lightweight, high-throughput concurrency
Better graphics
New syntax
New HttpClient (Java 11) feature?
Deprecated
Only callback based
Asynchronous and support for HTTP/2
Uses XML
Which Garbage Collector is designed for sub-millisecond pauses (Java 15+)?
Serial
ZGC (Z Garbage Collector)
G1
Parallel
