Technical interview questions & answers

20 technical interview questions with complete model answers. The bank holds 4751 technical questions across every role and company we cover.

TechnicalEasySoftware EngineerHR Screen

1. In a technical screening round, the interviewer asks: What are the differences between an array and a linked list?

The full question

In a technical screening round, the interviewer asks:

What are the differences between an array and a linked list? When would you choose one over the other?

Walk through the differences in memory layout, the cost of the core operations (indexed access, search, insertion, deletion), and memory overhead — then give concrete situations where each data structure is the better choice. Treat this as a short screening question: the interviewer wants a structured, complete answer delivered in a few minutes, not an essay.

Model answer

Differences Between Arrays and Linked Lists

  1. Memory Layout: - Array: - Arrays have a contiguous memory layout. This means all elements are stored in adjacent memory locations. - This allows for efficient indexed access as the address of any element can be calculated using its index. - Linked List: - Linked lists have a non-contiguous memory layout. Each element (node) contains a reference (or pointer) to the next node. - This results in a dynamic memory allocation, allowing for flexible memory usage but at the cost of increased memory overhead due to pointers.
  2. Cost of Core Operations: - Indexed Access: - Array: O(1) time complexity. Direct access using indices is possible. - Linked List: O(n) time complexity. Requires traversal from the head node to the desired index. - Search: - Both arrays and linked lists have O(n) time complexity for searching an element as each element might need to be checked. - Insertion: - Array: O(n) time complexity. Inserting an element requires shifting elements to maintain the contiguous layout. - Linked List: O(1) time complexity if inserting at the head or tail (given a reference). Otherwise, O(n) if inserting at a specific position. - Deletion: - Array: O(n) time complexity. Similar to insertion, elements need to be shifted. - Linked List: O(1) time complexity if deleting the head or tail (given a reference). Otherwise, O(n) if deleting from a specific position.
  3. Memory Overhead: - Array: Minimal overhead as it only stores the elements. - Linked List: Higher overhead due to additional storage for pointers in each node.

When to Choose Each Data Structure

  • Array:
  • Use when you need fast indexed access and know the size of the data set in advance.
  • Ideal for scenarios where memory is a constraint and you need a compact data structure.
  • Example: Implementing a fixed-size buffer or a lookup table where access speed is critical.
  • Linked List:
  • Use when you need frequent insertions and deletions, especially at the beginning or end of the list.
  • Suitable for scenarios where the size of the data set is dynamic and unpredictable.
  • Example: Implementing a queue or stack where elements are frequently added and removed.

Complexity: Arrays offer O(1) indexed access but have O(n) insertion/deletion costs. Linked lists provide O(1) insertion/deletion at the head/tail but have O(n) indexed access and higher memory overhead due to pointers.

TechnicalEasyData ScientistOnsite

2. You are interviewing for a Data Scientist role and are given access to Uber / Uber Eats data.

The full question

You are interviewing for a Data Scientist role and are given access to Uber / Uber Eats data. Answer the following about confounding in causal inference:

  1. Define confounding in the context of estimating causal effects from observational data. Explain what a confounder is and why it can bias an observed relationship between an exposure and an outcome.
  2. Give a concrete Uber-related example (avoid generic demographic examples like age/sex). Your example should clearly identify:
  • the treatment / exposure (X),
  • the outcome (Y), and
  • the confounder (Z) that affects both X and Y.

Explain intuitively the direction of the bias (how it could manufacture a false effect or hide a real one).

  1. Describe at least two practical ways you would detect and/or mitigate confounding in an analysis (in the design or the modeling), and state what assumptions each method requires.

Model answer

1. Define Confounding

Confounding occurs in causal inference when an external variable, known as a confounder, influences both the treatment/exposure and the outcome, potentially leading to a biased estimation of the causal effect. A confounder is a variable that is correlated with both the independent variable (treatment/exposure) and the dependent variable (outcome). This correlation can create a spurious association between the treatment and the outcome, either exaggerating or masking the true causal relationship.

2. Concrete Uber-Related Example

  • Treatment/Exposure (X): The number of promotional discounts offered to drivers.
  • Outcome (Y): The total number of rides completed by drivers.
  • Confounder (Z): Weather conditions.

In this example, weather conditions can act as a confounder because they influence both the number of promotional discounts offered and the number of rides completed. For instance, during bad weather, Uber might increase promotional discounts to encourage drivers to work, while the same weather conditions might naturally lead to more ride requests as people prefer not to walk or drive themselves. This can create a false impression that the promotional discounts alone are causing an increase in rides, when in fact, the weather is influencing both.

Direction of Bias: If not accounted for, the analysis might overestimate the effect of promotional discounts on ride completions, as the increase in rides could be partly due to adverse weather conditions rather than the discounts themselves.

3. Detecting and Mitigating Confounding

  1. Stratification: - Method: Divide the data into strata or groups based on the confounder (e.g., different weather conditions) and analyze the relationship between the exposure and outcome within each stratum. - Assumptions: Assumes that within each stratum, the confounder is evenly distributed, allowing for a clearer view of the causal relationship between the treatment and outcome.
  2. Multivariable Regression: - Method: Include the confounder as a covariate in a regression model to adjust for its effect when estimating the relationship between the exposure and outcome. - Assumptions: Assumes that the relationship between the confounder and both the exposure and outcome is linear and that there are no interactions between the confounder and the exposure.

Both methods aim to isolate the causal effect of the treatment by accounting for the influence of the confounder, thus providing a more accurate estimate of the causal relationship.

TechnicalEasyEngineering Manager

3. Can you describe the details of a project you worked on?

Model answer

