Study

Computer science flashcards

These cards cover the questions that come up again and again in placement tests and technical interviews: database transactions and normal forms, process scheduling and deadlocks, the core data structures and algorithm patterns, how TCP, HTTP and DNS work, and the building blocks of system design. Each card has one question on the front and a short, exact answer on the back.

The point is active recall. Read the question, answer it in your head or out loud, then flip the card and compare. Rate yourself honestly: cards you mark Hard come back in ten minutes, Medium the next day, and Easy after three days. Your ratings stay in your browser, so there is nothing to sign up for. When a card keeps catching you out, open the full topic guide for that subject in Courses and read the worked explanation before trying the card again.

120
Total cards
120
Due for review
0
Mastered
0
Reviewed today
DSATAP TO FLIP

Why does traversing a contiguous array of size N typically outperform traversing a singly linked list of the same size, even though both operations have an O(N) time complexity?

Answer

Array elements are stored in contiguous memory locations, which maximizes CPU cache locality and allows the system to prefetch data efficiently. In contrast, linked list nodes are scattered across memory, causing frequent cache misses as the CPU must repeatedly look up pointer addresses.

DSATAP TO FLIP

In a hash table, why does the search performance of Open Addressing (like linear probing) degrade much faster than Separate Chaining as the load factor approaches 1?

Answer

As the load factor approaches 1, Open Addressing suffers from clustering, where long runs of occupied slots form and drastically increase the number of probes needed to find an empty slot. Separate Chaining handles collisions by appending to lists, meaning lookup time degrades gradually relative to the average list length rather than failing to locate a slot.

DSATAP TO FLIP

For a deeply nested, narrow tree (e.g., a degenerate tree of depth N and width 1), would BFS or DFS require less auxiliary space, and why?

Answer

BFS would require less auxiliary space, specifically O(1) memory, because its queue will hold at most one node at any given level. In contrast, DFS would require O(N) auxiliary space because its recursion stack must store all N ancestor nodes from the root to the leaf.

DSATAP TO FLIP

Explain why Merge Sort cannot be optimized using Dynamic Programming (Memoization), even though it uses a divide-and-conquer strategy similar to other DP problems.

Answer

Dynamic Programming requires the problem to have overlapping subproblems, where the same subproblems are solved repeatedly. Merge Sort recursively divides an array into unique, completely disjoint subarrays, meaning there are no duplicate subproblems to cache or reuse.

DSATAP TO FLIP

Why is Quicksort often preferred over Heapsort in practice, despite Heapsort having a guaranteed O(N log N) worst-case time complexity while Quicksort can degrade to O(N^2)?

Answer

Quicksort exhibits excellent cache locality because it accesses memory sequentially during partitioning, whereas Heapsort makes random memory jumps across the heap array, causing frequent cache misses. Additionally, Quicksort has a lower constant factor in its average running time and can be optimized with randomized pivot selection to virtually eliminate the worst-case scenario.

DBMSTAP TO FLIP

How does the two-phase locking protocol prevent lost updates and ensure serializability?

Answer

Two-phase locking (2PL) enforces that all locks are acquired before any are released, keeping resources locked until the transaction commits or aborts. This prevents a transaction from reading or writing data that another active transaction is modifying, thereby eliminating lost updates. The lock ordering also guarantees that the resulting schedule is conflict-serializable.

DBMSTAP TO FLIP

In a distributed DBMS, what are the challenges of maintaining ACID properties across multiple nodes, and how does the two-phase commit protocol address them?

Answer

Distributed systems must coordinate commits across nodes to preserve atomicity and durability, but network failures can cause partial commits. The two-phase commit (2PC) protocol uses a coordinator that first asks all participants to prepare and lock resources (phase one), then instructs them to commit or abort based on the coordinator's decision (phase two). This ensures that either all nodes commit or all abort, maintaining ACID semantics across the cluster.

DBMSTAP TO FLIP

What is the purpose of indexing in a DBMS, and how does a B-tree index support efficient range queries compared to a hash index?

Answer

Indexing provides a data structure that allows the database to locate rows without scanning the entire table, improving query performance. A B-tree index supports efficient range queries by maintaining sorted keys and leaf nodes that can be traversed sequentially, whereas a hash index is optimized for equality lookups but cannot support ordered or range scans.

Operating SystemsTAP TO FLIP

What is the purpose of a file system journal, and how does it help maintain consistency after a crash?

Answer

A journal records metadata changes before they are applied, allowing the file system to replay or roll back incomplete operations after a crash. This ensures that the file system can recover to a consistent state without requiring a full integrity check, greatly reducing recovery time.

NetworksTAP TO FLIP

What is the purpose of the Network Address Translation (NAT) in a home router, and how does it affect inbound traffic?

Answer

NAT translates private IP addresses to a single public address, allowing multiple devices to share one external IP. It hides internal hosts from the Internet, so inbound unsolicited traffic is dropped unless a port mapping or firewall rule explicitly forwards it.

System DesignTAP TO FLIP

When designing a highly available web service, how does a load balancer contribute to fault tolerance?

Answer

A load balancer distributes incoming traffic across multiple backend instances, so if one instance fails, the balancer can redirect traffic to healthy instances without client interruption. It also performs health checks and can remove unhealthy nodes from the rotation. By doing so, it isolates faults and maintains service continuity.

System DesignTAP TO FLIP

What are the trade‑offs between horizontal and vertical scaling for a relational database?

Answer

Vertical scaling upgrades a single machine’s CPU, memory, or storage, offering simplicity but hitting hardware limits and downtime for reboots. Horizontal scaling partitions the data across multiple nodes, improving throughput and availability but adding complexity in query routing, transaction coordination, and consistency management.

System DesignTAP TO FLIP

In a distributed system using eventual consistency, how can a client detect and resolve conflicting writes that occurred concurrently on different replicas?

Answer

Clients can attach version vectors or timestamps to each write; when a read returns multiple versions, the client can apply a conflict resolution strategy such as last‑write‑wins or merge functions. Alternatively, a background reconciliation process can detect divergent replicas and reconcile them according to business rules.

System DesignTAP TO FLIP

How does a CDN cache content, and what factors determine cache expiration policies?

Answer

A CDN places edge servers near users and caches responses based on URL and headers like Cache‑Control. Expiration is driven by directives such as max‑age, stale‑while-revalidate, or by custom rules that consider content volatility and business SLAs. Edge servers also respect ETag or Last‑Modified to validate stale content with origin servers.

System DesignTAP TO FLIP

What is the purpose of a circuit breaker pattern in microservices architecture?

Answer

