Skip to content
Preptima

CS Fundamentals interview questions and answers

The core-subject rounds common in campus hiring and still used to probe depth in experienced interviews.

26 published across 6 topics.

Processes and threads, scheduling, virtual memory and paging, synchronisation, and deadlock handling.

hardConcept

A service stops accepting new connections while CPU and memory look fine. Which operating-system limits would you suspect, and how would you tell them apart?

Suspect a bounded resource rather than a saturated one: file descriptors, threads, ephemeral ports or the listen queue. Each has a different scope — per process, per user, per cgroup, per system — and each announces itself with a different error, which is how you tell them apart. Use this RLIMIT answer to show the decision, trade-off, and evidence rather than a memorised definition.

5 minmid, senior, staff
All 6 in Operating Systems

The layered model, TCP versus UDP, congestion control, routing, and what happens when you load a URL.

All 4 in Computer Networks

DBMS Theory

5 questions

Relational algebra, functional dependencies, normal forms, and concurrency-control theory.

All 5 in DBMS Theory

OOP Theory

4 questions

Abstraction and the classical definitions, plus the terminology questions asked verbatim in screens.

easyConceptCoding

Skip the definitions. Show me encapsulation, abstraction, inheritance and polymorphism, each in about ten lines of code, and then tell me when inheritance is the wrong tool.

OOP examples beat definitions: a class refusing a bad withdrawal shows encapsulation, a caller depending on an interface shows abstraction, a subclass reusing a parent method shows inheritance, and one loop running different overrides shows polymorphism. Inheritance is wrong when the child breaks a parent promise.

4 minentry
All 4 in OOP Theory

Compilation phases, interpretation versus JIT, memory layout, and garbage-collection theory.

hardConcept

A method has been running fast for an hour and then gets slower, with no code change and no extra traffic. What might the runtime be doing?

A JIT compiles against a profile gathered earlier, so its fast code rests on assumptions that can be invalidated: a new receiver type at a call site, a branch taken for the first time, a class loaded that gives an interface a second implementation. The method deoptimises and recompiles from a worse profile. It also connects deoptimisation to the point an interviewer is testing.

5 minmid, senior, staff
mediumConcept

Walk me through what happens between the source you write and the instructions the CPU runs, and where does a JIT fit into that?

Source is tokenised, parsed, checked, lowered to an intermediate representation, optimised and emitted - either ahead of time to machine code or to bytecode executed by a runtime. A JIT compiles hot bytecode at run time using profiles, which is why managed programs get faster after warm-up. Use this compilers answer to show the decision, trade-off, and evidence rather than a memorised definition.

5 minmid, senior, staff
All 3 in Compilers & Runtimes

OWASP categories, cryptography basics, hashing versus encryption, and secure-by-default habits.

mediumConceptCoding

You need a random number from 1 to 6 and you wrote rand() % 6. What is wrong with that, and when does it stop being merely wrong and become a vulnerability?

rand() % 6 yields 0 to 5, and because RAND_MAX + 1 is not a multiple of 6 it shows modulo bias towards 0 and 1. Rejection sampling fixes the bias. It becomes a vulnerability when an attacker benefits from predicting the value, as with tokens, keys or nonces, because rand() is predictable. Those need a CSPRNG.

4 minentry, mid, senior
mediumConcept

You are told the application is safe from injection because all user input is escaped as it comes in. What is wrong with that?

Escaping is meaningless without a destination, and at the point input arrives you do not know which parser will consume it. Injection is a property of the sink, so the defence belongs at each sink — bound parameters, an argument vector rather than a shell string, encoding chosen by output context — not at the edge. It also connects input validation to the point an interviewer is testing.

5 minmid, senior, staff
mediumConcept

How does HTTPS establish trust, and what does a certificate prove?

A certificate binds a public key to a domain name and is signed by a chain ending at a root already in your device's trust store. It proves that whoever holds the matching private key controlled that name at issuance - nothing about the operator's honesty - and revoking it early barely works.

5 minmid, senior, staff
All 4 in Security Fundamentals