I’d choose a project where I can explain the customer or business problem, my personal contribution, the technical decisions, and what changed as a result. Since the surrounding questions are about telecom and FPGA work, here’s an illustrative 5G packet-processing example to adapt—replace the scope, ownership, and metrics with facts from your experience.

  1. Problem and context: “Our team needed to reduce packet-processing latency in a 5G user-plane path while maintaining line-rate throughput. The existing software path was flexible, but profiling showed that a small set of repeated packet operations consumed most of the processing budget.”
  2. My role and goal: State what you personally owned—for example, FPGA data-path design and integration with the software control plane. Describe the constraint: latency, throughput, power, schedule, or compatibility with existing silicon and interfaces.
  3. What I did: - Profiled the end-to-end path and agreed on a baseline, including p50/p99 latency, throughput, resource utilization, and packet-loss rate. - Worked with software, validation, and systems engineers to define the boundary: move stable, compute-intensive packet operations into hardware while leaving policy and configuration in software. - Evaluated alternatives, such as a deeper pipeline versus parallel processing, and explained the impact on latency, timing closure, FPGA resources, and future feature changes. - Built the datapath in stages, added counters and trace points, and validated functional behavior against a software reference model. - Coordinated integration and staged testing, including backpressure, malformed packets, reset behavior, and sustained-load conditions.
  4. Results and learning: Give measured before-and-after outcomes, not just “it was faster”: “At the target load, we improved p99 processing latency by [X% or X μs], sustained [Y Gbps / packets per second], and kept resource use below [Z%].” Also mention the team or product effect—for example, meeting a lab milestone or reducing CPU headroom requirements. Close with what you learned about making performance wins observable and balancing hardware efficiency against software flexibility.

A strong answer distinguishes what the team delivered from what you personally decided or drove. Be prepared to explain one technical trade-off in depth and how you handled disagreement or a schedule risk. Interviewers will listen for a clear baseline, credible ownership, cross-functional execution, and a result tied to product or organizational impact.

TechnicalEasy

4. What is the difference between synchronous and asynchronous programming in JavaScript?

Model answer

Synchronous vs Asynchronous Programming in JavaScript

  1. Synchronous Programming: - In synchronous programming, tasks are executed sequentially. Each operation must complete before the next one begins. - This approach is straightforward and easy to understand, as the code executes in the order it is written. - However, synchronous programming can lead to blocking, where a long-running operation (like a network request or file I/O) halts the execution of subsequent code until it completes.
  2. Asynchronous Programming: - Asynchronous programming allows tasks to be initiated and then paused, enabling other operations to run in the meantime. - JavaScript uses the event loop to handle asynchronous operations, allowing non-blocking execution. - Common asynchronous patterns include callbacks, promises, and async/await. These enable handling operations like API requests or timers without freezing the main thread.
  3. Key Differences: - Execution Flow: Synchronous code runs in a single sequence, while asynchronous code can be paused and resumed, allowing other code to execute in the meantime. - Blocking vs Non-blocking: Synchronous operations block the execution of further code until they complete. Asynchronous operations do not block and allow the program to continue running other tasks. - Use Cases: Synchronous programming is suitable for simple, quick tasks. Asynchronous programming is essential for tasks that involve waiting, such as network requests or database queries, to maintain application responsiveness.
  4. Example in JavaScript:
   // Synchronous example
   console.log('Start');
   for (let i = 0; i < 1000000000; i++) {} // Simulating a time-consuming task
   console.log('End');

   // Asynchronous example
   console.log('Start');
   setTimeout(() => {
     console.log('End');
   }, 1000); // Non-blocking, executes after 1 second
  • In the synchronous example, the loop blocks the execution until it completes.
  • In the asynchronous example, setTimeout allows the program to continue running, and 'End' is logged after 1 second without blocking other operations.

Complexity:

  • Time Complexity: Synchronous operations can lead to increased time complexity due to blocking. Asynchronous operations can improve perceived performance by allowing other tasks to proceed.
  • Space Complexity: Both approaches can have similar space complexity, but asynchronous programming may require additional memory for managing callbacks, promises, or async/await state.
TechnicalEasyData ScientistTechnical screen

5. Facebook has a content team that labels pieces of content on the platform as spam or not spam.

The full question

Facebook has a content team that labels pieces of content on the platform as spam or not spam. 90% of them are diligent raters and will label 20% of the content as spam and 80% as non-spam. The remaining 10% are non-diligent raters and will label 0% of the content as spam and 100% as non-spam. Assume the pieces of content are labeled independently from one another, for every rater. Given that a rater has labeled 4 pieces of content as good, what is the probability that they are a diligent rater?

Model answer

The flow

  1. Identify the distributions: Recognize the problem as a Bayesian probability question.
  2. Write the formula: Use Bayes' Theorem to calculate the desired probability.
  3. Compute the likelihoods: Calculate the probability of the observed data given each type of rater.
  4. Apply Bayes' Theorem: Substitute the known probabilities into the formula.
  5. Compute the posterior probability: Solve for the probability that the rater is diligent given the observed data.
  6. Interpret the result: Discuss implications and limitations of the result.

The answer

1. Identify the distributions

  • We have two types of raters: diligent and non-diligent.
  • Diligent raters label 20% as spam and 80% as non-spam.
  • Non-diligent raters label 0% as spam and 100% as non-spam.

2. Write the formula

  • We use Bayes' Theorem: $$ P(D | G) = \frac{P(G | D) \cdot P(D)}{P(G)} $$ where:
  • $P(D | G)$ is the probability that the rater is diligent given 4 pieces labeled as good.
  • $P(G | D)$ is the probability of labeling 4 pieces as good given the rater is diligent.
  • $P(D)$ is the prior probability of a rater being diligent.
  • $P(G)$ is the total probability of labeling 4 pieces as good.

3. Compute the likelihoods

  • $P(G | D) = (0.8)^4 = 0.4096$
  • $P(G | \neg D) = (1)^4 = 1$

4. Apply Bayes' Theorem

  • $P(D) = 0.9$, the probability of a rater being diligent.
  • $P(\neg D) = 0.1$, the probability of a rater being non-diligent.
  • $P(G) = P(G | D) \cdot P(D) + P(G | \neg D) \cdot P(\neg D)$ $$ P(G) = 0.4096 \cdot 0.9 + 1 \cdot 0.1 = 0.46864 $$

5. Compute the posterior probability

  • Substitute into Bayes' Theorem: $$ P(D | G) = \frac{0.4096 \cdot 0.9}{0.46864} \approx 0.786 $$