A circuit breaker monitors calls to a downstream service and trips when failures exceed a threshold, preventing repeated attempts that would only add load. When tripped, it short‑circuits calls and returns a fallback response or error, allowing the system to remain responsive. The breaker eventually resets after a cooldown, re‑testing the service.

OOPTAP TO FLIP

How does encapsulation protect an object's internal state, and what mechanisms in languages like Java enforce it?

Answer

Encapsulation bundles data and operations, restricting direct access to fields. In Java, fields are declared private and accessed via public getters/setters, enforcing invariants. This prevents external code from putting the object in an invalid state and makes maintenance easier.

OOPTAP TO FLIP

When should a developer prefer composition over inheritance in designing a class hierarchy, and what are the key benefits?

Answer

Composition is preferable when behavior needs to change at runtime or when a class should not inherit all implementation details of another. It promotes loose coupling, easier unit testing, and avoids the fragile base class problem. Inheritance is suitable for a clear IS-A relationship with stable behavior.

Operating SystemsTAP TO FLIP

How does preemptive scheduling differ from cooperative scheduling in terms of process control, and what are the typical advantages of each?

Answer

In preemptive scheduling the kernel can interrupt a running process at any time to switch to another, ensuring responsive multitasking and preventing any single process from monopolizing the CPU. Cooperative scheduling relies on processes voluntarily yielding control, which simplifies the scheduler but can lead to starvation if a process fails to yield. Preemptive scheduling is preferred for interactive systems, while cooperative scheduling can be useful in real‑time or embedded contexts where deterministic behavior is required.

Operating SystemsTAP TO FLIP

In a symmetric multiprocessing system, how does the Linux scheduler perform load balancing across CPUs, and what heuristics guide its decision to migrate a task?

Answer

The scheduler monitors per‑CPU runqueues and uses heuristics such as load imbalance thresholds and task affinity to decide when to migrate a task. If a CPU’s load exceeds a dynamic target, the scheduler selects a runnable task and moves it to a less busy core, considering factors like NUMA locality and cache warm‑up costs. This dynamic balancing aims to keep all CPUs busy while minimizing migration overhead.

Operating SystemsTAP TO FLIP

What is the purpose of a file system journal, and how does it maintain consistency when a crash occurs during a write transaction?

Answer

A journal records metadata changes in a sequential log before applying them to the file system, ensuring that the log can be replayed to recover to a consistent state. If a crash occurs during a write, the file system rolls back or replays the journal entries, restoring the file system to a state that reflects either the start or completion of the transaction. This approach reduces the risk of corruption and speeds recovery compared to full file system checks.

NetworksTAP TO FLIP

How does the Equal‑Cost Multi‑Path (ECMP) routing mechanism improve load distribution in a data center?

Answer

ECMP uses multiple paths that have the same cost between source and destination, allowing traffic to be split across them. Load balancers or routers hash packet headers to consistently map flows to a particular path, preventing packet reordering. This increases throughput and fault tolerance without requiring complex path calculations.

NetworksTAP TO FLIP

What is the impact of MTU mismatch on network performance and how does Path MTU Discovery mitigate it?

Answer

When the MTU of a path is smaller than the packet size, fragmentation or packet loss occurs, reducing throughput and increasing latency. Path MTU Discovery probes the path with ICMP messages to discover the smallest MTU and then adjusts packet sizes accordingly. This avoids fragmentation and improves end‑to‑end performance, especially over diverse links.

OOPTAP TO FLIP

How does method overriding enable runtime polymorphism in Java, and what benefit does it provide when adding a new subclass?

Answer

Method overriding lets a subclass provide its own implementation of a method declared in its superclass. At runtime, the JVM dispatches the call to the overridden method based on the actual object's type, enabling polymorphic behavior. This allows new subclasses to extend functionality without modifying existing client code, promoting the open/closed principle.

OOPTAP TO FLIP

What distinguishes the Strategy pattern from the Template Method pattern in terms of class structure and how they handle algorithm variations?

Answer

The Strategy pattern encapsulates interchangeable algorithms in separate classes that implement a common interface; the context delegates the algorithm to a strategy instance. In contrast, the Template Method defines the skeleton of an algorithm in an abstract class, with subclasses overriding only the primitive operations. Thus, Strategy favors composition and runtime selection, while Template Method relies on inheritance and compile-time method overrides.

OOPTAP TO FLIP

Explain how Java's single inheritance model avoids the diamond problem, and what language feature can still introduce similar ambiguity when using interfaces with default methods?

Answer

Java’s single inheritance of classes eliminates the classic diamond problem by ensuring each class has only one direct superclass. However, interfaces with default methods can still introduce ambiguity if two superinterfaces provide default implementations of the same method; the class must explicitly override or qualify the method to resolve the conflict. This mechanism preserves type safety while allowing interface reuse.

OOPTAP TO FLIP

In the context of behavioral subtyping, why might a class that overrides a method with a stricter precondition violate the Liskov Substitution Principle, and how can composition help mitigate this?

Answer

If a subclass overrides a method with a stricter precondition, callers that relied on the superclass contract may fail, violating the Liskov Substitution Principle. This occurs because the subclass imposes additional constraints not guaranteed by the base type. By using composition—delegating to a helper object that enforces the desired behavior—you can keep the base class unchanged and avoid breaking substitution.

DBMSTAP TO FLIP

How does a database engine decide whether to use a full table scan or an index seek during query execution, and what role does the query optimizer play?

Answer

The optimizer estimates the cost of each possible access path by analyzing statistics such as table cardinality, index selectivity, and I/O characteristics. It then chooses the path with the lowest estimated cost, balancing CPU, disk I/O, and memory usage. The optimizer also considers join order, predicate pushdown, and available indexes to generate an efficient execution plan.

DBMSTAP TO FLIP

In a write-ahead logging (WAL) system, why must log records be flushed to stable storage before the corresponding data pages are updated on disk, and what could happen if this order is violated?

Answer

Flushing log records first ensures that, in the event of a crash, the database can recover by replaying the log to redo any committed changes. If data pages are updated before the log is safely written, a crash could leave the database in an inconsistent state where committed changes are lost or partially applied. Recovery would then be unable to guarantee atomicity, potentially violating the ACID properties.

DBMSTAP TO FLIP

What is the purpose of a database index, and how does it differ from a primary key constraint in terms of enforcement and performance benefits?

Answer

An index is a data structure that accelerates data retrieval by providing a quick lookup path for query predicates, but it does not enforce any data integrity rules by itself. A primary key constraint enforces uniqueness and non-nullness, and typically creates a clustered index that also determines physical storage order. Thus, indexes improve performance, while primary keys provide integrity guarantees and can influence storage layout.

