AMCAT Networking and Web Technologies 2 — Questions and Answers
Question 1: What is the purpose of a subnet mask in IP networking?
- To encrypt IP packets for secure transmission
- To divide an IP address into network and host portions, determining which addresses are on the same local network (Correct answer)
- To translate domain names to IP addresses
- To assign dynamic IP addresses to devices
Correct answer: To divide an IP address into network and host portions, determining which addresses are on the same local network
A subnet mask works with an IP address to identify which portion represents the network and which represents the host. When two devices have the same network portion (after applying the subnet mask), they are on the same local network and can communicate directly without a router.
Question 2: Which of the following is a key feature of WebSocket protocol compared to HTTP?
- WebSocket only supports one-way communication from server to client
- WebSocket establishes a persistent, full-duplex communication channel between client and server (Correct answer)
- WebSocket is more secure than HTTPS by default
- WebSocket replaces TCP at the transport layer
Correct answer: WebSocket establishes a persistent, full-duplex communication channel between client and server
WebSocket provides full-duplex communication over a single TCP connection, allowing both client and server to send messages independently at any time. Unlike HTTP's request-response model, WebSocket keeps the connection open, making it ideal for real-time applications like chat and live updates.
Question 3: What does CORS (Cross-Origin Resource Sharing) allow in web development?
- It blocks all cross-origin requests for security
- It allows servers to specify which origins are permitted to access their resources, relaxing the same-origin policy (Correct answer)
- It automatically encrypts all cross-origin communications
- It compresses data sent between different origins
Correct answer: It allows servers to specify which origins are permitted to access their resources, relaxing the same-origin policy
CORS is a mechanism that uses HTTP headers (like Access-Control-Allow-Origin) to allow servers to declare which origins (domains) are permitted to access their resources. It provides a controlled way to relax the same-origin policy when cross-origin access is legitimately needed.
Question 4: In the TCP three-way handshake, what is the correct sequence of messages?
- ACK → SYN → SYN-ACK
- SYN → SYN-ACK → ACK (Correct answer)
- SYN → ACK → SYN-ACK
- SYN-ACK → SYN → ACK
Correct answer: SYN → SYN-ACK → ACK
The TCP three-way handshake establishes a connection in three steps: (1) Client sends SYN to the server, (2) Server responds with SYN-ACK acknowledging the client's request and sending its own synchronization, (3) Client sends ACK confirming the server's response. The connection is now established.
Question 5: What is the primary function of a CDN (Content Delivery Network)?
- To host the origin server's database
- To distribute content across geographically dispersed servers to reduce latency and improve load times for users (Correct answer)
- To replace DNS for faster domain resolution
- To generate dynamic content for websites
Correct answer: To distribute content across geographically dispersed servers to reduce latency and improve load times for users
A CDN caches content (static files, images, scripts) on servers distributed across multiple geographic locations (edge servers). When a user requests content, it is served from the nearest edge server rather than the origin server, significantly reducing latency and improving performance.
Question 6: Which protocol is used to securely transfer files between a client and server?
- FTP (File Transfer Protocol)
- SFTP (SSH File Transfer Protocol) (Correct answer)
- HTTP (Hypertext Transfer Protocol)
- SMTP (Simple Mail Transfer Protocol)
Correct answer: SFTP (SSH File Transfer Protocol)
SFTP (SSH File Transfer Protocol) provides secure file transfer by encrypting both commands and data using SSH (Secure Shell). Standard FTP transmits data in plain text including credentials. HTTP is for web content, and SMTP is for email transmission.
What is the purpose of a subnet mask in IP networking?