6. Interpret the result

  • The probability that the rater is diligent given they labeled 4 pieces as good is approximately 78.6%.
  • This high probability suggests that labeling all pieces as good is more likely done by a diligent rater.
  • The assumption of independence and the specific labeling behavior of raters are crucial for this result.

Why this works

  • Testing Bayesian reasoning: The question assesses understanding of Bayes' Theorem and its application.
  • Sanity check: A strong answer checks the reasonableness of the result (e.g., high probability aligns with diligent behavior).
  • Common pitfalls: Weak answers might ignore the prior probabilities or miscalculate likelihoods, leading to incorrect conclusions.
  • Assumptions clarity: A strong answer clearly states assumptions, like independence of labels and fixed rater behavior.
TechnicalEasy

6. What are the main principles of functional programming, and how would you apply them in Clojure?

Model answer

Main Principles of Functional Programming

  1. Immutability: - Data is immutable, meaning once created, it cannot be changed. This leads to safer and more predictable code, as functions cannot alter the state of the data they work with.
  2. First-Class and Higher-Order Functions: - Functions are first-class citizens and can be passed as arguments, returned from other functions, and assigned to variables. Higher-order functions are those that take other functions as arguments or return them.
  3. Pure Functions: - Functions that always produce the same output for the same input and have no side effects. This makes reasoning about code easier and enables optimizations like memoization.
  4. Function Composition: - Building complex functions by combining simpler ones. This promotes code reuse and modularity.
  5. Lazy Evaluation: - Evaluation of expressions is delayed until their values are needed, which can improve performance by avoiding unnecessary calculations.
  6. Declarative Programming: - Focuses on what to solve rather than how to solve it, leading to more readable and concise code.

Applying Functional Programming Principles in Clojure

  • Immutability:
  • Clojure emphasizes immutability by default. Data structures like lists, vectors, maps, and sets are immutable. You can use assoc, conj, and similar functions to create new versions of data structures without altering the original.
  • First-Class and Higher-Order Functions:
  • Clojure treats functions as first-class citizens. You can pass functions as arguments using higher-order functions like map, reduce, and filter.
  • Pure Functions:
  • Clojure encourages writing pure functions. For example, a function that calculates the sum of a list should not modify the list or rely on external state.
  • Function Composition:
  • Use the comp function to compose multiple functions. For instance, (comp f g h) creates a new function that applies h, then g, and finally f.
  • Lazy Evaluation:
  • Clojure supports lazy sequences, which are evaluated only when needed. You can use functions like lazy-seq or for to create lazy collections.
  • Declarative Programming:
  • Clojure's syntax and functional approach encourage a declarative style. Instead of loops, you often use higher-order functions to express operations on collections.

By adhering to these principles, Clojure allows developers to write concise, robust, and maintainable code that leverages the strengths of functional programming.

TechnicalEasy

7. What is the difference between a stack and a queue?

The full question

What is the difference between a stack and a queue? Can you provide a simple implementation in Python?

Model answer

Difference between a Stack and a Queue

  • Stack:
  • A stack is a linear data structure that follows the Last In First Out (LIFO) principle.
  • The last element added to the stack is the first one to be removed.
  • Common operations include push (to add an item) and pop (to remove an item).
  • Use cases include undo mechanisms in text editors, parsing expressions, and backtracking algorithms.
  • Queue:
  • A queue is a linear data structure that follows the First In First Out (FIFO) principle.
  • The first element added to the queue is the first one to be removed.
  • Common operations include enqueue (to add an item) and dequeue (to remove an item).
  • Use cases include task scheduling, breadth-first search algorithms, and handling requests in servers.

Simple Implementation in Python

# Stack implementation using a list
class Stack:
    def __init__(self):
        self.items = []

    def push(self, item):
        self.items.append(item)

    def pop(self):
        if not self.is_empty():
            return self.items.pop()
        raise IndexError("pop from empty stack")

    def is_empty(self):
        return len(self.items) == 0

    def peek(self):
        if not self.is_empty():
            return self.items[-1]
        raise IndexError("peek from empty stack")

# Queue implementation using a list
class Queue:
    def __init__(self):
        self.items = []

    def enqueue(self, item):
        self.items.append(item)

    def dequeue(self):
        if not self.is_empty():
            return self.items.pop(0)
        raise IndexError("dequeue from empty queue")

    def is_empty(self):
        return len(self.items) == 0

    def peek(self):
        if not self.is_empty():
            return self.items[0]
        raise IndexError("peek from empty queue")
  • Stack:
  • Uses a list to store elements.
  • push adds an element to the end of the list.
  • pop removes the last element from the list.
  • peek retrieves the last element without removing it.
  • Queue:
  • Uses a list to store elements.
  • enqueue adds an element to the end of the list.
  • dequeue removes the first element from the list.
  • peek retrieves the first element without removing it.

Complexity:

  • Time: Both stack and queue operations (push, pop, enqueue, dequeue) have O(1) average time complexity. However, dequeue in this simple queue implementation has O(n) time complexity due to list shifting.
  • Space: O(n) for both stack and queue, where n is the number of elements stored.
TechnicalEasyEngineering Manager

8. Are you still hands-on technically?

Model answer

Short answer: Yes, but I am intentional about where I spend technical time. As an Engineering Manager, I want enough hands-on depth to challenge assumptions, understand operational risk, and help the team make good decisions; I should not become the default implementer or create a bottleneck.

  1. Set the boundary. I stay close to design reviews, incident reviews, architecture decisions, and selected prototypes. I generally avoid owning delivery-critical code because the team needs clear engineering ownership and my management responsibilities require time for coaching, hiring, planning, and cross-team work.
  2. Use hands-on work where it has leverage. I might prototype an unfamiliar integration, inspect a performance trace, or write a small diagnostic query to test an assumption. I make the purpose and timebox explicit, then hand production ownership to the engineer responsible for that area.
  3. Maintain technical credibility. I read key design docs, follow system health dashboards, join code or incident discussions when useful, and ask concrete questions about failure modes, data consistency, and operational load. I do not pretend to know details I have not investigated.
  4. Protect team autonomy. I use questions and options rather than quietly rewriting code or imposing a preferred design. When I do contribute, I explain the context and invite review from the accountable engineer.
  5. Adjust to the team’s needs. In a new or high-risk domain, I may spend more time understanding the system. With strong technical leads and stable services, I can invest more time in scaling people and organizational effectiveness.