NetworksTAP TO FLIP

What distinguishes a connection-oriented protocol from a connectionless one, and can you name one protocol of each type?

Answer

Connection-oriented protocols establish a reliable communication channel before data transfer, ensuring ordered delivery and error recovery. Connectionless protocols send packets without prior setup, accepting potential loss or reordering. TCP is a classic connection-oriented protocol, while UDP is a common connectionless protocol.

Operating SystemsTAP TO FLIP

How does the working set model guide page replacement decisions in a virtual memory system?

Answer

The working set model tracks the set of pages a process actively uses over a recent time window. If the working set exceeds available physical frames, the system evicts pages outside this set to free memory, assuming they are less likely to be needed soon. This approach reduces thrashing by keeping actively referenced pages resident.

Operating SystemsTAP TO FLIP

What is priority inversion, and how do priority inheritance and priority ceiling protocols mitigate it in preemptive scheduling?

Answer

Priority inversion occurs when a low‑priority task holds a lock needed by a higher‑priority task, causing the high‑priority task to wait. Priority inheritance temporarily boosts the low‑priority task’s priority to that of the waiting high‑priority task, preventing further delays. Priority ceiling assigns a ceiling priority to a lock, and any task acquiring the lock runs at that ceiling, avoiding inversion altogether.

Operating SystemsTAP TO FLIP

Why does the Linux kernel use both a buddy allocator and a slab allocator, and what benefits does each provide for different allocation patterns?

Answer

The buddy allocator efficiently manages large contiguous memory blocks by splitting and coalescing free buddies, ideal for page‑level allocations. The slab allocator, on the other hand, caches pre‑allocated objects of the same size to reduce fragmentation and allocation overhead, making it efficient for frequent small object allocations like inode or socket structures. Together they balance speed, memory usage, and fragmentation control.

Operating SystemsTAP TO FLIP

How do transparent huge pages interact with page faults, and what kernel mechanisms ensure correct handling when a huge page cannot be allocated?

Answer

When a process accesses a virtual address that maps to a huge page, the kernel attempts to fault in the entire huge page. If the huge page cannot be allocated due to fragmentation or insufficient memory, the kernel falls back to allocating a set of regular 4‑KB pages, maintaining correct page table entries. This fallback preserves process isolation while still benefiting from huge page performance when possible.

Operating SystemsTAP TO FLIP

What distinguishes kernel threads from user threads, and why do device drivers often implement operations as kernel threads?

Answer

Kernel threads run in kernel mode and share the same address space as the kernel, allowing them to perform privileged operations without context switches to user space. They can block on I/O without suspending the entire process, enabling efficient multitasking. Device drivers use kernel threads to handle asynchronous I/O or long‑running operations while keeping the driver logic simple and responsive.

NetworksTAP TO FLIP

Given the network 192.168.10.0/24, how many usable host addresses are available in each /26 subnet, and how many such subnets can be created from the original network?

Answer

A /26 subnet contains 64 IP addresses, of which 62 are usable for hosts (the network and broadcast addresses are reserved). The original /24 can be divided into four non‑overlapping /26 subnets, each providing 62 usable hosts.

NetworksTAP TO FLIP

In a VLAN configuration, how does the use of 802.1Q tagging enable multiple logical networks over a single physical link, and what happens when a switch receives a frame without a VLAN tag?

Answer

802.1Q inserts a 4‑byte tag into Ethernet frames that contains a VLAN ID and priority bits, allowing switches to forward frames based on VLAN membership while sharing the same physical medium. When a switch receives an untagged frame, it assumes the default VLAN (commonly VLAN 1) and assigns that tag before forwarding it to other ports. Untagged frames are typically used for legacy devices that do not support VLAN tagging.

NetworksTAP TO FLIP

What is the purpose of ARP in an IPv4 network, and how does an ARP cache prevent repeated broadcast traffic?

Answer

ARP resolves IPv4 addresses to MAC addresses on a local network by broadcasting an ARP request. The host that owns the IP replies with its MAC address, which the requester stores in its ARP cache. Subsequent packets to the same IP use the cached MAC address, eliminating the need for repeated broadcast ARP requests.

DSATAP TO FLIP

You have an array of integers and a fixed window size k. How can you efficiently find the maximum sum of any contiguous subarray of length k?

Answer

Use a sliding‑window technique: maintain the sum of the current window, slide one element at a time, adding the new element and subtracting the element that leaves the window. This runs in O(n) time and O(1) extra space.

DSATAP TO FLIP

In a directed graph, how can depth‑first search be used to detect a cycle, and what role does node coloring play?

Answer

During DFS, color nodes white (unvisited), gray (in recursion stack), and black (finished). If you encounter a gray node, a back edge exists, indicating a cycle. This method runs in O(V+E).

DSATAP TO FLIP

Union‑Find with path compression and union by rank achieves nearly constant time per operation. What is the underlying mathematical function that bounds this complexity, and why does it grow so slowly?

Answer

The inverse Ackermann function α(n) bounds the amortized cost. It grows extremely slowly—α(n) ≤ 5 for all practical n—because it is the inverse of a very fast‑growing function, making the operations effectively constant time.

DSATAP TO FLIP

Given two binary trees, how can you determine whether they are identical in structure and node values?

Answer

Recursively compare the root nodes; if both are null, the subtrees are identical. If one is null or the values differ, they are not identical. Otherwise, recurse on left and right children. This yields O(n) time.

DSATAP TO FLIP

Why is merge sort a preferred sorting algorithm for singly linked lists, and what is its time complexity when implemented bottom‑up?

Answer

Merge sort works well with linked lists because merging can be done in place without random access, and it preserves stability. Bottom‑up merge sort runs in O(n log n) time and uses only O(1) extra space for the list nodes.

DSATAP TO FLIP

How does a min‑heap implement a priority queue, and what are the time complexities of insert and extract‑min operations?

Answer

A min‑heap stores elements in a binary tree where each parent is ≤ its children. Insertion adds the element at the leaf and bubbles it up, O(log n). Extract‑min removes the root, replaces it with the last element, and bubbles it down, also O(log n).

System DesignTAP TO FLIP

In a typical web application, how does a reverse proxy help reduce the load on backend servers?

Answer

A reverse proxy sits between clients and backend servers, receiving all requests and forwarding them to the appropriate server. It can cache static content, compress responses, and terminate TLS, reducing CPU and memory usage on backends. By balancing traffic across multiple instances, it prevents any single server from becoming a bottleneck.

