CS Fundamentals Interview Questions: OOP, OS and Networks
The short answer
Core CS questions come up in almost every campus interview. The bank has 12, including the four pillars of OOP, process versus thread, deadlock, virtual memory, TCP versus UDP and the OSI model. Each has a note on what to cover, and a minute is enough for most.
12 questions. Open one to see what a good answer covers.
What are the four pillars of object-oriented programming?
Encapsulation (hiding data inside objects), abstraction (showing only what is needed), inheritance (reusing a parent's behaviour) and polymorphism (one interface, many forms). Give a small example of each.
What is the difference between a process and a thread?
A process is a running program with its own memory. Threads live inside a process and share its memory, which makes them lighter but needs care to avoid clashes.
What is a deadlock, and how can it be avoided?
Two or more processes each hold a resource and wait for another's, so none can continue. It needs mutual exclusion, hold and wait, no pre-emption and circular wait. Break one of these, for example by always taking locks in the same order.
What is virtual memory?
A technique that lets a program use more memory than the computer physically has by moving unused pages between RAM and disk. It also isolates programs from each other.
What is the difference between TCP and UDP?
TCP is reliable, ordered and connection-based, used for web pages and email. UDP is faster with no delivery guarantee, used for video calls and games.
What are the layers of the OSI model?
Physical, data link, network, transport, session, presentation and application. Be ready to place familiar things on them, such as IP on the network layer and HTTP on the application layer.
What is a REST API?
A way for programs to talk over HTTP using URLs for things and methods such as GET, POST, PUT and DELETE for actions. Each request carries all it needs, and data is often sent as JSON.
What is the difference between a compiler and an interpreter?
A compiler translates the whole program to machine code before it runs. An interpreter reads and runs it line by line. Many languages, such as Java and Python, use a mix.
What is the difference between stack and heap memory?
The stack holds function calls and local variables and is fast and automatically managed. The heap holds objects that live longer and is managed by the programmer or a garbage collector.
What is Git, and what is the difference between merge and rebase?
Git tracks changes to code. Merge joins two branches and keeps both histories, while rebase replays your commits on top of another branch for a straight history. Do not rebase shared branches.
What is the difference between SQL and NoSQL databases?
SQL databases store data in tables with a fixed structure and relations. NoSQL databases, such as document or key-value stores, are more flexible and scale across machines easily. Choose by the data and the queries.
What is a primary difference between authentication and authorisation?
Authentication checks who you are, for example with a password. Authorisation decides what you are allowed to do once you are known.
Everything runs in your browser. What you type is not sent anywhere.
How to: CS Fundamentals Interview Questions: OOP, OS and Networks
- 1Read the question and give a one-line definition aloud.
- 2Add one real-life example to show you understand it.
- 3Open the tip and see what you missed.
- 4Practise again with the timer.
At a glance
- Questions
- 12 CS fundamentals questions
- Includes
- OOP, operating systems, networks
- Time to aim for
- About 60 seconds each
Frequently asked questions
How do I explain a deadlock simply?
Say it is when two tasks each hold something the other needs, so both wait forever. Then give the four conditions and one way to avoid it, which the tip lists.
Do I need to memorise all seven OSI layers?
Know their order and what each does in a line. Interviewers rarely want more than that from a fresher, but they do like a real example.
More quick answers
- HR Interview Questions for Freshers: Tell Me About Yourself
- Behavioural Interview Questions and the STAR Method
- Python Interview Questions for Freshers
- Java Interview Questions for Freshers
- SQL Interview Questions for Freshers
- Data Structures and Algorithms Interview Questions for Freshers
- Web Development Interview Questions for Freshers
- Excel and Data Analysis Interview Questions for Freshers