flowchart TD
  A["Identify technical uncertainty or risk"] --> B{"Would direct exploration unblock a decision?"}
  B -->|"Yes"| C["Timebox a prototype or investigation"]
  C --> D["Share evidence and trade-offs"]
  D --> E["Return implementation ownership to the team"]
  B -->|"No"| F["Coach the accountable engineer"]
  E --> G["Review outcomes and system health"]
  F --> G
Diagram

How I would measure whether the balance is right: Are teams making sound decisions without waiting for me? Are delivery predictability, quality, and incident response improving? Is my time going to work that only an EM can do—developing people, resolving organizational constraints, and aligning teams?

What interviewers listen for

  • Technical curiosity and credibility without micromanagement.
  • Clear boundaries around ownership and time.
  • A practical understanding that the right hands-on level changes with context.
TechnicalEasy

9. What are the key features of Next.js and how does it improve performance for web applications?

Model answer

Key Features of Next.js

  1. Server-Side Rendering (SSR): - Next.js allows pages to be rendered on the server, which can improve the time to first byte (TTFB) and enhance SEO by delivering fully rendered pages to crawlers.
  2. Static Site Generation (SSG): - With SSG, pages are pre-rendered at build time and served as static HTML, which can significantly reduce load times and improve performance by serving cached content.
  3. Automatic Code Splitting: - Next.js automatically splits code at the page level, ensuring that only the necessary JavaScript is loaded for each page, reducing the initial load time.
  4. Client-Side Routing: - Utilizes a lightweight client-side router that prefetches linked pages, allowing for faster navigation between pages without full page reloads.
  5. Built-in CSS and Sass Support: - Next.js supports importing CSS and Sass files directly into JavaScript files, simplifying the styling process and reducing the need for additional configuration.
  6. Image Optimization: - Provides automatic image optimization, serving images in modern formats and sizes that are suitable for the user’s device, reducing load times.
  7. API Routes: - Allows the creation of API endpoints within the Next.js application, enabling serverless functions that can handle backend logic without additional infrastructure.
  8. Incremental Static Regeneration (ISR): - Allows static pages to be updated after the initial build without a full rebuild, providing the benefits of static generation with the ability to update content.

How Next.js Improves Performance

  • Reduced Load Times:
  • By leveraging SSR and SSG, Next.js reduces the time it takes for a page to load by serving pre-rendered content, which is faster than generating content on the client side.
  • Efficient Resource Loading:
  • Automatic code splitting and prefetching ensure that only the necessary resources are loaded, reducing the amount of data transferred and speeding up page transitions.
  • Optimized Rendering:
  • SSR and SSG optimize rendering by reducing the workload on the client, leading to faster initial page loads and improved user experience.
  • Enhanced SEO:
  • Pre-rendered pages improve SEO by ensuring that search engines can crawl and index content effectively, leading to better visibility and ranking.

Complexity:

  • Time Complexity: O(n) for rendering n pages, where n is the number of pages being served.
  • Space Complexity: O(n) for storing pre-rendered pages and assets in cache.
TechnicalEasyEngineering Manager

10. Describe what a typical workday looks like.

Model answer

I would describe a typical day as a balance between creating focus for the team and staying close enough to delivery and technical risk to make good decisions. The exact calendar changes with the team's stage, but I try to avoid turning the day into a sequence of status meetings.

  1. Start with signals and priorities. I review production health, on-call issues, delivery milestones, and team capacity. I look for exceptions—an SLO burn, a blocked dependency, or a project at risk—rather than asking everyone to restate a dashboard. I then decide what needs my attention and what the team can resolve independently.
  2. Protect maker time. I keep recurring meetings clustered where possible. In stand-up or async updates, I focus on coordination and blockers, not individual reporting. If two teams disagree on an interface or priority, I help get the decision made quickly and record the owner and next step.
  3. Spend time with people. One-on-ones are for coaching, feedback, career development, and understanding workload—not project status alone. I also make time for design reviews and pairing with leads when a decision has meaningful reliability, security, or long-term ownership consequences. I do not need to make every technical choice; I need to ensure the right people and trade-offs are involved.
  4. Manage execution and stakeholders. I check whether scope, dependencies, and staffing still match the plan. I communicate material changes early, with options and implications, rather than presenting a surprise at the deadline. I reserve time for hiring, cross-team planning, and improving how the group works.
  5. Close the loop. Before finishing, I capture decisions, owners, and risks, and check that urgent customer or operational issues have a clear path. If the day was dominated by interrupts, I look for the underlying cause and whether we need better ownership, automation, or an incident follow-up.

A useful pattern is:

flowchart LR
  S[Review signals] --> P[Set priorities]
  P --> F[Protect team focus]
  F --> D[Unblock decisions]
  D --> C[Coach and communicate]
  C --> R[Review outcomes and risks]
  R --> S
Diagram

The leadership test is whether my involvement increases team clarity and autonomy. I track outcomes such as delivery predictability, escaped defects, SLO performance, time spent on unplanned work, and team health—not how many meetings I attended. I also adjust the cadence: during an incident, customer impact takes priority; during a stable execution period, I protect deeper planning and development time.

TechnicalEasyData ScientistTechnical Screen

11. You are analyzing repeated flips of a (possibly unfair) coin.

The full question

You are analyzing repeated flips of a (possibly unfair) coin.

Setup

Let the probability of Heads be (p) (unknown in general). Assume flips are independent and identically distributed.

Part A — Expected value for an unfair coin

Define a random variable (X) for a single flip:

  • (X = 1) if the flip is Heads
  • (X = 0) if the flip is Tails
  1. Compute (\mathbb{E}[X]).
  2. (Optional but common follow-up) Compute (\mathrm{Var}(X)).

Part B — “Getting a 3” using a geometric distribution

Now flip the coin repeatedly until the first Head appears.