System DesignTAP TO FLIP

What is consistent hashing and how does it enable smooth scaling of a distributed cache when nodes are added or removed?

Answer

Consistent hashing maps both keys and servers to a circular hash space; each key is served by the first server encountered clockwise. When a server joins or leaves, only keys that map to that point in the circle need to be moved, minimizing data reshuffling. This property makes scaling a distributed cache efficient and reduces cache misses during topology changes.

System DesignTAP TO FLIP

In a multi-region database that uses synchronous replication, what are the main challenges to maintaining low latency, and how might asynchronous replication trade off consistency for performance?

Answer

Synchronous replication requires all replicas to acknowledge a write before the client is considered successful, which introduces round‑trip latency that grows with the number of regions. This can cause slow response times or timeouts if a region is slow or temporarily unreachable. Asynchronous replication removes that wait, improving latency but risking temporary inconsistency between regions, which must be handled by conflict resolution or read‑repair mechanisms.

System DesignTAP TO FLIP

How does implementing a rate limiter at the API gateway level protect downstream services from traffic spikes?

Answer

A rate limiter enforces a maximum number of requests per time window, dropping or queuing excess traffic before it reaches backend services. By capping the request rate, it protects services from sudden load spikes that could exhaust CPU, memory, or connection limits. It also provides a predictable traffic pattern that downstream components can be tuned for.

System DesignTAP TO FLIP

What factors does a CDN use to decide which edge location should serve a client's request, and how does this decision impact cache hit ratios?

Answer

A CDN evaluates the client’s geographic location, network latency, current edge server load, and cache freshness to pick the optimal edge node. It may use DNS resolution, Anycast routing, or a decision engine that considers health checks. Selecting the nearest healthy server maximizes cache hit ratios and minimizes round‑trip time, while also balancing load across the edge network.

DBMSTAP TO FLIP

What distinguishes a clustered index from a non‑clustered index in a relational database, and how does each affect data storage layout?

Answer

In a clustered index the table’s rows are physically ordered to match the index key, so the leaf pages of the index are the data pages themselves. A non‑clustered index stores a separate structure of key values and pointers to the actual rows, leaving the table’s physical order independent of the index. Because of this, a clustered index can speed up range scans on the key but limits the table to a single clustered index.

DBMSTAP TO FLIP

How does a covering index influence the optimizer’s decision to use an index‑only scan for a SELECT that references both WHERE and SELECT columns?

Answer

When every column used in the SELECT list and the WHERE clause is present in the index leaf pages, the optimizer can satisfy the query without touching the base table, producing an index‑only scan. This eliminates the need for a lookup into the heap, reducing I/O and improving performance. However, if the index is not covering, the optimizer must perform a key‑lookup or row‑fetch, which can negate the benefit of the index.

DBMSTAP TO FLIP

In a multi‑version concurrency control system, how can a reader avoid blocking a writer, and what consistency guarantees does the reader receive when reading a row that has been updated but not yet committed?

Answer

Readers access the most recent committed version of a row, while writers create a new version and mark the old one as obsolete. Because readers never read uncommitted versions, they never block writers; instead, writers proceed to write new versions and later commit. The reader thus sees a snapshot that is stable and repeatable, but it may not reflect the latest uncommitted changes, ensuring isolation without blocking.

OOPTAP TO FLIP

What is the difference between method overloading and method overriding in Java?

Answer

Method overloading is a compile‑time polymorphism where a class has multiple methods with the same name but different parameter lists. Method overriding is a runtime polymorphism where a subclass provides a new implementation of a method inherited from its superclass. Overloading does not require inheritance, whereas overriding does.

OOPTAP TO FLIP

What are the trade‑offs between using a static factory method and a constructor for object creation in Java?

Answer

A constructor always creates a new instance and its name must match the class, making it less expressive. A static factory method can return existing instances, subclasses, or cached objects, and can have descriptive names, but it cannot be inherited and callers must reference the factory class. Choosing between them depends on whether you need flexibility, caching, or a clear API.

OOPTAP TO FLIP

What common pitfalls arise when a class attempts to handle multiple responsibilities, and how does the Single Responsibility Principle help avoid them?

Answer

When a class takes on unrelated tasks, it becomes hard to maintain, test, and extend; adding new features often requires touching unrelated code, leading to fragile design. The Single Responsibility Principle encourages each class to focus on one concern, reducing coupling, improving testability, and making future changes localized.

OOPTAP TO FLIP

How does the Template Method pattern differ from the Strategy pattern in enforcing algorithm flexibility?

Answer

The Template Method defines a fixed algorithm skeleton in an abstract class, delegating specific steps to subclasses that override abstract methods. The Strategy pattern encapsulates an entire algorithm in a separate class and lets the client choose or switch strategies at runtime. Thus, Template Method offers compile‑time extensibility, while Strategy offers runtime flexibility.

OOPTAP TO FLIP

How does Java’s type erasure affect generics at runtime, and how can reflection be used to recover generic type information?

Answer

During compilation, generic type parameters are erased, so at runtime the JVM sees raw types and loses specific type information. Reflection can retrieve generic type arguments via ParameterizedType for fields, methods, or constructors, allowing the program to inspect the original generic types, though it cannot recover type arguments of local variables or type parameters of the current class.

OOPTAP TO FLIP

When should a Java developer choose an abstract class over an interface, and vice versa?

Answer

Use an abstract class when you need to provide shared implementation or maintain state across subclasses, or when you want to control the constructor. Use an interface when you need to declare a contract that can be implemented by unrelated classes, or when you want multiple inheritance of type. Interfaces can now provide default methods, but still cannot hold instance fields.

NetworksTAP TO FLIP

How does an ARP cache balance the trade‑off between stale entries and broadcast traffic?

Answer

An ARP cache stores IP‑to‑MAC mappings with a time‑to‑live value. When an entry expires, the host broadcasts an ARP request to refresh it, preventing stale addresses from causing misdelivery. The TTL is chosen to be long enough to reduce broadcasts yet short enough to avoid using outdated mappings.

NetworksTAP TO FLIP

During a TCP loss event, how does the congestion avoidance algorithm differ when loss is detected via duplicate ACKs versus a retransmission timeout, and why does this distinction affect throughput?

Answer

Duplicate ACKs indicate a single lost segment; TCP performs fast retransmit and reduces the congestion window multiplicatively (usually to half) but then enters congestion avoidance to slowly increase it. A timeout signals more severe congestion or multiple losses; TCP resets the congestion window to one segment and enters slow start, which can dramatically lower throughput until the network stabilizes.

NetworksTAP TO FLIP

