AMCAT Networking and Web Technologies 1 — Questions and Answers
Question 1: At which layer of the OSI model does a router primarily operate?
- Data Link Layer (Layer 2)
- Network Layer (Layer 3) (Correct answer)
- Transport Layer (Layer 4)
- Application Layer (Layer 7)
Correct answer: Network Layer (Layer 3)
Routers operate at the Network Layer (Layer 3) of the OSI model. They make forwarding decisions based on IP addresses (logical addresses) and determine the best path for data packets to travel across interconnected networks. Switches operate at Layer 2, while firewalls can operate at Layers 3-7.
Question 2: What is the primary purpose of DNS (Domain Name System)?
- To encrypt data transmitted over the internet
- To translate human-readable domain names into IP addresses (Correct answer)
- To assign IP addresses to devices on a network
- To filter malicious web traffic
Correct answer: To translate human-readable domain names into IP addresses
DNS acts as the internet's phone book, translating human-readable domain names (like www.example.com) into numeric IP addresses (like 192.168.1.1) that computers use to identify each other on the network. Without DNS, users would need to remember IP addresses for every website.
Question 3: Which HTTP status code indicates that the requested resource has been permanently moved to a new URL?
- 200 OK
- 301 Moved Permanently (Correct answer)
- 404 Not Found
- 500 Internal Server Error
Correct answer: 301 Moved Permanently
HTTP 301 indicates that the requested resource has been permanently moved to a new URL specified in the Location header. Search engines transfer the old URL's ranking to the new URL. 200 means success, 404 means the resource was not found, and 500 indicates a server error.
Question 4: What is the difference between TCP and UDP?
- TCP is faster than UDP because it does not require a connection
- UDP provides reliable, ordered delivery while TCP does not
- TCP provides reliable, connection-oriented delivery with error checking; UDP provides faster, connectionless delivery without guaranteed delivery (Correct answer)
- There is no significant difference between TCP and UDP
Correct answer: TCP provides reliable, connection-oriented delivery with error checking; UDP provides faster, connectionless delivery without guaranteed delivery
TCP (Transmission Control Protocol) is connection-oriented, ensures reliable delivery through acknowledgments and retransmissions, and guarantees order. UDP (User Datagram Protocol) is connectionless, does not guarantee delivery or order, but has lower overhead, making it faster for applications like video streaming and gaming.
Question 5: What does the 'same-origin policy' enforce in web browsers?
- That all websites must use HTTPS
- That scripts from one origin cannot access data from a different origin (different domain, protocol, or port) (Correct answer)
- That all web pages must have the same HTML structure
- That cookies are shared across all websites
Correct answer: That scripts from one origin cannot access data from a different origin (different domain, protocol, or port)
The same-origin policy is a critical browser security mechanism that restricts how scripts loaded from one origin (defined by protocol, domain, and port) can interact with resources from another origin. This prevents malicious scripts on one site from accessing sensitive data on another site.
Question 6: In the context of REST APIs, which HTTP method is idempotent and used to update or create a resource at a specific URI?
- POST
- PUT (Correct answer)
- PATCH
- DELETE
Correct answer: PUT
PUT is idempotent, meaning multiple identical requests produce the same result as a single request. It updates a resource if it exists or creates it if it does not, always replacing the entire resource at the specified URI. POST is not idempotent (repeated calls may create multiple resources), and PATCH updates only part of a resource.
At which layer of the OSI model does a router primarily operate?