NEW
Font size
WorksheetsUntitled Quiz
Total questions: 48
Worksheet time: 24mins
Why prefer Composition?
Loose coupling and flexibility
Looks better
Faster
Legacy
Consumer
T
void
Object
boolean
Default thread pool for Parallel Streams?
CachedThreadPool
SingleThreadExecutor
Common ForkJoinPool
FixedThreadPool
Parallel Stream on small lists?
Usually slower due to overhead
Always faster
Same
Instant
Function
void
T
boolean
R
Is Stream reusable?
Yes if parallel
Yes always
No, it closes after terminal operation
Yes using reset()
Method Reference syntax?
Class.method
Class->method
Class::method
Class=>method
Optional
Represent possibly missing value (avoid null)
Optimize loops
Create NPE
Replace null everywhere
Predicate
int
void
boolean
String
Streams programming style?
Declarative (What, not How)
Assembly
Imperative
Procedural
What does flatMap() do?
Flattens map
Maps to int
Maps to null
Flattens nested structures
Short-circuiting in Streams?
Stops once result is determined
Infinite loop
Crash
Skip errors
When is Stream processed?
Lazily, at terminal operation
On map()
Immediately
Background thread
Terminal operation?
collect()
map()
peek()
distinct()
filter() is what type?
Source
Intermediate
Terminal
Final
map() is used to...?
Filter
Sort
Transform elements (T → R)
Combine
peek() is mainly for?
Debugging / Logging
Stopping
Transforming
Deleting
reduce() is used for?
Mapping
Filtering
Aggregating to single value
Debugging
Difference Maven vs Gradle?
Gradle uses XML
Maven = XML, Gradle = DSL & faster
Maven newer
Maven procedural
Gradle config language (historically)?
Python
Groovy
XML
JSON
Maven Snapshot means?
Archived
Stable
Development / unstable
Final
Skip tests in Maven?
-DskipTests
-NoTest
-Skip
-Fast
GAV coordinates?
Group-Artifact-Verified
Git-Add-Version
GroupId-ArtifactId-Version
Gradle-And-Validation
POM stands for?
Project Object Model
Public Object Module
What does mvn clean do?
Virus scan
Update deps
Deletes target directory
Format code
Dependency Management?
Centralizing dependency versions
Writing code
Database management
Employee management
Fat / Uber JAR?
Executable JAR with all dependencies
Empty JAR
Folder
Image file
Transitive Dependency?
Plugin
Dependency of a dependency
Local file
Test dependency
Maven lifecycle order?
Compile → Run → Stop
Deploy → Install
Validate → Compile → Test → Package → Install → Deploy
Test → Compile → Package
Where Maven stores downloaded jars?
Cloud
Project folder
Local repo (~/.m2/repository)
C:/Windows
Which command compiles the code?
mvn build
mvn run
mvn compile
mvn make
Which file is the heart of a Maven project?
build.gradle
maven.xml
settings.xml
pom.xml
Which scope is transitive?
system
test
compile (default)
provided
Which scope means “available at compilation but provided at runtime”?
runtime
test
compile
provided
mvn install copies the artifact to...?
Local Repository (.m2)
System32
Remote Repo
Target folder only
Can a Singleton bean store user-specific data in fields?
Yes, always
Yes, if volatile
No, it is shared across all users
Yes, if private
Best way to fix Circular Dependency?
Refactor code to extract common dependency
Ignore it
Use Setter Injection
Use @Lazy
How to resolve multiple bean conflict?
Use @Qualifier or @Primary
Delete one
Rename class
@Ignore
The Spring Container is also called...?
Box
ApplicationContext
Context
Bucket
What annotation starts component scanning?
@Components
@Scan
@SpringBootApplication / @ComponentScan
@FindBeans
What does @PostConstruct do?
Runs after destruction
Runs on every request
Runs after constructor and dependency injection
Runs before constructor
What happens if Spring finds 2 beans of same type?
NoUniqueBeanDefinitionException
Overwrites one
Picks first
Picks random
What is Circular Dependency?
Recursion
Round robin DNS
Infinite loop
Bean A needs Bean B, and Bean B needs Bean A
What is Constructor Injection?
Setter injection
Using new()
Passing dependencies via constructor
Field injection
What is Inversion of Control (IoC)?
Framework calls your code (Hollywood Principle)
Static factory
Direct calls
Thread control
Benefit of interfaces in DI?
More code
Faster compile
Loose coupling (easy swap / mock)
Slower execution
Default Bean Scope?
Prototype
Singleton
Session
Request
Difference between @Controller and @RestController?
@RestController returns the response body (e.g., JSON) by default, while @Controller returns views unless @ResponseBody is used
@Controller always returns JSON, while @RestController returns HTML templates by default
They are synonyms with no behavioral difference
@RestController is only for WebFlux, @Controller only for MVC
