wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Untitled Quiz

Total questions: 48

Worksheet time: 24mins

Name
Class
Date
1.

Why prefer Composition?

a)

Loose coupling and flexibility

b)

Looks better

c)

Faster

d)

Legacy

2.

Consumer returns?

a)

T

b)

void

c)

Object

d)

boolean

3.

Default thread pool for Parallel Streams?

a)

CachedThreadPool

b)

SingleThreadExecutor

c)

Common ForkJoinPool

d)

FixedThreadPool

4.

Parallel Stream on small lists?

a)

Usually slower due to overhead

b)

Always faster

c)

Same

d)

Instant

5.

Function returns?

a)

void

b)

T

c)

boolean

d)

R

6.

Is Stream reusable?

a)

Yes if parallel

b)

Yes always

c)

No, it closes after terminal operation

d)

Yes using reset()

7.

Method Reference syntax?

a)

Class.method

b)

Class->method

c)

Class::method

d)

Class=>method

8.

Optional is intended to...?

a)

Represent possibly missing value (avoid null)

b)

Optimize loops

c)

Create NPE

d)

Replace null everywhere

9.

Predicate returns?

a)

int

b)

void

c)

boolean

d)

String

10.

Streams programming style?

a)

Declarative (What, not How)

b)

Assembly

c)

Imperative

d)

Procedural

11.

What does flatMap() do?

a)

Flattens map

b)

Maps to int

c)

Maps to null

d)

Flattens nested structures

12.

Short-circuiting in Streams?

a)

Stops once result is determined

b)

Infinite loop

c)

Crash

d)

Skip errors

13.

When is Stream processed?

a)

Lazily, at terminal operation

b)

On map()

c)

Immediately

d)

Background thread

14.

Terminal operation?

a)

collect()

b)

map()

c)

peek()

d)

distinct()

15.

filter() is what type?

a)

Source

b)

Intermediate

c)

Terminal

d)

Final

16.

map() is used to...?

a)

Filter

b)

Sort

c)

Transform elements (T → R)

d)

Combine

17.

peek() is mainly for?

a)

Debugging / Logging

b)

Stopping

c)

Transforming

d)

Deleting

18.

reduce() is used for?

a)

Mapping

b)

Filtering

c)

Aggregating to single value

d)

Debugging

19.

Difference Maven vs Gradle?

a)

Gradle uses XML

b)

Maven = XML, Gradle = DSL & faster

c)

Maven newer

d)

Maven procedural

20.

Gradle config language (historically)?

a)

Python

b)

Groovy

c)

XML

d)

JSON

21.

Maven Snapshot means?

a)

Archived

b)

Stable

c)

Development / unstable

d)

Final

22.

Skip tests in Maven?

a)

-DskipTests

b)

-NoTest

c)

-Skip

d)

-Fast

23.

GAV coordinates?

a)

Group-Artifact-Verified

b)

Git-Add-Version

c)

GroupId-ArtifactId-Version

d)

Gradle-And-Validation

24.

POM stands for?

a)

Project Object Model

b)

Public Object Module

c)
25.

What does mvn clean do?

a)

Virus scan

b)

Update deps

c)

Deletes target directory

d)

Format code

26.

Dependency Management?

a)

Centralizing dependency versions

b)

Writing code

c)

Database management

d)

Employee management

27.

Fat / Uber JAR?

a)

Executable JAR with all dependencies

b)

Empty JAR

c)

Folder

d)

Image file

28.

Transitive Dependency?

a)

Plugin

b)

Dependency of a dependency

c)

Local file

d)

Test dependency

29.

Maven lifecycle order?

a)

Compile → Run → Stop

b)

Deploy → Install

c)

Validate → Compile → Test → Package → Install → Deploy

d)

Test → Compile → Package

30.

Where Maven stores downloaded jars?

a)

Cloud

b)

Project folder

c)

Local repo (~/.m2/repository)

d)

C:/Windows

31.

Which command compiles the code?

a)

mvn build

b)

mvn run

c)

mvn compile

d)

mvn make

32.

Which file is the heart of a Maven project?

a)

build.gradle

b)

maven.xml

c)

settings.xml

d)

pom.xml

33.

Which scope is transitive?

a)

system

b)

test

c)

compile (default)

d)

provided

34.

Which scope means “available at compilation but provided at runtime”?

a)

runtime

b)

test

c)

compile

d)

provided

35.

mvn install copies the artifact to...?

a)

Local Repository (.m2)

b)

System32

c)

Remote Repo

d)

Target folder only

36.

Can a Singleton bean store user-specific data in fields?

a)

Yes, always

b)

Yes, if volatile

c)

No, it is shared across all users

d)

Yes, if private

37.

Best way to fix Circular Dependency?

a)

Refactor code to extract common dependency

b)

Ignore it

c)

Use Setter Injection

d)

Use @Lazy

38.

How to resolve multiple bean conflict?

a)

Use @Qualifier or @Primary

b)

Delete one

c)

Rename class

d)

@Ignore

39.

The Spring Container is also called...?

a)

Box

b)

ApplicationContext

c)

Context

d)

Bucket

40.

What annotation starts component scanning?

a)

@Components

b)

@Scan

c)

@SpringBootApplication / @ComponentScan

d)

@FindBeans

41.

What does @PostConstruct do?

a)

Runs after destruction

b)

Runs on every request

c)

Runs after constructor and dependency injection

d)

Runs before constructor

42.

What happens if Spring finds 2 beans of same type?

a)

NoUniqueBeanDefinitionException

b)

Overwrites one

c)

Picks first

d)

Picks random

43.

What is Circular Dependency?

a)

Recursion

b)

Round robin DNS

c)

Infinite loop

d)

Bean A needs Bean B, and Bean B needs Bean A

44.

What is Constructor Injection?

a)

Setter injection

b)

Using new()

c)

Passing dependencies via constructor

d)

Field injection

45.

What is Inversion of Control (IoC)?

a)

Framework calls your code (Hollywood Principle)

b)

Static factory

c)

Direct calls

d)

Thread control

46.

Benefit of interfaces in DI?

a)

More code

b)

Faster compile

c)

Loose coupling (easy swap / mock)

d)

Slower execution

47.

Default Bean Scope?

a)

Prototype

b)

Singleton

c)

Session

d)

Request

48.

Difference between @Controller and @RestController?

a)

@RestController returns the response body (e.g., JSON) by default, while @Controller returns views unless @ResponseBody is used

b)

@Controller always returns JSON, while @RestController returns HTML templates by default

c)

They are synonyms with no behavioral difference

d)

@RestController is only for WebFlux, @Controller only for MVC