Java Bean Scopes
Which of the following is a valid scope for a bean in the Spring framework?
- singleton
- multipletone
- singelton
- static
- unique
Microservices vs. Monolithic
When is it generally preferable to use a microservices architecture over a monolithic architecture?
- When your application needs high scalability and independent deployments
- When you have only a single, simple process
- When there is no need for network communication
- When all features must share the same memory space
- When database access is not required
Microservice Development Considerations
Which of the following is important to consider when developing a microservice-based application?
- Service discovery
- Client-facing only interfaces
- Ignoring error handling
- Single data storage for all services
- No need for monitoring
Managing Multiple Service Instances
How can you handle multiple instances of the same service in a distributed Java application?
- Using load balancing
- Only calling the first instance found
- Directly accessing by IP address
- Hard coding all endpoints
- Manual round robbin
Parallel Service Calls in Java
What approach can be used to make parallel service calls in Java?
- Using ExecutorService
- Writing nested for loops
- Calling services sequentialy
- Using synchronized keyword only
- Using SingleThreadPool
Java Parallel Streams Usage
When should you consider using parallel streams in Java?
- When processing large collections that can be split into independent tasks
- When working with single items
- When you need to keep order guaranteed
- When you want exact exception handling order
- When you want everything to run on the main thread
Collections in Java
Which of the following is a valid Java collections class?
- HashMap
- HashTablez
- TreeMep
- ArryList
- ArrayyQueue
Objects as Map Keys
If you want to use a custom object as a key in a Java HashMap, which methods should you implement or override?
- equals() and hashCode()
- toString() only
- compareTo() and clone()
- hashKey() and equals()
- finalize() and hashValue()
Java Optional Benefits
What is one primary benefit of using the Optional class in Java?
- To avoid NullPointerException
- To improve array sorting
- To reduce memory consumption always
- To automatically create new threads
- To speed up file I/O
Securing APIs
Which of the following is a commonly used method to secure APIs in Java applications?
- Authentication and authorization
- Only using public endpoints
- Turning off logging
- Allowing all traffic by default
- Ignoring encryption