Practice
Solution
Step 1: Understand PATCH semantics
PATCH is used for partial updates, modifying only specified fields.Step 2: Differentiate from PUT
PUT replaces the entire resource, while PATCH updates parts.Step 3: Analyze options
The server modifies only the specified email field without affecting other user data correctly states partial modification; others describe full replacement or resource creation/deletion.Final Answer:
Option A -> Option AQuick Check:
PATCH modifies only the targeted fields without affecting the rest.
- Confusing PATCH with PUT and thinking it replaces the whole resource
- Assuming PATCH creates new resources
- Believing PATCH deletes and reinserts fields
Solution
Step 1: Understand the role of the Presentation Layer
The Presentation Layer is responsible for data translation, encryption, and compression before passing data to the Session Layer.Step 2: Why not other layers?
Application Layer handles user interface and application services, Transport Layer manages end-to-end communication and reliability, Network Layer handles routing and addressing but not encryption.Final Answer:
Option A -> Option AQuick Check:
Encryption is a Presentation Layer function [OK]
- Assuming encryption is done at the Application Layer
- Confusing Transport Layer's reliability with security
- Thinking Network Layer handles encryption
Solution
Step 1: Analyze communication direction requirements
WebSocket supports full-duplex communication, allowing simultaneous two-way data flow, unlike SSE and Long Polling which are unidirectional or half-duplex.Step 2: Consider latency and connection persistence
WebSocket maintains a persistent connection with low latency, ideal for frequent bidirectional exchanges.Step 3: Evaluate other options
When the client only needs to receive unidirectional real-time updates from the server with minimal overhead describes SSE, which is unidirectional from server to client. When the server needs to push occasional updates but the client cannot maintain persistent connections is inaccurate because SSE requires persistent connections. When the client wants to reduce server resource usage by opening a new HTTP request for each update describes naive Long Polling, which is resource-heavy.Final Answer:
Option A -> Option AQuick Check:
Full-duplex + low latency + frequent bidirectional data -> WebSocket
- Confusing SSE as bidirectional
- Assuming Long Polling is efficient for frequent updates
- Believing WebSocket is only for server-to-client updates
Solution
Step 1: Review Network Layer responsibilities
The Network Layer handles routing and forwarding but does NOT guarantee reliable delivery.Step 2: Identify which layer ensures reliability
Transport Layer provides end-to-end reliability, not Network Layer.Step 3: Validate other statements
Data Link Layer handles error detection/correction on physical links, Session Layer manages sessions, Physical Layer transmits bits.Final Answer:
Option B -> Option BQuick Check:
Network Layer does NOT guarantee reliability [OK]
- Assuming Network Layer guarantees reliable delivery
- Confusing Session Layer with Transport Layer
- Misunderstanding Data Link Layer's error handling
Solution
Step 1: Review WebSocket handshake
WebSocket connections begin as HTTP requests and upgrade to a persistent socket (WebSocket connections start as HTTP requests and then upgrade to a persistent full-duplex socket is correct).Step 2: Consider security aspects
WebSocket itself is a protocol and does not guarantee encryption; secure WebSocket (wss://) uses TLS for encryption. So, WebSocket communication is not inherently secure (WebSocket communication is inherently secure and does not require additional encryption layers is incorrect).Step 3: Analyze latency and communication
WebSocket reduces latency by avoiding repeated HTTP overhead (WebSocket reduces latency by avoiding HTTP request-response overhead after connection establishment correct) and supports bidirectional communication (WebSocket supports bidirectional communication allowing both client and server to send messages independently correct).Final Answer:
Option A -> Option AQuick Check:
WebSocket requires TLS (wss://) for secure communication; it is not secure by default
- Assuming WebSocket is always encrypted
- Confusing WebSocket handshake with normal HTTP
- Believing WebSocket is unidirectional
