Skip to content
PlaceNivo

Core CS

Core CS Notes for Placements: OOPs, DBMS, OS and CN

The 90-day roadmap gives about a fifth of your time to core CS. These are short revision notes on what interviewers and MCQ rounds actually ask. Read one topic a day, then answer its viva questions out loud.

Object-Oriented Programming (OOPs)

Asked in almost every fresher technical interview, usually in the language on your resume.

Class and object

  • A class is a blueprint that defines data (fields) and behaviour (methods).
  • An object is one instance of a class, with its own copy of the fields.
  • Example: Car is a class; your red Swift is an object of it.

Encapsulation

  • Keep the data private and expose it only through methods (getters and setters).
  • It stops outside code from putting an object into an invalid state.
  • Example: a BankAccount keeps balance private and allows only deposit() and withdraw().

Abstraction

  • Show what an object does and hide how it does it.
  • Achieved with abstract classes and interfaces.
  • Example: you call list.sort() without knowing which sorting algorithm runs.

Inheritance

  • A child class reuses and extends the fields and methods of a parent class (an 'is-a' relationship).
  • Types: single, multilevel, hierarchical. Java has no multiple inheritance with classes, but allows it with interfaces.
  • Prefer composition ('has-a') when the relationship is not truly 'is-a'.

Polymorphism

  • One name, many forms.
  • Compile-time: method overloading (same name, different parameters).
  • Runtime: method overriding (a child class redefines a parent method; the object type decides which runs).
Shape s = new Circle();
s.area(); // calls Circle's area() at runtime

Abstract class vs interface

  • An abstract class can have fields, constructors and both abstract and concrete methods.
  • An interface is a contract. A class can implement many interfaces but extend only one class (in Java).
  • Use an abstract class for shared code; use an interface for a shared capability.

Constructors, static and access modifiers

  • A constructor runs when an object is created. It can be overloaded and can be private (Singleton).
  • static members belong to the class, not to any object. They are shared by all objects.
  • Access modifiers (Java): private < default < protected < public.

Test yourself: 5 most-asked OOPs viva questions with hints.

Practise OOPs viva

Database Management Systems (DBMS) and SQL

SQL queries are asked in service-company interviews and in tests like Cognizant, Infosys and TCS.

Keys

  • Primary key: uniquely identifies each row. It cannot be NULL and there is only one per table.
  • Candidate key: any column set that could be the primary key. Super key: any set that uniquely identifies a row.
  • Foreign key: a column that refers to the primary key of another table and keeps the data consistent.

Normalisation

  • 1NF: every cell holds a single (atomic) value.
  • 2NF: 1NF and no partial dependency on part of a composite key.
  • 3NF: 2NF and no transitive dependency (a non-key column depending on another non-key column).
  • BCNF: for every dependency X → Y, X must be a super key.

ACID properties

  • Atomicity: a transaction happens completely or not at all.
  • Consistency: the database moves from one valid state to another.
  • Isolation: running transactions do not see each other's half-done work.
  • Durability: once committed, data survives a crash.

Joins

  • INNER JOIN: only rows that match in both tables.
  • LEFT JOIN: all rows from the left table, with NULLs where the right table has no match. RIGHT JOIN is the mirror.
  • FULL OUTER JOIN: all rows from both tables. SELF JOIN: a table joined with itself (employee and manager).
SELECT e.name, d.name
FROM employees e
LEFT JOIN departments d ON e.dept_id = d.id;

Must-know queries

  • Second highest salary, the count of employees per department, and departments with more than 5 employees.
  • WHERE filters rows before grouping; HAVING filters groups after GROUP BY.
  • DELETE removes chosen rows (can be rolled back), TRUNCATE removes all rows quickly, DROP removes the table.
SELECT dept_id, COUNT(*) AS total
FROM employees
GROUP BY dept_id
HAVING COUNT(*) > 5;

Indexing

  • An index is a sorted structure (usually a B+ tree) that makes lookups fast, like a book's index.
  • It speeds up reads but slows down inserts and updates and takes extra space.
  • Clustered index: decides the physical order of rows (one per table). Non-clustered: a separate structure that points to the rows.

