Interview questions

CS Fundamentals Interview Questions: OS, DBMS, Networks, OOP

May 17, 2025Updated October 23, 20267 min read
Top 30 Most Common cs fundamentals interview questions You Should Prepare For

The 13 CS fundamentals questions worth mastering first, with what each tests, a short model answer and the follow-up to expect.

CS fundamentals interview questions come from four subjects: operating systems, databases (DBMS), computer networks and object-oriented programming. If you have been working through InterviewBit CS fundamentals pages, you know the OS, DBMS and OOPs pages each list dozens of questions, many of them definitions. You do not need all of them. The 13 below sit underneath the rest: answer these and their follow-ups well and most one-line definitions follow. Each comes with a short model answer and the follow-up to expect, then a one-week plan. Data structures and algorithms are left to the coding-round guides.

How these questions come up

Expect three formats: multiple-choice sections in online tests (InterviewBit's OS, DBMS and OOPs pages each end with an MCQ set), spoken theory questions, and follow-ups during a coding or project discussion ("two threads update this counter; what happens?"). The third is the hardest to prepare for from a list, so the answers below lead with the consequence, not the definition.

Operating systems

1. What is the difference between a process and a thread? (worked example)

A weak answer: "A thread is a lightweight process." True, but it gives the interviewer nothing to build on.

A strong answer, about 40 seconds: "Threads inside a process share its address space, so they see the same heap and globals, but each has its own registers, program counter and stack. Switching between them is cheaper than switching processes because the page table stays the same. The cost of sharing is that two threads can update the same data at once, so you need a lock around it, and once you have locks you have to think about deadlock."

The strong version ends by pointing at the next question. Questions 1 to 3 cover that chain (threads, shared data, locks, deadlock), so practise answers that hand the interviewer the next step.

2. What conditions are needed for a deadlock, and how do you prevent one?

Four conditions must all hold: mutual exclusion, hold-and-wait, no preemption, and circular wait. Break any one and deadlock cannot occur. The practical fix is to break circular wait by always acquiring locks in the same order. Follow-up: "How would you enforce that order in a large codebase?"

3. Mutex or semaphore?

A semaphore is an integer with two operations: wait decrements it and blocks if the result is negative; post increments it and wakes a waiting thread. Initialised to 1, it behaves as a lock (a binary semaphore). Initialised to 0, it lets one thread wait until another signals; semaphores used this way solve the classic producer-consumer problem. A mutex is the lock case: one holder at a time.

4. What is virtual memory, and what happens on a page fault?

Each process sees a large private address space; the OS maps its pages to physical frames and can keep some pages on disk in swap space. If a program touches a page that is not in memory, the hardware raises a page fault and the OS loads the page. Follow-up: "Why isn't paging slow, given the extra lookup?" Because the TLB, a cache in the memory-management unit, holds recent translations.

Databases

5. Explain ACID with an example.

Atomicity: a transaction succeeds completely or not at all. Consistency: it moves the database from one valid state to another. Isolation: concurrent transactions leave the same result as running them one after another. Durability: once committed, the change survives a crash. Example: in a bank transfer, the debit and credit happen together or not at all.

6. What are isolation levels, and which anomalies does each allow?

The SQL standard defines four. Read uncommitted allows dirty reads; read committed prevents them but allows non-repeatable and phantom reads; repeatable read also prevents non-repeatable reads; serializable prevents all of these. Extra detail: PostgreSQL defaults to read committed, and its read uncommitted behaves like read committed.

7. How does an index speed up a query, and what does it cost?

A B-tree index, the default type in PostgreSQL, handles equality and range conditions and can return rows in sorted order; a hash index handles only equality. The cost is that every insert, update and delete must also maintain the index, so drop indexes that queries rarely use.

8. What is normalization, and when would you denormalize?

Normalization reduces redundancy so one fact lives in one place, avoiding update, insert and delete anomalies. 1NF: one value per field. 2NF: non-key columns depend on the whole key. 3NF: no transitive dependencies. Denormalizing (copying data to avoid joins) trades write complexity for read speed; say how you would keep the copies consistent.

Computer networks

9. TCP or UDP?

TCP gives a reliable, in-order byte stream, retransmitting lost data. UDP sends datagrams with minimal mechanism and does not guarantee delivery or protect against duplicates. Good example: DNS queries normally use UDP on port 53.

10. Walk through the TCP three-way handshake.

The client sends SYN with its initial sequence number; the server replies SYN-ACK with its own; the client acknowledges it. The reason earns the marks: the exchange stops an old, duplicate connection request from being mistaken for a new one.

11. What happens when you type a URL and press Enter?

DNS lookup for the hostname, TCP handshake, TLS negotiation for HTTPS, an HTTP GET request, the response, then parsing HTML and CSS into the DOM and CSSOM, layout and paint. Name the layers as you go (application, transport, internet, link) and offer to expand any step.

Object-oriented programming

12. Overloading or overriding?

Overloading: same method name, different parameter lists; return type alone cannot distinguish them. Overriding: a subclass method with the same signature replaces the parent's, and the runtime calls the version for the actual object, not the variable's declared type. That runtime choice is polymorphism.

13. Abstract class or interface?

Use an abstract class to share code and fields among closely related classes. Use an interface when unrelated classes should promise the same behaviour, or when you need multiple inheritance of type. If asked about encapsulation: an object hides its internal state and exposes it only through methods, which lets you validate changes in one place.

A one-week plan

  • Days 1-2: Operating systems. Draw a process with two threads and say what they share.
  • Day 3: Databases. Write a two-statement transfer in SQL and explain what each isolation level lets another session see.
  • Day 4: Networks. Explain the URL walkthrough end to end in under two minutes, then expand any one step.
  • Day 5: OOP. Write a short class hierarchy that shows overloading, overriding and an interface.
  • Days 6-7: Mock round. Have a friend pick questions at random and push one follow-up deeper.

Related guides: technical round interview questions, data structure viva questions and computer architecture interview questions.

If you want support in the interview itself, Verve AI's Interview Copilot listens to the conversation and shows suggestions that only you can see. It has a Software Engineering domain, and answers can draw on the resume and documents you enable.

Sources

  • InterviewBit OS page (70+ questions, MCQ section): https://www.interviewbit.com/operating-system-interview-questions/
  • InterviewBit DBMS page (MCQ section): https://www.interviewbit.com/dbms-interview-questions/
  • InterviewBit OOPs page (MCQ section): https://www.interviewbit.com/oops-interview-questions/
  • Threads share an address space, own registers, PC and stack; no page-table switch: https://pages.cs.wisc.edu/~remzi/OSTEP/threads-intro.pdf
  • Four deadlock conditions, lock ordering: https://pages.cs.wisc.edu/~remzi/OSTEP/threads-bugs.pdf
  • Semaphore operations, binary semaphore with initial value 1, ordering and producer-consumer: https://pages.cs.wisc.edu/~remzi/OSTEP/threads-sema.pdf
  • Swap space, present bit, page faults: https://pages.cs.wisc.edu/~remzi/OSTEP/vm-beyondphys.pdf
  • Paging's extra lookup and the TLB in the MMU: https://pages.cs.wisc.edu/~remzi/OSTEP/vm-tlbs.pdf
  • ACID definitions and bank transfer example: https://en.wikipedia.org/wiki/ACID
  • Isolation levels and anomalies, PostgreSQL default and read uncommitted behaviour: https://www.postgresql.org/docs/current/transaction-iso.html
  • B-tree default, B-tree vs hash operators: https://www.postgresql.org/docs/current/indexes-types.html
  • Index maintenance overhead, drop unused indexes: https://www.postgresql.org/docs/current/indexes-intro.html
  • Normalization purpose, anomalies, 1NF-3NF: https://en.wikipedia.org/wiki/Database_normalization
  • TCP reliable in-order byte stream, three-way handshake and old duplicate SYNs: https://www.rfc-editor.org/rfc/rfc9293.html
  • UDP minimal mechanism, no delivery or duplicate guarantee: https://www.rfc-editor.org/rfc/rfc768.html
  • DNS over UDP port 53: https://www.rfc-editor.org/rfc/rfc1035.html
  • Internet layers (application, transport, internet, link): https://www.rfc-editor.org/rfc/rfc1122.html
  • URL to page steps (DNS, TCP, TLS, HTTP, DOM/CSSOM, layout, paint): https://developer.mozilla.org/en-US/docs/Web/Performance/Guides/How_browsers_work
  • Overloading and return types: https://docs.oracle.com/javase/tutorial/java/javaOO/methods.html
  • Overriding: https://docs.oracle.com/javase/tutorial/java/IandI/override.html
  • Virtual method invocation (polymorphism): https://docs.oracle.com/javase/tutorial/java/IandI/polymorphism.html
  • Abstract class vs interface: https://docs.oracle.com/javase/tutorial/java/IandI/abstract.html
  • Encapsulation: https://docs.oracle.com/javase/tutorial/java/concepts/object.html
  • Interview Copilot: https://docs.vervecopilot.com/features/interview-copilot
  • Resume upload and job details: https://docs.vervecopilot.com/features/create-first-persona
R

Ryan

CEO of Verve AI

Related reads

Explore Related Interview Guides

What No One Tells You About Cpp Round And Interview Performance
May 15, 2026Interview prep guide

C++ Round Interview Performance: The Playbook for Answering Under Pressure

Master C++ round interview performance by structuring answers on RAII, smart pointers, and the rule of five so you sound clear under pressure.

Read guide
What No One Tells You About C++ Thread Pool And Interview Performance
May 28, 2026Interview prep guide

C++ Thread Pool Interview Performance: The Framework Interviewers Expect

A practical framework for C++ thread pool interview performance: when thread pools beat std::thread creation, how to size workers, and how to explain.

Read guide
Why Understanding How To Create Table Sql With Primary Key Is Crucial For Database Design
May 15, 2026Interview prep guide

Create Table SQL Primary Key: From Simple Syntax to Interview Answer

Use create table sql primary key syntax to define unique, NOT NULL rows, compare single vs composite keys, and answer interview questions clearly.

Read guide
Top 30 Most Common CRM Interview Questions You Should Prepare For
May 17, 2026Interview prep guide

CRM Interview Questions: 25 Answer Frameworks for Every Level

Use CRM interview questions to answer with STAR frameworks, sample responses, and level-specific tweaks for entry, mid, senior, and career switchers.

Read guide
What No One Tells You About Csharp Array Append And Interview Performance
May 28, 2026Interview prep guide

C# Array Append Interview Performance: The Answer Candidates Should Know

A clean interview-ready explanation of C# array append performance: why arrays cannot grow in place, what Array.Resize does, when List T is the better choice.

Read guide
What No One Tells You About How A Css Cheat Sheet Can Transform Your Interview Prep
May 17, 2026Interview prep guide

CSS Cheat Sheet for Interview Prep

Use this CSS cheat sheet for interview prep to review topics in interview order and explain flexbox, specificity, overflow, and layout choices clearly.

Read guide
Top 30 Most Common css3 interview questions You Should Prepare For
May 15, 2026Interview prep guide

30 CSS3 Interview Questions by Real UI Scenario

Master CSS3 interview questions with 30 real UI scenarios: sticky headers, modals, flex overflow, Grid vs Flexbox, specificity, and z-index.

Read guide
Culture Fit Interview Questions: 20 Answers That Don’t Sound Generic
May 30, 2026Interview prep guide

Culture Fit Interview Questions: 20 Answers That Don’t Sound Generic

Culture fit interview questions are easy to answer badly. Get the most common questions, side-by-side strong and weak answer patterns, and a simple rubric.

Read guide
Customer Service Interview Questions: 25 Answers Beginners Can Actually Use
May 28, 2026Interview prep guide

Customer Service Interview Questions: 25 Answers Beginners Can Actually Use

Customer service interview questions, answered for beginners: the questions to prepare first, how to turn limited experience into credible answers, and what.

Read guide

Walk into every interview prepared and confident

Get Started For Free

Available on Mac, Windows, browser and mobile