Proxy Pattern — Concept Check
Questions on Proxy Pattern. Provides a surrogate or placeholder for another object to control access, add caching, logging, or lazy initialization.
Questions in this quiz
8 questions on Proxy Pattern — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.A developer implements a proxy to control access to an image loading service. They notice that images are fetched from the network even when requested multiple times with the same ID. What might be missing in the proxy?
- ACaching mechanism
- BPermission check
- CLazy initialization
- DNetwork optimization
2.An application uses a Virtual Proxy to load images. The first access to an image is slow, but subsequent accesses are fast. Why is this behavior observed?
- AThe proxy preloads all images
- BThe proxy uses a faster network
- CThe proxy defers object creation until needed
- DThe proxy compresses images
3.A team uses a Protection Proxy for an image service. However, unauthorized users can still access images. What might be the issue?
- ASlow network connection
- BLack of caching
- CIncorrect image IDs
- DImproper permission checks
4.In a system using Spring AOP, a method annotated with @Transactional is called from within the same bean. What is the likely outcome?
- AA new transaction is started
- BThe method runs twice
- CThe method fails
- DNo new transaction is started
5.A developer uses a Cache Proxy but notices that cache misses occur frequently, leading to slow responses. What could be a reason?
- ACache keys are not unique
- BData is too small
- CNetwork is too fast
- DCache is too large
6.What is the main purpose of a Cache Proxy in a software system?
- ATo defer object creation
- BTo compress data
- CTo check user permissions
- DTo store results of expensive operations
7.A developer implements a SecureImageLoader using a Protection Proxy. They assume it will also cache images. What is the flaw in this assumption?
- AProtection Proxy preloads images
- BProtection Proxy does not handle caching
- CProtection Proxy speeds up network
- DProtection Proxy compresses images
8.In a system with a Virtual Proxy, what happens when an object is accessed for the first time?
- AThe object is compressed
- BThe object is created at that moment
- CThe object is cached
- DThe object is preloaded