Let (T) be the number of flips needed to get the first Head (so (T\in{1,2,3,\dots})).

  1. Write the distribution of (T) and identify it.
  2. Compute (\mathbb{P}(T=3)) in terms of (p).
  3. For a fair coin ((p=0.5)), compute the numerical value of (\mathbb{P}(T=3)).
  4. Compute (\mathbb{E}[T]).

Part C — Is the coin fair? (p-value reasoning)

Suppose you ran this “flip-until-first-Head” experiment once and observed (T=3).

You want to test:

  • (H_0: p=0.5) (fair coin)
  • (H_1: p<0.5) (coin is biased toward Tails; Heads are rarer)
  1. Propose a reasonable p-value for this one observation using an appropriate tail probability under (H_0).
  2. Briefly explain what is and is not learnable from a single observation, and what you would do instead to make the test meaningful (e.g., repeat the experiment (n) times).

Model answer

Part A — Expected value for an unfair coin

  1. Compute \(\mathbb{E}[X]\):
  • The expected value \(\mathbb{E}[X]\) for a random variable \(X\) that takes the value 1 with probability \(p\) (Heads) and 0 with probability \(1-p\) (Tails) is calculated as follows: \[ \mathbb{E}[X] = 1 \cdot p + 0 \cdot (1-p) = p \]
  1. Compute \(\mathrm{Var}(X)\):
  • The variance \(\mathrm{Var}(X)\) of a random variable \(X\) is given by: \[ \mathrm{Var}(X) = \mathbb{E}[X^2] - (\mathbb{E}[X])^2 \]
  • Since \(X^2 = X\) (because \(X\) is either 0 or 1), we have: \[ \mathbb{E}[X^2] = \mathbb{E}[X] = p \]
  • Therefore, the variance is: \[ \mathrm{Var}(X) = p - p^2 = p(1-p) \]

Part B — “Getting a 3” using a geometric distribution

  1. Distribution of \(T\):
  • \(T\) follows a geometric distribution with parameter \(p\), denoted as \(T \sim \text{Geom}(p)\). This distribution models the number of Bernoulli trials needed to get the first success (Head).
  1. Compute \(\mathbb{P}(T=3)\):
  • The probability that the first Head appears on the third flip is: \[ \mathbb{P}(T=3) = (1-p)^2 \cdot p \]
  1. For a fair coin (\(p=0.5\)), compute \(\mathbb{P}(T=3)\):
  • Substituting \(p = 0.5\) into the probability formula: \[ \mathbb{P}(T=3) = (1-0.5)^2 \cdot 0.5 = 0.25 \cdot 0.5 = 0.125 \]
  1. Compute \(\mathbb{E}[T]\):
  • The expected value of a geometric distribution \(\text{Geom}(p)\) is: \[ \mathbb{E}[T] = \frac{1}{p} \]

Part C — Is the coin fair? (p-value reasoning)

  1. Propose a reasonable p-value:
  • To test \(H_0: p=0.5\) against \(H_1: p<0.5\), we calculate the tail probability under \(H_0\) for observing \(T=3\) or more: \[ \mathbb{P}(T \geq 3) = \sum_{k=3}^{\infty} \mathbb{P}(T=k) = (1-0.5)^2 = 0.25 \]
  • This probability represents the p-value for the test.
  1. Explanation and further steps:
  • What is learnable: From a single observation, we can only compute a p-value, which indicates how extreme the observation is under the null hypothesis. However, it does not provide conclusive evidence about the fairness of the coin.
  • What to do instead: To make the test meaningful, repeat the experiment \(n\) times to gather more data. Calculate the proportion of trials where \(T=3\) or more, and use this empirical distribution to perform a more robust hypothesis test. This approach increases the statistical power of the test and provides a more reliable conclusion.
TechnicalEasy

12. What is the difference between synchronous and asynchronous programming, and when would you use each?

Model answer

Synchronous vs. Asynchronous Programming

Synchronous Programming:

  • Definition: In synchronous programming, tasks are executed sequentially. Each task must complete before the next one begins.
  • Use Case: Best suited for operations where tasks are dependent on the results of previous tasks. For example, reading a file from disk and then processing its contents.
  • Example: Traditional procedural programming where each line of code is executed one after the other.
  • Pros:
  • Simplicity: Easier to read and understand since the flow of execution is straightforward.
  • Predictability: Easier to debug because of the linear execution flow.
  • Cons:
  • Blocking: Can lead to performance bottlenecks, especially in I/O operations, as the program waits for each task to complete.

Asynchronous Programming:

  • Definition: In asynchronous programming, tasks can be executed concurrently. A task can start before the previous one completes, and the program can continue executing other tasks while waiting for the previous ones to finish.
  • Use Case: Ideal for I/O-bound operations, such as network requests or file system operations, where tasks can take an unpredictable amount of time to complete.
  • Example: Using callbacks, promises, or async/await in JavaScript to handle asynchronous operations.
  • Pros:
  • Non-blocking: Improves application responsiveness and performance by allowing other operations to proceed while waiting for a task to complete.
  • Scalability: Better suited for applications that need to handle a large number of concurrent operations, such as web servers.
  • Cons:
  • Complexity: Can be more challenging to write and maintain due to the non-linear flow of execution.
  • Debugging: More difficult to trace and debug due to the concurrency and potential race conditions.

When to Use Each

  • Synchronous:
  • Use when tasks are short-lived and need to be executed in a specific order.
  • Suitable for CPU-bound tasks where operations are computationally intensive and do not involve waiting for external resources.
  • Asynchronous:
  • Use for I/O-bound tasks where operations involve waiting for external resources, like network requests or database queries.
  • Suitable for applications requiring high concurrency and responsiveness, such as web servers or real-time applications.

Understanding the difference between synchronous and asynchronous programming is crucial for optimizing application performance and ensuring that the right approach is used for the right task.

TechnicalEasyDevOps / SRE

13. What is Infrastructure as Code (IaC) and why is it important?

Model answer

What is Infrastructure as Code (IaC) and why is it important?

Infrastructure as Code (IaC) is a modern approach to managing and provisioning computing infrastructure through machine-readable definition files, rather than physical hardware configuration or interactive configuration tools. This concept allows developers and operations teams to automate the setup and management of infrastructure using code.

