TGViewer
Coding Interview Resources Coding Interview Resources @crackingthecodinginterview · 52.2K subscribers
Post #2770 1.48K
✅ Coding Interview Questions with Answers Part-4 🧠💻

31. What is a pointer
A pointer stores the memory address of a variable.
- Direct memory access
- Efficient data handling
Used in C/C++, dynamic memory allocation.

32. Difference between pointer and reference
Pointer: holds address, can be null, can change target.
Reference: alias of variable, cannot be null, cannot change binding.
Pointer is flexible, reference is safer.

33. What is a memory leak
Memory leak: memory not released.
- Program slows down
- App crashes
Causes: missing free/delete, unclosed resources.
Use garbage collection or smart pointers.

34. What is segmentation fault
Segmentation fault: invalid memory access.
- Access null pointer
- Array index overflow
Seen in C/C++. Check pointer usage.

35. Difference between process and thread
Process: independent, own memory, heavier.
Thread: part of process, shared memory, lightweight.
Threads share resources.

36. What is multithreading
Multithreading: runs tasks in parallel.
- Better CPU use
- Faster execution
Examples: web servers, background tasks.
Risk: data inconsistency.

37. What is synchronization
Synchronization: controls shared data access.
Prevents race conditions. Use locks, mutex, semaphores.
Safety over speed.

38. What is deadlock
Deadlock: threads wait forever.
- Thread A holds lock 1
- Thread B holds lock 2
Result: system freeze.

39. Conditions for deadlock
All four must exist:
- Mutual exclusion
- Hold and wait
- No preemption
- Circular wait
Break one to avoid deadlock.

40. Shallow copy vs deep copy
Shallow: copies reference, changes affect both.
Deep: copies data, fully independent.
Example: objects with nested data.

Double Tap ♥️ For More
  • ❤ 1
More from @crackingthecodinginterview
  1. Oct 8, 2026🎓 𝗠𝗶𝗰𝗿𝗼𝘀𝗼𝗳𝘁 𝗙𝗥𝗘𝗘 𝗖𝗼𝘂𝗿𝘀𝗲𝘀 𝘄𝗶𝘁𝗵 𝗖𝗲𝗿𝘁𝗶𝗳𝗶𝗰𝗮𝘁𝗲𝘀! 🚀🔥 Upgr…
  2. Oct 7, 2026🚀 DSA Topics Every Programmer Should Know 💻🔥 📦 1. Arrays ✔ Traversal ✔ Searching ✔ Sor…
  3. Oct 7, 2026🚀𝗣𝗮𝘆 𝗔𝗳𝘁𝗲𝗿 𝗣𝗹𝗮𝗰𝗲𝗺𝗲𝗻𝘁 𝗧𝗿𝗮𝗶𝗻𝗶𝗻𝗴 | 𝗕𝗲𝗰𝗼𝗺𝗲 𝗮 𝗙𝘂𝗹𝗹𝘀𝘁𝗮𝗰…
  4. Oct 7, 2026𝗠𝗮𝘀𝘁𝗲𝗿 𝗣𝗼𝘄𝗲𝗿 𝗕𝗜 𝗳𝗼𝗿 𝗙𝗥𝗘𝗘! 🔥 Learn Power BI through these FREE learnin…
  5. Sep 29, 2026✅ Daily Coding Habits That Make You a Better Developer 🧠💻✨ 1️⃣ Code Every Day (Even 30 M…
  6. Sep 29, 2026𝗙𝗥𝗘𝗘 𝗥𝗲𝘀𝗼𝘂𝗿𝗰𝗲𝘀 𝗧𝗼 𝗟𝗲𝗮𝗿𝗻 𝗔𝗜 𝗶𝗻 𝟮𝟬𝟮𝟲🚀 ​ Explore 6 free resource…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →