PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Software Engineering Fundamentals/Sunrise

Explain C++ memory, types, and concurrency fundamentals

Last updated: Mar 29, 2026

Quick Overview

Evaluates understanding of C++ language- and systems-level fundamentals—including type and object-model distinctions (class vs struct, pointers vs references, overloading vs overriding), construction and placement new idioms, function pointer syntax, container complexity, memory and cache behavior, synchronization primitives (mutexes, condition variables, futexes, semaphores), causes of physical memory access, and high-level Linux networking and virtualization packet flow. Commonly asked in Software Engineering Fundamentals interviews because it probes low-level language semantics and OS interactions essential for correct concurrency, performance reasoning, and system integration; category/domain: Software Engineering Fundamentals; level of abstraction: language- and OS-level systems fundamentals.

  • 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

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.

Quick Answer: Evaluates understanding of C++ language- and systems-level fundamentals—including type and object-model distinctions (class vs struct, pointers vs references, overloading vs overriding), construction and placement new idioms, function pointer syntax, container complexity, memory and cache behavior, synchronization primitives (mutexes, condition variables, futexes, semaphores), causes of physical memory access, and high-level Linux networking and virtualization packet flow. Commonly asked in Software Engineering Fundamentals interviews because it probes low-level language semantics and OS interactions essential for correct concurrency, performance reasoning, and system integration; category/domain: Software Engineering Fundamentals; level of abstraction: language- and OS-level systems fundamentals.

Sunrise logo
Sunrise
Jul 21, 2025, 12:00 AM
Software Engineer
Onsite
Software Engineering Fundamentals
0
0

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.

Solution

Show

Comments (0)

Sign in to leave a comment

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
PracHub

Master your tech interviews with 7,500+ 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
  • Compare Platforms
  • Discord Community

Support

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

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.