Key aspects of IaC include:

  1. Automation: IaC enables the automation of infrastructure provisioning and management. This reduces manual errors, speeds up deployment processes, and ensures consistency across environments.
  2. Version Control: By treating infrastructure as code, teams can use version control systems (such as Git) to track changes, collaborate, and roll back to previous versions if needed. This aligns infrastructure management with software development practices.
  3. Consistency and Reproducibility: IaC ensures that environments are consistent and can be reproduced easily. This is crucial for development, testing, and production environments to behave identically, reducing the "it works on my machine" problem.
  4. Scalability: IaC facilitates scaling infrastructure up or down based on demand. Automated scripts can quickly provision additional resources or decommission them as needed.
  5. Cost Efficiency: By automating infrastructure management, IaC can lead to cost savings through optimized resource usage and reduced need for manual intervention.
  6. Collaboration and Documentation: Infrastructure code serves as documentation, making it easier for teams to understand and collaborate on infrastructure changes.

Importance of IaC

  • Speed and Agility: IaC allows for rapid deployment and iteration, enabling teams to respond quickly to changes in business requirements or demand.
  • Risk Reduction: Automated and consistent infrastructure reduces the risk of human error, which can lead to downtime or security vulnerabilities.
  • Enhanced Testing and Deployment: IaC integrates well with CI/CD pipelines, allowing for automated testing and deployment of infrastructure changes alongside application code.
  • Disaster Recovery: IaC scripts can be used to quickly rebuild infrastructure in case of a failure, improving disaster recovery capabilities.

In summary, Infrastructure as Code is a transformative approach that aligns infrastructure management with modern software development practices, offering significant benefits in terms of automation, consistency, and efficiency.

TechnicalEasyEngineering Manager

14. What is the difference between HTTP and HTTPS, and how does the transition from HTTP to HTTPS affect network security appliances?

Model answer

1. Protocol difference

  • HTTP sends application data in plaintext. Anyone able to observe the network path may read or alter it, and the client has no built-in way to verify the server’s identity.
  • HTTPS is HTTP carried over TLS. TLS negotiates encryption keys, protects data integrity, and authenticates the server using a certificate. HTTPS typically uses TCP port 443; HTTP typically uses port 80. HTTP/3 carries HTTP over QUIC, which also uses TLS and commonly uses UDP port 443.
  • HTTPS protects traffic in transit, but it does not make a compromised endpoint, malicious application, or insecure server safe.

2. Effect on security appliances

flowchart LR
  C[Client] -->|TLS session| A[Security appliance]
  A -->|TLS session| S[HTTPS server]
  C -.->|Without inspection: encrypted payload| S
Diagram
  • Without TLS inspection, a firewall or IDS can generally inspect network metadata—such as IPs, ports, and connection timing—but not the encrypted HTTP paths, headers, or body. This can reduce the effectiveness of URL filtering, malware scanning, and application-layer rules.
  • With TLS inspection, a proxy or gateway terminates the client’s TLS connection, inspects the decrypted request, then establishes a separate TLS connection to the server. Managed clients must trust the enterprise inspection CA. The appliance needs adequate capacity, certificate and key management, and clear privacy controls.
  • Inspection can fail or cause application issues with certificate pinning, mutual TLS, unsupported TLS versions, or clients that do not trust the enterprise CA. Encrypted Client Hello can also limit visibility into the requested hostname. QUIC may bypass TCP-based inspection unless the appliance supports QUIC inspection or policy blocks it.
  • TLS inspection creates a sensitive plaintext boundary. I would define exceptions for regulated or sensitive traffic, restrict access to decrypted data, and monitor appliance CPU, memory, session capacity, and TLS handshake failures.

3. Transition considerations

  • Inventory applications, clients, certificates, and appliances; test representative traffic before changing policy.
  • Validate certificate trust, TLS versions, cipher support, SNI and DNS behavior, and fallback or exception policies.
  • Roll out by pilot group, monitor handshake errors, application failures, latency, and inspection capacity, then expand with a rollback plan.
  • Measure both security outcomes and user impact: blocked threats or policy violations, TLS failure rate, and p95 connection latency.
TechnicalEasy

15. What is the difference between synchronous and asynchronous programming?

Model answer

Synchronous vs. Asynchronous Programming

  1. Synchronous Programming: - In synchronous programming, tasks are executed sequentially. Each operation must complete before the next one starts. - This approach is straightforward and easy to understand because it follows a linear execution path. - However, it can lead to inefficiencies, especially when tasks involve waiting for external resources (e.g., network requests, file I/O), as the entire program can be blocked until the current task completes.
  2. Asynchronous Programming: - Asynchronous programming allows tasks to run independently of the main program flow, enabling other operations to continue while waiting for the completion of a task. - This is achieved using constructs like callbacks, promises, or async/await in JavaScript, which allow the program to handle tasks that may take an indeterminate amount of time without blocking the execution of other code. - Asynchronous programming is particularly useful in I/O-bound applications, where tasks like network requests or file operations can be performed without halting the execution of other parts of the program.
  3. Key Differences: - Execution Flow: Synchronous programming follows a linear execution, while asynchronous programming allows for concurrent task execution. - Blocking: Synchronous operations block the execution of subsequent tasks until completion, whereas asynchronous operations do not block and allow other tasks to proceed. - Use Cases: Synchronous programming is suitable for CPU-bound tasks where operations depend on the result of the previous one. Asynchronous programming is ideal for I/O-bound tasks where waiting for external resources is common.
  4. Practical Example in JavaScript: - Synchronous: ``javascript function syncTask() { console.log("Task 1"); console.log("Task 2"); } syncTask(); console.log("Task 3"); // Output: Task 1, Task 2, Task 3 ``
  • Asynchronous: ``javascript function asyncTask() { console.log("Task 1"); setTimeout(() => { console.log("Task 2"); }, 1000); } asyncTask(); console.log("Task 3"); // Output: Task 1, Task 3, Task 2 ``

Complexity:

  • Time Complexity: Depends on the specific tasks being executed; asynchronous programming can reduce perceived execution time by allowing other operations to proceed.
  • Space Complexity: Generally similar for both, but asynchronous programming may require additional memory for managing callbacks or promises.