In BGP, how does the AS_PATH attribute prevent routing loops when multiple autonomous systems advertise the same prefix, and what happens if a loop is detected?

Answer

The AS_PATH records every AS the route has traversed; a router rejects any route that already contains its own AS number, thereby breaking potential loops. If a loop is detected, the route is dropped and the router may advertise a different path with a shorter AS_PATH to its peers, ensuring loop‑free propagation.

NetworksTAP TO FLIP

How does MPLS enable traffic engineering in core networks, and what role do label‑switched paths play in per‑packet forwarding?

Answer

MPLS assigns short labels to packets, allowing core routers to forward based solely on the label rather than the IP header. Label‑switched paths (LSPs) are pre‑established routes that can be engineered to avoid congested links or to meet bandwidth guarantees, and each hop swaps the label to steer the packet along the desired path.

NetworksTAP TO FLIP

What is the effect of an MTU mismatch on a VPN tunnel that encapsulates packets, and how do Path MTU Discovery and fragmentation cooperate to preserve performance?

Answer

When the encapsulated packet exceeds the downstream MTU, the tunnel interface sets DF (don’t fragment) and the remote host performs Path MTU Discovery to find the smallest MTU along the path. If a packet is too large, the sender receives an ICMP fragmentation‑needed message and resends a smaller packet, avoiding in‑tunnel fragmentation that would degrade throughput.

NetworksTAP TO FLIP

Why does Ethernet use a CRC for error detection while IP uses a checksum, and how does each suit its layer’s responsibilities?

Answer

Ethernet’s CRC operates on the frame payload and is efficient for detecting bit errors in the physical medium, allowing the NIC to discard corrupted frames early. IP’s 16‑bit checksum covers the header and data, enabling routers to detect errors without re‑transmission, which is appropriate for a layer that forwards packets but does not perform error recovery.

DBMSTAP TO FLIP

How does a foreign key constraint enforce referential integrity, and what are the typical actions taken on delete or update of the referenced row?

Answer

When a foreign key is defined, the database ensures that any value inserted into the referencing column matches an existing primary key value in the referenced table. On deletion or update of the referenced row, the database can cascade the change, set the referencing column to null, or reject the operation based on the ON DELETE/UPDATE rule specified. This mechanism prevents orphaned rows and maintains consistent relationships across tables.

DBMSTAP TO FLIP

What factors does a query optimizer consider when choosing between a hash join and a nested-loop join, and how do statistics influence that decision?

Answer

The optimizer evaluates the estimated row counts, available indexes, and the cost of building a hash table versus probing it. If the left input is large and the right input is small, a hash join is often cheaper; if both inputs are small or one is indexed, a nested-loop join may be preferable. Statistics on table cardinality, index selectivity, and data distribution directly affect the cost estimates that guide this choice.

Operating SystemsTAP TO FLIP

In a preemptive scheduling system, how does the scheduler decide when to preempt a running process, and what is the role of the time slice?

Answer

In a preemptive scheduler, the OS periodically checks the priority of the currently running process against other ready processes. If a higher‑priority process is ready, the scheduler interrupts the running process, saves its context, and switches to the higher‑priority one. The time slice (quantum) defines how long a process may run before the scheduler performs this check, ensuring fairness and responsiveness.

Operating SystemsTAP TO FLIP

What is demand paging, and how does it reduce the amount of physical memory required by a process?

Answer

Demand paging loads pages into physical memory only when a process accesses them, keeping the rest on disk. When a page fault occurs, the OS reads the needed page from disk into a free frame, reducing the number of pages resident at any time. This lazy loading allows larger virtual address spaces than physical memory, but introduces overhead due to disk I/O.

Operating SystemsTAP TO FLIP

How does the copy‑on‑write mechanism work during a fork system call, and what are the performance implications when the child process modifies a shared page?

Answer

During fork, the child receives a copy of the parent's address space, but the pages are marked read‑only and share the same physical frames. When the child writes to a shared page, a page fault triggers the OS to allocate a new frame, copy the original contents, and update the page table, leaving the parent's copy untouched. This copy‑on‑write reduces memory usage when the child does not modify many pages, but incurs a copy cost only when modifications occur.

System DesignTAP TO FLIP

How can a read replica improve read scalability in a relational database system?

Answer

A read replica maintains a copy of the primary database and accepts read queries, thereby distributing read traffic across multiple nodes. This reduces the load on the primary, allowing it to focus on writes and transaction processing. The replica is typically kept in sync via asynchronous replication, which introduces a small delay but is acceptable for many read‑heavy workloads.

System DesignTAP TO FLIP

What are the trade‑offs between horizontal and vertical scaling for a stateless microservice, and how does a team decide which to apply?

Answer

Vertical scaling increases a single instance's CPU, memory, or storage, offering simplicity but hitting hardware limits and potentially causing downtime during upgrades. Horizontal scaling adds more instances behind a load balancer, providing elasticity and fault tolerance but requiring careful handling of state, session affinity, and inter‑service communication. Teams choose based on cost, expected traffic patterns, and the complexity of scaling stateful components.

System DesignTAP TO FLIP

How can a CDN use cache invalidation strategies to ensure users receive updated content while minimizing cache misses?

Answer

CDNs often combine time‑to‑live (TTL) expirations with cache‑busting techniques such as versioned URLs or ETags. When content changes, the origin server can push a purge request to edge nodes or set a short TTL, forcing a refresh. This balances freshness against cache hit rates, ensuring users see updates without excessive network traffic.

DSATAP TO FLIP

Given an array of integers, how can you find the maximum product of two distinct elements in O(n) time?

Answer

Maintain the two largest and two smallest numbers while scanning once. The maximum product is either the product of the two largest positives or the product of the two smallest negatives (if they are negative). Return the larger of the two products.

DSATAP TO FLIP

How can you detect a cycle in a singly linked list without using extra memory?

Answer

Use Floyd's Tortoise and Hare algorithm: advance one pointer one step and another two steps. If they ever meet, a cycle exists; if the fast pointer reaches null, the list is acyclic.

DSATAP TO FLIP

What is the difference between memoization and tabulation in dynamic programming, and when would you choose one over the other?

Answer

Memoization stores results of recursive calls on demand, leading to a top‑down approach, while tabulation builds a table bottom‑up iteratively. Memoization is simpler when the state space is sparse; tabulation is preferable when all subproblems must be computed and can reduce function call overhead.

DSATAP TO FLIP

Why does insertion sort perform better on partially sorted arrays compared to random arrays?

Answer