Test yourself: 6 most-asked DBMS viva questions with hints.

Practise DBMS viva

Operating Systems (OS)

Process, thread and deadlock questions are common in technical interviews and in MCQ rounds.

Process vs thread

  • A process is a running program with its own memory space.
  • A thread is a unit of work inside a process. Threads of one process share its memory, so they are lighter and switch faster.
  • A crash in one process doesn't affect another; a bad thread can crash its whole process.

CPU scheduling

  • FCFS: first come, first served. Simple, but short jobs can wait behind long ones.
  • SJF: shortest job first. Lowest average waiting time, but long jobs can starve.
  • Round Robin: each process gets a fixed time slice in turn. Fair and used in time-sharing systems.
  • Priority scheduling: the highest priority runs first. Ageing prevents starvation.

Deadlock

  • Two or more processes wait forever for resources held by each other.
  • All 4 conditions must hold: mutual exclusion, hold and wait, no preemption, circular wait.
  • Handle it by prevention (break one condition), avoidance (Banker's algorithm), or detection and recovery.

Synchronisation

  • A race condition happens when the result depends on the order in which threads run.
  • Mutex: a lock that only one thread holds at a time; the owner releases it.
  • Semaphore: a counter that allows up to N threads; a binary semaphore works like a lock.

Memory management

  • Paging splits memory into fixed-size pages and frames. It removes external fragmentation.
  • Segmentation splits memory by logical parts (code, stack, data) of different sizes.
  • Virtual memory uses disk space so a program can be bigger than RAM. A page fault loads a missing page from disk.
  • Thrashing: the system spends more time swapping pages than running programs.

Test yourself: 5 most-asked OS viva questions with hints.

Practise OS viva

Computer Networks (CN)

OSI, TCP/UDP and 'what happens when you type a URL' are favourite interview questions, and Accenture tests networking basics.

OSI and TCP/IP models

  • OSI has 7 layers: Physical, Data Link, Network, Transport, Session, Presentation, Application.
  • TCP/IP has 4: Network Access (Link), Internet, Transport, Application.
  • Devices by layer: hub (Physical), switch (Data Link), router (Network).

TCP vs UDP

  • TCP: connection-oriented (3-way handshake: SYN, SYN-ACK, ACK), reliable and ordered. Used for web pages, email and file transfer.
  • UDP: connectionless, faster, no delivery guarantee. Used for video calls, games, live streaming and DNS queries.

IP, MAC and ports

  • IP address: a logical address for a device on a network (IPv4 is 32-bit, IPv6 is 128-bit).
  • MAC address: a 48-bit hardware address burned into the network card.
  • Port: identifies an application on a device. HTTP 80, HTTPS 443, SSH 22, DNS 53.
  • ARP finds the MAC address for a known IP address on a local network.

DNS, HTTP and HTTPS

  • DNS translates a domain name into an IP address.
  • HTTP is the protocol for web requests. Common methods: GET, POST, PUT, DELETE.
  • HTTPS is HTTP over TLS: the data is encrypted and the server's identity is checked with a certificate.

What happens when you type a URL

  • The browser checks its cache, then asks DNS for the IP address.
  • It opens a TCP connection and, for HTTPS, does a TLS handshake.
  • It sends an HTTP request; the server returns HTML, CSS and JavaScript.
  • The browser builds the page and loads images and scripts with more requests.

Test yourself: 5 most-asked CN viva questions with hints.

Practise CN viva

How to revise core CS without wasting time

  • One topic a day

    Read one note card, then explain it out loud in 1 minute as if the interviewer asked it.

  • Write the SQL

    Type every query on this page into an online SQL editor. Reading a query is not the same as writing it.

  • Link it to your project

    Interviewers love 'Where did you use this?' Find one OOPs, DBMS or networking idea in your own project.

These notes cover the common fresher-level questions. If a company lists a specific subject in its pattern, check that company's guide on the company-wise preparation page.

Now practise it in a timed mock

Pick the technical set in the mock interview, answer out loud and rate yourself.