TechnicalEasyData Science Manager

16. What do you know about cryptocurrency?

Model answer

What cryptocurrency is

Cryptocurrency is a digital asset whose ownership and transactions are recorded on a cryptographic ledger. Many cryptocurrencies use a blockchain: a replicated, append-only data structure in which network participants agree on the order and validity of transactions. Bitcoin, for example, uses proof of work; Ethereum uses proof of stake and also supports programmable smart contracts.

How it works

  1. A user signs a transaction with a private key. The signature proves authorization without revealing the key.
  2. The transaction is broadcast to a peer-to-peer network and checked against protocol rules, such as whether the sender has sufficient funds.
  3. Validators or miners order valid transactions into blocks. A consensus mechanism determines which history the network accepts.
  4. Nodes update their local ledger, and the transaction gains confidence as more blocks build on it. Finality guarantees vary by protocol.
flowchart TD
  U[User signs transaction] --> N[Network validates transaction]
  N --> C[Consensus orders transactions]
  C --> B[Block added to ledger]
  B --> R[Nodes replicate updated state]
Diagram

Important distinctions and trade-offs

  • Coins and tokens: A coin is native to a blockchain; a token is typically issued through a smart contract on an existing chain.
  • Stablecoins: Tokens designed to track an asset such as the US dollar. Their stability depends on the reserve, redemption, and governance model.
  • Decentralization vs. performance: Greater openness and distributed control can come with lower throughput, slower finality, or more complex coordination than a centralized database.
  • Custody and security: Users control assets through private keys, directly or via a custodian. Lost keys, compromised contracts, and operational mistakes can be hard to reverse.
  • Risks: Price volatility, fraud, regulatory uncertainty, smart-contract vulnerabilities, and uneven consumer protections are material considerations.

Data science perspective

I would distinguish measurable network activity from economic value. Useful measures can include active addresses, transaction count and value, fees, settlement time, concentration of holdings, and protocol-specific measures such as staking participation. These need careful interpretation: one person can control many addresses, bots can inflate activity, and on-chain transactions do not necessarily represent distinct users or economic demand. I would combine on-chain data with market, product, and user research, define clear denominators, and treat causal claims cautiously.

TechnicalEasy

17. What are the key differences between SQL and NoSQL databases, and when would you choose one over the other?

Model answer

Key Differences Between SQL and NoSQL Databases

  1. Data Model: - SQL Databases: Use a structured data model with tables, rows, and columns. They enforce relationships using foreign keys and are ideal for structured, relational data. - NoSQL Databases: Offer a flexible schema, supporting various data models such as document, key-value, column-family, and graph. They are suitable for unstructured or semi-structured data.
  2. Query Language: - SQL Databases: Utilize Structured Query Language (SQL) for defining and manipulating data. SQL is powerful for complex queries and data analysis. - NoSQL Databases: Typically use a variety of query languages specific to the database type, which may be less complex than SQL but more flexible for certain data retrieval patterns.
  3. ACID vs. BASE: - SQL Databases: Provide ACID (Atomicity, Consistency, Isolation, Durability) properties, ensuring reliable transactions and consistency. - NoSQL Databases: Often follow the BASE (Basically Available, Soft state, Eventually consistent) model, which allows for greater flexibility and scalability at the cost of immediate consistency.
  4. Scalability: - SQL Databases: Generally scale vertically by increasing the power of a single server. Horizontal scaling (sharding) is possible but complex. - NoSQL Databases: Designed for horizontal scaling, distributing data across multiple servers, which makes them suitable for large-scale applications with high throughput.
  5. Use Cases: - SQL Databases: Best for applications requiring complex queries, transactions, and structured data, such as financial systems and enterprise applications. - NoSQL Databases: Ideal for applications with large volumes of unstructured data, requiring high availability and scalability, such as social media platforms and real-time analytics.

When to Choose SQL vs. NoSQL

  • Choose SQL When:
  • The data is structured and relational.
  • Transactions require strong consistency.
  • Complex queries and reporting are needed.
  • The schema is well-defined and unlikely to change frequently.
  • Choose NoSQL When:
  • The application needs to handle large volumes of unstructured or semi-structured data.
  • High scalability and availability are priorities.
  • The schema is dynamic or evolving.
  • The application can tolerate eventual consistency.

Complexity:

  • SQL Databases: Complexity arises in scaling and managing schema changes.
  • NoSQL Databases: Complexity involves ensuring data consistency and managing distributed systems.
TechnicalEasy

18. What is a REST API and how does it differ from SOAP?

Model answer

REST API vs. SOAP

  1. Definition of REST API: - REST (Representational State Transfer) is an architectural style for designing networked applications. It relies on a stateless, client-server communication protocol, typically HTTP. - REST APIs use standard HTTP methods like GET, POST, PUT, DELETE to perform CRUD (Create, Read, Update, Delete) operations. - They are designed to be simple, scalable, and stateless, making them ideal for web services that require high performance and reliability.
  2. Definition of SOAP: - SOAP (Simple Object Access Protocol) is a protocol for exchanging structured information in web services using XML. - SOAP is designed to be platform-independent and language-neutral, allowing for communication between applications on different operating systems. - It includes built-in error handling and supports WS-Security for secure message exchanges.
  3. Key Differences: - Protocol and Format: - REST uses HTTP and supports multiple formats like JSON, XML, HTML, and plain text, with JSON being the most common due to its lightweight nature. - SOAP strictly uses XML for message format and relies on HTTP or SMTP for message negotiation and transmission.
  • Complexity:
  • REST is generally simpler and easier to implement, as it leverages standard HTTP methods and is more lightweight.
  • SOAP is more complex due to its extensive standards and requires parsing XML, which can be more resource-intensive.
  • Statefulness:
  • REST is stateless, meaning each request from a client contains all the information needed to process the request.
  • SOAP can be either stateless or stateful, depending on the implementation.
  • Security:
  • REST can use HTTPS for secure communication but does not have built-in security features.
  • SOAP has built-in security features like WS-Security, which provides end-to-end security.
  • Use Cases:
  • REST is preferred for web services where simplicity, scalability, and performance are priorities, such as mobile and web applications.
  • SOAP is often used in enterprise environments where security, ACID compliance, and formal contracts are required, such as in financial services.
  1. Conclusion: - REST APIs are favored for their simplicity, scalability, and ease of integration with web technologies. - SOAP is chosen for applications that require robust security and transactional reliability.