Insertion sort shifts elements only until the correct insertion point; when the array is nearly sorted, each element is already near its final position, so few shifts are needed. In a random array, many elements require moving across the array, increasing the number of comparisons and swaps.

DBMSTAP TO FLIP

What is the fundamental difference between a primary key and a unique index in a relational database?

Answer

A primary key is a unique identifier for rows and implicitly creates a unique index, but it also enforces a NOT NULL constraint, ensuring that every row has a value for the key. A unique index only guarantees uniqueness; it can allow NULL values unless explicitly defined otherwise. In practice, the primary key is used by foreign keys to establish relationships, while a unique index is often employed for business rules that require uniqueness without being the main identifier.

DBMSTAP TO FLIP

Under what circumstances would a database engine choose a bitmap index over a B‑tree index for a low‑cardinality column?

Answer

Bitmap indexes are advantageous when the column has a very small number of distinct values (e.g., gender or status) and the workload involves many AND/OR combinations of predicates, as bitwise operations are fast. They also consume less space for such columns because each distinct value is represented by a bit vector. However, bitmap indexes perform poorly with frequent updates, so a B‑tree is preferred when the column is highly mutable.

DBMSTAP TO FLIP

In a multi‑version concurrency control (MVCC) engine, what roles do latches and locks play, and why are both needed?

Answer

Latches are lightweight, short‑lived mutexes used to protect internal data structures (e.g., buffer pool pages) during read or write operations, ensuring thread‑safe manipulation of in‑memory objects. Locks, on the other hand, enforce transaction‑level isolation by controlling access to data at a logical level (e.g., row or table locks). MVCC relies on latches for fast, non‑blocking reads of old versions while using locks to prevent write conflicts and to maintain consistency when committing new versions.

DBMSTAP TO FLIP

When a query optimizer estimates the cardinality of a join but the underlying statistics are stale, how does it affect the chosen execution plan and what mitigation strategies exist?

Answer

Stale statistics lead the optimizer to misestimate the number of rows produced by predicates, causing it to choose suboptimal join orders or indexes, often resulting in full scans or large intermediate results. Mitigation strategies include regular statistics collection, adaptive query execution that can replan on the fly, and using histogram or sampling techniques to approximate current data distributions more accurately.

DBMSTAP TO FLIP

What is the primary purpose of a write‑ahead log (WAL) in a database system, and how does it support durability and atomicity during crash recovery?

Answer

The WAL records every change to the database before the actual data pages are written to disk, ensuring that the log on stable storage reflects all intended modifications. During recovery, the system replays the log to bring the database to a consistent state, guaranteeing that committed transactions are preserved (durability) and that incomplete transactions are undone (atomicity). This mechanism allows the database to recover to the last known good state even after an abrupt power loss.

Operating SystemsTAP TO FLIP

What is the purpose of a journaling file system and how does it differ from a copy‑on‑write strategy?

Answer

A journaling file system records metadata changes in a journal before applying them to the main file system, allowing recovery after a crash by replaying or rolling back incomplete operations. Copy‑on‑write, on the other hand, writes changes to new blocks and updates pointers atomically, which eliminates the need for a journal but can incur higher write amplification. Journaling focuses on speed and simplicity, while copy‑on‑write prioritizes durability and consistency at the cost of more I/O.

OOPTAP TO FLIP

How does encapsulation differ from abstraction in object-oriented design, and why is each important for class interfaces?

Answer

Encapsulation hides an object's internal state behind a well‑defined interface, preventing external code from depending on implementation details. Abstraction focuses on exposing only the essential behavior and omitting irrelevant details. Together, they allow designers to change internal workings without affecting clients, and they make classes easier to understand and maintain.

OOPTAP TO FLIP

In Java, what happens when a subclass overrides a method that is declared final in its superclass, and how does this affect dynamic dispatch?

Answer

A method declared final in a superclass cannot be overridden in any subclass; attempting to do so results in a compile‑time error. Because the method cannot be replaced, dynamic dispatch will always invoke the superclass's implementation, regardless of the object's runtime type. This guarantees consistent behavior but limits polymorphic flexibility.

OOPTAP TO FLIP

How can Java's interface default methods introduce a diamond inheritance problem, and what mechanisms does the language provide to resolve conflicts?

Answer

If two interfaces provide default implementations of the same method, a class that implements both inherits a diamond conflict. Java resolves this by requiring the implementing class to override the method and explicitly select which interface's default to use via super syntax, or to provide its own implementation. This mechanism prevents ambiguity while still allowing reusable default behavior.

OOPTAP TO FLIP

When deciding between an abstract class and an interface in Java 8+, what criteria should guide your choice, particularly regarding method implementation and state?

Answer

Choose an abstract class when you need to share state or provide partial implementation that cannot be expressed with interfaces, such as a protected constructor or common fields. Prefer an interface when you only need to specify a contract, especially if multiple inheritance of type is required. In Java 8+, interfaces can contain default methods, so the decision often hinges on whether you need to maintain a stable implementation that may evolve over time versus a purely behavioral contract.

Operating SystemsTAP TO FLIP

What is the role of a page table entry in virtual memory management?

Answer

A page table entry maps a virtual page number to a physical frame and stores attributes such as the present bit, access permissions, and a dirty bit. The OS consults this entry during address translation to determine whether a page fault should be raised or the physical address can be returned. This mapping also enables the kernel to enforce protection and isolation between processes.

Operating SystemsTAP TO FLIP

How does a journaling file system ensure consistency after a crash, and what are the trade‑offs compared to a copy‑on‑write approach?

Answer

A journaling file system records metadata changes to a log before applying them to the main filesystem; on recovery it replays or rolls back the log to bring the filesystem to a consistent state. This adds overhead from extra writes and log management, but keeps recovery fast. Copy‑on‑write writes new blocks and updates pointers atomically, eliminating the need for a log but potentially requiring more disk space and slower writes due to increased I/O.

Operating SystemsTAP TO FLIP

In a multi‑core system, how does the kernel prevent priority inversion when a low‑priority task holds a lock needed by a high‑priority task, and what mechanisms are commonly employed to mitigate this?

Answer

The kernel can use priority inheritance, temporarily boosting the low‑priority task's priority to that of the waiting high‑priority task, ensuring the lock is released quickly. Alternatively, the priority ceiling protocol assigns a ceiling priority to the lock itself, preventing any task below that priority from preempting the holder. Both mechanisms reduce the waiting time for high‑priority tasks and avoid starvation.

Operating SystemsTAP TO FLIP

What is the purpose of a dirty bit in a page frame, and how does it influence write‑back policies?

Answer

