PracHub
QuestionsCoachesLearningGuidesInterview Prep
|Home/Software Engineering Fundamentals/Sunrise

Explain C++ memory, types, and concurrency fundamentals

Last updated: Mar 29, 2026

Quick Overview

Explain C++ memory, types, and concurrency fundamentals evaluates engineering fundamentals, trade-offs, examples, pitfalls, and operational implications in a realistic interview setting. A strong answer states assumptions, handles edge cases, explains trade-offs, and shows how to validate the result clearly.

  • easy
  • Sunrise
  • Software Engineering Fundamentals
  • Software Engineer

Explain C++ memory, types, and concurrency fundamentals

Company: Sunrise

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: easy

Interview Round: Onsite

# Explain C++ memory, types, and concurrency fundamentals Answer the following C++ / systems fundamentals questions: 1) **C++ `class` vs `struct`** - What are the differences between `class` and `struct` in C++? - Can a `class` have a reference (`T&`) as a data member? What are the implications? 2) **Virtual constructor** - Can a constructor be `virtual` in C++? If not, what patterns achieve “polymorphic construction”? 3) **Pointer vs reference** - What are the key differences between pointers and references in C++ (nullability, reseating, object lifetime, ABI, usage)? 4) **Placement new** - What is placement `new`? When would you use it, and what must you do manually after using it? 5) **Performance comparison (cache/memory effects)** - Compare likely performance and CPU/memory behavior of these two loops (assume `data` points to a large `int` array of length `64*1024*1024` allocated on the heap): - Code A: increment `data[0]` in a tight loop `N` times. - Code B: increment `data[i]` for `i = 0; i < N; i += 8`. - Discuss caching, prefetching, write allocation, store buffers, memory bandwidth, and why one might be faster. 6) **Function pointer type** - In `int (*s[10])(int);`, what is the type of `s`? 7) **`unordered_map` vs `map`** - Compare complexity guarantees, ordering, iterator invalidation, memory overhead, and typical use cases. 8) **Overloading vs overriding** - Explain function overloading vs method overriding (virtual dispatch) in C++. 9) **Mutex vs condition variable** - What problems does each solve? Why do condition variables require a mutex and a loop around `wait`? 10) **What causes a physical memory access?** - At a high level, what events force the CPU to access DRAM (vs cache)? Include page faults, TLB misses, cache misses, and DMA. 11) **Shared memory synchronization** - If multiple processes/threads communicate via shared memory, how do you correctly synchronize access? Discuss options (process-shared mutexes, semaphores, futexes, file locks) and pitfalls. 12) **Linux networking and virtualization (high level)** - Describe how a packet travels through the Linux networking stack, and how common virtualization primitives (namespaces, veth pairs, bridges, TAP, iptables/nftables) fit into that path. ### Constraints & Assumptions - Preserve the scope, facts, inputs, and requested outputs from the prompt above. - If the prompt leaves a detail unspecified, state a reasonable assumption before relying on it. - Keep the answer interview-ready: concise enough to present, but concrete enough to implement or evaluate. ### Clarifying Questions to Ask - Clarify language/runtime assumptions and the level of depth expected. - Use examples to connect definitions to practical engineering decisions. - Call out pitfalls, trade-offs, and common misconceptions. ### What a Strong Answer Covers - Accurate definitions and comparisons with concrete examples. - Complexity, lifecycle, safety, or operational implications where relevant. - Trade-offs that explain when one approach is preferable to another. - Common failure modes and how to avoid them. ### Follow-up Questions - How would you debug a production issue related to this topic? - What trade-off would change in a high-throughput service? - Which misconception do candidates often have here?

Quick Answer: Explain C++ memory, types, and concurrency fundamentals evaluates engineering fundamentals, trade-offs, examples, pitfalls, and operational implications in a realistic interview setting. A strong answer states assumptions, handles edge cases, explains trade-offs, and shows how to validate the result clearly.

|Home/Software Engineering Fundamentals/Sunrise

Explain C++ memory, types, and concurrency fundamentals

Sunrise logo
Sunrise
Jul 21, 2025, 12:00 AM
easySoftware EngineerOnsiteSoftware Engineering Fundamentals
1
0

Explain C++ memory, types, and concurrency fundamentals

Answer the following C++ / systems fundamentals questions:

  1. C++ class vs struct
  • What are the differences between class and struct in C++?
  • Can a class have a reference ( T& ) as a data member? What are the implications?
  1. Virtual constructor
  • Can a constructor be virtual in C++? If not, what patterns achieve “polymorphic construction”?
  1. Pointer vs reference
  • What are the key differences between pointers and references in C++ (nullability, reseating, object lifetime, ABI, usage)?
  1. Placement new
  • What is placement new ? When would you use it, and what must you do manually after using it?
  1. Performance comparison (cache/memory effects)
  • Compare likely performance and CPU/memory behavior of these two loops (assume data points to a large int array of length 64*1024*1024 allocated on the heap):
    • Code A: increment data[0] in a tight loop N times.
    • Code B: increment data[i] for i = 0; i < N; i += 8 .
  • Discuss caching, prefetching, write allocation, store buffers, memory bandwidth, and why one might be faster.
  1. Function pointer type
  • In int (*s[10])(int); , what is the type of s ?
  1. unordered_map vs map
  • Compare complexity guarantees, ordering, iterator invalidation, memory overhead, and typical use cases.
  1. Overloading vs overriding
  • Explain function overloading vs method overriding (virtual dispatch) in C++.
  1. Mutex vs condition variable
  • What problems does each solve? Why do condition variables require a mutex and a loop around wait ?
  1. What causes a physical memory access?
  • At a high level, what events force the CPU to access DRAM (vs cache)? Include page faults, TLB misses, cache misses, and DMA.
  1. Shared memory synchronization
  • If multiple processes/threads communicate via shared memory, how do you correctly synchronize access? Discuss options (process-shared mutexes, semaphores, futexes, file locks) and pitfalls.
  1. Linux networking and virtualization (high level)
  • Describe how a packet travels through the Linux networking stack, and how common virtualization primitives (namespaces, veth pairs, bridges, TAP, iptables/nftables) fit into that path.

Constraints & Assumptions

  • Preserve the scope, facts, inputs, and requested outputs from the prompt above.
  • If the prompt leaves a detail unspecified, state a reasonable assumption before relying on it.
  • Keep the answer interview-ready: concise enough to present, but concrete enough to implement or evaluate.

Clarifying Questions to Ask

  • Clarify language/runtime assumptions and the level of depth expected.
  • Use examples to connect definitions to practical engineering decisions.
  • Call out pitfalls, trade-offs, and common misconceptions.

What a Strong Answer Covers

  • Accurate definitions and comparisons with concrete examples.
  • Complexity, lifecycle, safety, or operational implications where relevant.
  • Trade-offs that explain when one approach is preferable to another.
  • Common failure modes and how to avoid them.

Follow-up Questions

  • How would you debug a production issue related to this topic?
  • What trade-off would change in a high-throughput service?
  • Which misconception do candidates often have here?
Loading comments...

Browse More Questions

More Software Engineering Fundamentals•More Sunrise•More Software Engineer•Sunrise Software Engineer•Sunrise Software Engineering Fundamentals•Software Engineer Software Engineering Fundamentals

Write your answer

Your first approved answer each day earns 20 XP.

Sign in to write your answer.
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.