Understanding these differences helps in selecting the appropriate protocol based on the specific needs of the application and its environment.

TechnicalEasy

19. What are the key differences between Redis and traditional relational databases?

Model answer

Key Differences Between Redis and Traditional Relational Databases

  1. Data Model: - Redis: Primarily a key-value store, Redis supports various data structures like strings, hashes, lists, sets, and sorted sets. It is designed for specific use cases like caching, session management, and real-time analytics. - Relational Databases: Use a structured data model with tables, rows, and columns, supporting complex queries and relationships between tables through SQL.
  2. Performance and Speed: - Redis: Known for its high speed due to in-memory storage, making it ideal for applications requiring low latency and high throughput, such as handling 1M requests/second. - Relational Databases: Generally slower compared to Redis because they are disk-based, which can introduce latency, especially for write-heavy operations.
  3. Scalability: - Redis: Supports horizontal scaling through sharding, allowing it to handle large volumes of data and high request rates efficiently. - Relational Databases: Traditionally scale vertically by adding more resources to a single server, though modern implementations support horizontal scaling through techniques like sharding.
  4. Consistency and Transactions: - Redis: Offers eventual consistency and supports transactions with its MULTI/EXEC commands, but lacks the full ACID compliance of traditional databases. - Relational Databases: Provide strong consistency and full ACID transactions, ensuring data integrity and reliability, which is crucial for applications requiring complex transactions.
  5. Use Cases: - Redis: Best suited for use cases like caching, real-time analytics, message brokering, and rate limiting, where speed and simplicity are prioritized. - Relational Databases: Ideal for applications requiring complex querying, data integrity, and relationships, such as enterprise resource planning (ERP) and customer relationship management (CRM) systems.
  6. Data Persistence: - Redis: Offers various persistence options, including RDB snapshots and AOF logs, but is primarily an in-memory store, which can lead to data loss if not configured properly. - Relational Databases: Persist data on disk by default, ensuring durability and minimizing the risk of data loss.

In summary, Redis excels in scenarios demanding high speed and scalability with simple data structures, while traditional relational databases are preferred for applications requiring complex queries and strong data integrity.

TechnicalEasySoftware EngineerTechnical Screen

20. Answer the following computer-science fundamentals questions: 1) What are the time complexities (Big-O) of common sorting algorithms (e.g., bubble…

The full question

Answer the following computer-science fundamentals questions:

1) What are the time complexities (Big-O) of common sorting algorithms (e.g., bubble sort, insertion sort, selection sort, merge sort, quicksort, heap sort) in best/average/worst cases?

2) Compare arrays vs. linked lists. What are the time complexities of accessing an element, inserting at the head, and inserting in the middle?

3) Describe the full step-by-step process of inserting an element at the head of a dynamic array (e.g., vector/ArrayList), including what happens when the array needs to grow.

4) What is a hash table? Describe its underlying data structure and how collisions are handled.

5) What is the difference between a “hash table” and a “hash map” (conceptually and, if relevant, in common languages such as Java)?

6) What is the difference between a binary tree and a binary search tree (BST)?

Model answer

1. Sorting Algorithms Time Complexities

  • Bubble Sort:
  • Best: O(n)
  • Average: O(n²)
  • Worst: O(n²)
  • Insertion Sort:
  • Best: O(n)
  • Average: O(n²)
  • Worst: O(n²)
  • Selection Sort:
  • Best: O(n²)
  • Average: O(n²)
  • Worst: O(n²)
  • Merge Sort:
  • Best: O(n log n)
  • Average: O(n log n)
  • Worst: O(n log n)
  • Quicksort:
  • Best: O(n log n)
  • Average: O(n log n)
  • Worst: O(n²)
  • Heap Sort:
  • Best: O(n log n)
  • Average: O(n log n)
  • Worst: O(n log n)

2. Arrays vs. Linked Lists

  • Arrays:
  • Access: O(1)
  • Insert at head: O(n)
  • Insert in middle: O(n)
  • Linked Lists:
  • Access: O(n)
  • Insert at head: O(1)
  • Insert in middle: O(n)

3. Inserting an Element at the Head of a Dynamic Array

  1. Check Capacity: Determine if the array has enough capacity to add a new element.
  2. Grow Array if Needed: - If the array is full, allocate a new array with double the current capacity. - Copy existing elements to the new array.
  3. Shift Elements: Move all elements one position to the right to make space at the head.
  4. Insert Element: Place the new element at the first position.

4. Hash Table

  • Definition: A hash table is a data structure that provides fast insertion, deletion, and lookup operations. It uses a hash function to compute an index into an array of buckets or slots, from which the desired value can be found.
  • Collision Handling:
  • Chaining: Store multiple elements in the same bucket using a linked list.
  • Open Addressing: Find the next available slot using probing methods like linear probing, quadratic probing, or double hashing.

5. Hash Table vs. Hash Map

  • Hash Table:
  • A general term for a data structure that implements an associative array abstract data type, a structure that can map keys to values.
  • Hash Map:
  • A specific implementation of a hash table, typically used in programming languages like Java. It allows null values and keys and is not synchronized.

6. Binary Tree vs. Binary Search Tree (BST)

  • Binary Tree:
  • A tree data structure in which each node has at most two children, referred to as the left child and the right child.
  • Binary Search Tree (BST):
  • A binary tree with an additional property: for each node, all elements in the left subtree are less than the node, and all elements in the right subtree are greater. This property enables efficient searching, insertion, and deletion operations.

Practice these out loud, don't memorise them

Reading an answer is not the same as being able to give one under pressure. ChannelPulse plays the interviewer, asks the follow-ups, and scores each answer with feedback and a model answer so you can hear the gap between what you said and what lands.

Get ChannelPulse Browse all questions