The dirty bit indicates that a page has been modified while in RAM. When the page is evicted, the OS checks this bit to decide whether to write the page back to disk; if the bit is clear, the write can be skipped, saving I/O. This mechanism underlies write‑back caching and reduces unnecessary disk traffic.

NetworksTAP TO FLIP

How does the AIMD (Additive Increase Multiplicative Decrease) algorithm adjust TCP's congestion window in response to packet loss versus no loss, and why does this lead to TCP's fairness property?

Answer

When no loss occurs, TCP increases the congestion window by one segment per round‑trip time, slowly probing for available bandwidth. Upon detecting loss, the window is halved, sharply reducing sending rate. This combination of slow growth and aggressive reduction ensures that multiple flows share bandwidth proportionally, leading to the well‑known TCP fairness property.

NetworksTAP TO FLIP

How does Stateless Address Autoconfiguration (SLAAC) work, and what role does the Router Advertisement message play in this process?

Answer

SLAAC lets a host generate an IPv6 address by combining a network prefix received from a Router Advertisement (RA) with a locally generated interface identifier. The RA also conveys network parameters such as DNS servers and prefix lifetime. Because the host does not need a DHCP server, address configuration is fast and stateless.

System DesignTAP TO FLIP

What is the purpose of a health check endpoint in microservices and how does it aid in service discovery and load balancing?

Answer

A health check endpoint reports the operational status of a service instance, allowing orchestrators or load balancers to route traffic only to healthy nodes. It also helps service discovery mechanisms to register or deregister instances based on their health, ensuring that clients always communicate with responsive services. Regular health checks enable graceful scaling and rapid failure detection.

System DesignTAP TO FLIP

How can you use HTTP caching headers to reduce load on a web server?

Answer

By setting appropriate Cache-Control directives (e.g., max‑age, s‑maxage) and ETag or Last‑Modified headers, clients and intermediate caches can serve stale content without contacting the origin server. This reduces request traffic and improves response times, especially for static assets.

System DesignTAP TO FLIP

What is the purpose of a CDN in a web application, and how does it affect latency for global users?

Answer

A CDN replicates content on edge servers close to users; requests are routed to the nearest edge, cutting network hops and reducing round‑trip time. This lowers perceived latency and offloads traffic from the origin.

System DesignTAP TO FLIP

When partitioning a relational database horizontally, what are the key considerations to ensure balanced load and minimal cross‑partition joins?

Answer

Choose a sharding key that distributes rows evenly and aligns with query patterns; avoid keys that cause hotspot traffic. Also design schemas to keep frequently joined tables in the same shard and use consistent hashing to handle re‑sharding with minimal data movement.

System DesignTAP TO FLIP

Design a globally distributed key‑value store that guarantees strong consistency and high availability under the CAP theorem constraints. What trade‑offs would you make and how would you handle network partitions?

Answer

Choose a consensus protocol (e.g., Raft) to elect a primary per region, replicating writes to followers. During a partition, you can sacrifice availability by refusing writes to minority nodes or use a hybrid approach with quorum reads/writes to maintain consistency while keeping some nodes available for reads.

System DesignTAP TO FLIP

How would you architect a real‑time analytics pipeline that ingests millions of events per second, processes them with low latency, and provides aggregate metrics to dashboards? Discuss the components and data flow.

Answer

Use a high‑throughput ingestion layer (Kafka or Pulsar) to buffer events, stream processors (Flink, Beam) for low‑latency transformations, and a time‑series database (ClickHouse, Druid) for aggregates. Dashboards query the TSDB via a low‑latency API; the pipeline scales horizontally and partitions by key to avoid bottlenecks.

DSATAP TO FLIP

How can the median of two sorted arrays of equal length be found in O(log n) time?

Answer

Perform a binary search on the partition point of one array, computing the corresponding partition in the other array. Adjust the partition so that all elements on the left side are less than or equal to those on the right side. Once balanced, the median is the maximum of the left partition and the minimum of the right partition.

DSATAP TO FLIP

What algorithm detects a cycle in a singly linked list without using extra memory?

Answer

Use Floyd’s Tortoise and Hare technique: advance one pointer one step and another two steps per iteration. If the list contains a cycle, the two pointers will eventually meet; if no cycle exists, the fast pointer will reach the list’s end.

DSATAP TO FLIP

How does Kruskal’s algorithm construct a Minimum Spanning Tree and what data structure ensures no cycles are formed?

Answer

Kruskal sorts all edges by weight and adds them one by one, skipping any edge that would create a cycle. The Union‑Find (disjoint set) structure tracks connected components, allowing quick cycle detection and merging of sets.

DSATAP TO FLIP

What are the key differences between a Segment Tree and a Binary Indexed Tree regarding updates and queries?

Answer

A Segment Tree supports range queries and point updates in O(log n) time but requires O(n) extra space and can handle arbitrary associative operations. A Binary Indexed Tree (Fenwick Tree) is more space‑efficient, supports prefix sums and point updates in O(log n), but is limited to operations that are invertible and associative.

NetworksTAP TO FLIP

Why does the use of MPLS labels enable faster forwarding in core routers compared to IP header lookup, and what role does label stacking play in VPN segmentation?

Answer

MPLS labels allow routers to perform label‑switching by a simple table lookup on a fixed‑length label, bypassing the variable‑length IP header parsing and routing table search, thus reducing forwarding latency. Label stacking enables multiple VPNs to share the same underlying MPLS network by adding a VPN‑specific label on top of the transport label, allowing isolation and efficient routing of traffic belonging to different customers.

NetworksTAP TO FLIP

What security implications arise from using default DNS over UDP without authentication, and how does DNSSEC mitigate these risks?

Answer

Without authentication, DNS responses can be spoofed, enabling cache poisoning attacks where an attacker injects false records into a resolver’s cache. DNSSEC adds cryptographic signatures to DNS records, allowing resolvers to verify that responses originate from authoritative sources and have not been tampered with, thereby protecting against such spoofing attacks.

NetworksTAP TO FLIP

In a software‑defined networking (SDN) environment, how does the OpenFlow protocol separate control and data planes, and what advantage does this separation provide for network policy enforcement?

Answer

OpenFlow decouples the control plane (running on a controller) from the data plane (running on switches). The controller programs flow tables in switches via OpenFlow messages, enabling dynamic, centralized policy enforcement, rapid reconfiguration, and fine‑grained traffic engineering without modifying individual switch firmware.

DBMSTAP TO FLIP

What effect does creating a clustered index on a table have on the physical layout of the table's rows, and why is this beneficial for range queries?

Answer

A clustered index orders the table's rows on disk according to the indexed key, so rows with adjacent key values are stored contiguously. This physical ordering reduces the number of page reads needed for range scans, improving I/O efficiency and query performance.

DBMSTAP TO FLIP

When deciding between a hash join and a nested-loop join, what statistics does the optimizer examine, and how do these statistics influence the cost estimate?

Answer

The optimizer looks at table sizes, row counts, distinct values, and the selectivity of join predicates. For a hash join, it estimates the cost of building and probing a hash table, which is cheaper when both inputs are large and the predicate is equi-join. For a nested-loop join, it considers the number of outer loop iterations and the cost of probing the inner relation, favoring it when one side is small or indexed.

DBMSTAP TO FLIP

What is the purpose of a buffer pool in a DBMS, and how does it affect transaction throughput and I/O load?

Answer

The buffer pool caches frequently accessed data pages in memory, reducing disk I/O. By keeping hot data in RAM, it increases transaction throughput and lowers latency, but requires careful sizing to balance memory usage and cache hit rates.

OOPTAP TO FLIP

In a class hierarchy, how does the Liskov Substitution Principle influence the design of overridden methods, and what are common pitfalls when violating it?

Answer

LSP requires that objects of a subclass can replace objects of the superclass without affecting correctness. This means overridden methods must accept the same or broader preconditions and guarantee at least the same postconditions. Common pitfalls include narrowing preconditions (e.g., forbidding null values) or changing the return type to a more specific type, which can break substitutability.

Operating SystemsTAP TO FLIP

What is the working set of a process, and how does it influence page replacement decisions in a virtual memory system?

Answer

The working set is the set of pages a process actively uses over a recent time window. A page replacement algorithm that respects the working set keeps these pages resident, reducing page faults. By monitoring the working set size, the system can decide when to allocate more frames or to evict pages that are no longer in the working set, improving overall performance.

Operating SystemsTAP TO FLIP

In interprocess communication, why might a system choose message passing over shared memory for certain applications?

Answer

Message passing avoids the need for explicit synchronization, reducing the risk of race conditions and simplifying debugging. It also provides a clear abstraction of data ownership, which is useful in distributed or networked environments where processes may not share physical memory. For applications that require strict isolation or where processes run on different machines, message passing is the natural choice.

OOPTAP TO FLIP

How does encapsulation prevent accidental modification of an object's state in Java?

Answer

By declaring fields private and exposing them only through controlled getters and setters, a class hides its internal state. This forces validation logic within the class to maintain invariants, preventing external code from altering them directly.

OOPTAP TO FLIP

What is the difference between a class and an interface in Java regarding implementation?

Answer

A class provides concrete implementations of methods and can hold instance fields, whereas an interface declares method signatures (and optional default/static methods) but no instance state. Implementing an interface allows a class to promise certain behavior without dictating how it is achieved.

OOPTAP TO FLIP

How does the Liskov Substitution Principle guide the design of subclasses, and what can go wrong if a subclass changes the contract of a method?

Answer

It requires that a subclass instance can replace its superclass without affecting program correctness. If a subclass narrows a method’s precondition or violates its postcondition, callers that rely on the superclass contract may fail, leading to bugs. Designers should preserve or relax preconditions and maintain postconditions when overriding.

OOPTAP TO FLIP

In a multi-threaded Java application, how can object immutability contribute to thread safety, and what are the trade-offs when designing immutable classes?

Answer

Immutable objects have no state changes after construction, so concurrent threads can safely share them without synchronization. The trade‑offs include higher memory usage and potential performance cost from creating new instances for each change, but the simplicity and safety benefits often outweigh these concerns in multi‑threaded designs.

NetworksTAP TO FLIP

How does TCP ensure that data segments arrive at the receiver in the order they were sent, and what is the role of sequence numbers in this process?

Answer

TCP assigns a sequence number to each byte in the stream. The receiver uses these numbers to reorder out-of-order segments and to detect missing data. ACKs acknowledge the highest contiguous sequence number received, prompting retransmission of gaps. This mechanism guarantees in-order delivery at the application layer.

NetworksTAP TO FLIP

In what ways do OSPF and EIGRP differ in how they compute route metrics and how they converge when a network topology changes?

Answer

OSPF uses a cost metric derived from link bandwidth and employs Dijkstra's algorithm to compute shortest paths; convergence is achieved through link-state advertisements and a flooding mechanism that updates all routers simultaneously. EIGRP uses a composite metric based on bandwidth, delay, reliability, load, and MTU, and converges via a diffusing update algorithm that propagates only incremental changes, often resulting in faster convergence for large networks. The difference in metric calculation and update propagation leads to distinct convergence characteristics.

NetworksTAP TO FLIP

How does TCP Fast Retransmit detect packet loss without waiting for a timeout, and under what circumstances might it mistakenly trigger a retransmission?

Answer

Fast Retransmit observes three duplicate ACKs for the same sequence number, assuming the missing segment was lost and the sender can immediately retransmit it. This heuristic works well when loss is due to a single packet drop but can trigger false positives if ACKs are delayed or reordered, causing duplicate ACKs for a different segment. Network jitter or a transient congestion burst can also lead to unnecessary retransmissions.

NetworksTAP TO FLIP

What is the purpose of the TCP window scaling option, and how does it improve performance over high bandwidth-delay product links?

Answer

Window scaling expands the 16-bit advertised window field into a larger value, allowing a sender to transmit more data before waiting for ACKs. On links with large bandwidth-delay products, the default 64 KB window would underutilize the link, so scaling enables higher throughput by matching the window size to the link capacity. The option is negotiated during the TCP three-way handshake.

NetworksTAP TO FLIP

How does source routing differ from destination routing in IPv6, and why is source routing generally discouraged?

Answer

In source routing, the sender specifies the exact path a packet should take, embedding the route in the packet header, whereas destination routing relies on routers to decide the next hop based on their routing tables. Source routing can bypass security policies, create routing loops, and increase the size of packets, making it a vector for attacks; therefore, most modern IPv6 deployments disable it by default. The lack of source routing also simplifies router configuration and improves scalability.

Spaced repetition: After revealing an answer, rate how well you knew it. Easy cards resurface in 3 days, Medium in 1 day, Hard in 10 minutes. Switch to Due mode to focus only on cards that need review.

Consent notice
We use cookies for analytics and ads personalization to keep glancED free.
We use cookies and local storage for analytics and ads personalization. Until you accept, Google Analytics stays off and any ads are non-personalized. Learn how Google processes data in our Privacy Policy and on Google's Business Data Responsibility site. You can change your choice anytime on the consent page.
Manage preferences