SQL | OOPs | DBMS | OS | Networks | Coding | Behavioural | Managerial | HR

Digital & Prime Level | All Actually Asked

📋 CATEGORY MAP

Category Questions Count
🔷 SQL Q1–Q12 12
🟠 OOPs Q13–Q24 12
🟡 DBMS Q25–Q36 12
🟢 Operating Systems Q37–Q46 10
🔵 Computer Networks Q47–Q56 10
💻 Coding on Paper Q57–Q70 14
🧠 Behavioural + Scenario Q71–Q82 12
📊 Managerial Round Q83–Q91 9
🤝 HR + Personal Q92–Q100 9


🔷 SQL — Q1 to Q12


Q1. ⭐ Write a SQL query to find the second highest salary from the Employee table.

Answer:

-- Method 1: Subquery
SELECT MAX(salary) AS SecondHighest
FROM employees
WHERE salary < (SELECT MAX(salary) FROM employees);

-- Method 2: DENSE_RANK (handles duplicates correctly)
SELECT salary FROM (
  SELECT salary, DENSE_RANK() OVER (ORDER BY salary DESC) AS rnk
  FROM employees
) t WHERE rnk = 2;

-- Method 3: LIMIT OFFSET (MySQL)
SELECT DISTINCT salary FROM employees
ORDER BY salary DESC
LIMIT 1 OFFSET 1;

Q2. ⭐ What is the difference between WHERE and HAVING clause?

Answer:

WHERE HAVING
Used with Individual rows Groups (after GROUP BY)
Filters Before aggregation After aggregation
Can use aggregate functions No Yes
Example WHERE salary > 50000 HAVING AVG(salary) > 50000
-- WHERE filters rows before grouping
SELECT dept, AVG(salary) FROM employees
WHERE salary > 20000
GROUP BY dept
HAVING AVG(salary) > 50000;
-- HAVING filters after grouping

Q3. ⭐ What are the different types of JOINs? Explain with example.

Answer:

INNER JOIN — Only matching rows from both tables.

SELECT e.name, d.dept_name
FROM employees e INNER JOIN departments d ON e.dept_id = d.id;

LEFT JOIN — All rows from left table + matching from right (NULL if no match).

SELECT e.name, d.dept_name
FROM employees e LEFT JOIN departments d ON e.dept_id = d.id;

RIGHT JOIN — All rows from right table + matching from left.

FULL OUTER JOIN — All rows from both tables (NULL where no match).

SELF JOIN — Table joined with itself.

SELECT a.name AS employee, b.name AS manager
FROM employees a JOIN employees b ON a.manager_id = b.id;

CROSS JOIN — Cartesian product of both tables.


Q4. ⭐ What is the difference between DELETE, TRUNCATE, and DROP?

Answer:

DELETE TRUNCATE DROP
Type DML DDL DDL
Rollback Yes No No
WHERE clause Yes No No
Deletes structure No No Yes
Triggers fire Yes No No
Speed Slow (row by row) Fast Fast
DELETE FROM employees WHERE id = 5;   -- removes specific row
TRUNCATE TABLE employees;              -- removes all rows, keeps structure
DROP TABLE employees;                  -- removes table completely

Q5. ⭐ What is the difference between DDL, DML, DCL, and TCL?

Answer:

DDL (Data Definition Language) — Defines structure. Commands: CREATE, ALTER, DROP, TRUNCATE, RENAME

DML (Data Manipulation Language) — Manipulates data. Commands: INSERT, UPDATE, DELETE, SELECT

DCL (Data Control Language) — Controls access. Commands: GRANT, REVOKE

TCL (Transaction Control Language) — Manages transactions. Commands: COMMIT, ROLLBACK, SAVEPOINT


Q6. ⭐ Write a query to find all employees whose name starts with ‘A’.

Answer:

SELECT * FROM employees
WHERE name LIKE 'A%';

-- Other LIKE patterns:
-- LIKE '%A'   → ends with A
-- LIKE '%A%'  → contains A anywhere
-- LIKE '_A%'  → second character is A

Q7. ⭐ What is a GROUP BY clause? Write a query to find department-wise employee count.

Answer: GROUP BY groups rows with the same values into summary rows.

SELECT department, COUNT(*) AS employee_count
FROM employees
GROUP BY department
ORDER BY employee_count DESC;

-- With HAVING to filter groups:
SELECT department, COUNT(*) AS cnt
FROM employees
GROUP BY department
HAVING COUNT(*) > 5;

Q8. ⭐ What is a subquery? What are its types?

Answer: A subquery is a query nested inside another query.

Types:

  • Single-row subquery — returns one row: WHERE salary = (SELECT MAX(salary) FROM employees)
  • Multi-row subquery — returns multiple rows: WHERE dept_id IN (SELECT id FROM departments WHERE location = 'Mumbai')
  • Correlated subquery — references outer query: executes once per outer row
  • Scalar subquery — returns single value, used in SELECT list
-- Correlated subquery example:
SELECT name FROM employees e
WHERE salary > (SELECT AVG(salary) FROM employees WHERE dept_id = e.dept_id);

Q9. ⭐ What is an INDEX in SQL? What are its advantages and disadvantages?

Answer: An index is a data structure (usually B-Tree) that speeds up data retrieval from a table.

CREATE INDEX idx_salary ON employees(salary);
CREATE UNIQUE INDEX idx_email ON employees(email);

Advantages:

  • Faster SELECT and WHERE query performance
  • Faster sorting and ordering

Disadvantages:

  • Slows down INSERT, UPDATE, DELETE (index must be updated)
  • Consumes additional disk space

When NOT to use: Small tables, columns with many NULL values, columns rarely used in WHERE clauses.


Q10. ⭐ What are aggregate functions in SQL? Give examples.

Answer: Aggregate functions perform calculations on a set of values and return a single value.

Function Description Example
COUNT() Count rows SELECT COUNT(*) FROM employees
SUM() Total sum SELECT SUM(salary) FROM employees
AVG() Average SELECT AVG(salary) FROM employees
MAX() Maximum SELECT MAX(salary) FROM employees
MIN() Minimum SELECT MIN(salary) FROM employees
SELECT dept, COUNT(*) AS headcount, AVG(salary) AS avg_sal,
       MAX(salary) AS max_sal, MIN(salary) AS min_sal
FROM employees
GROUP BY dept;

Q11. ⭐ What is the difference between UNION and UNION ALL?

Answer:

UNION UNION ALL
Duplicates Removes duplicates Keeps all duplicates
Performance Slower (sorts to remove duplicates) Faster
Use when Need unique results Need all records including duplicates
SELECT name FROM employees_india
UNION
SELECT name FROM employees_usa;  -- unique names only

SELECT name FROM employees_india
UNION ALL
SELECT name FROM employees_usa;  -- all names including duplicates

Q12. ⭐ Write a SQL query to find employees who earn more than the average salary.

Answer:

SELECT name, salary
FROM employees
WHERE salary > (SELECT AVG(salary) FROM employees)
ORDER BY salary DESC;

-- With department-wise average:
SELECT e.name, e.salary, e.department
FROM employees e
WHERE e.salary > (
    SELECT AVG(salary) FROM employees
    WHERE department = e.department
)
ORDER BY e.department, e.salary DESC;


🟠 OOPs — Q13 to Q24


Q13. ⭐ What are the four pillars of OOPs? Explain each with a real-life example.

Answer:

Encapsulation — Wrapping data and methods into a single unit (class) and restricting direct access to data. Real-life: A medicine capsule hides its contents. You take it without knowing what’s inside.

class BankAccount {
    private double balance;          // hidden data
    public double getBalance() { return balance; }  // controlled access
    public void deposit(double amt) { if(amt > 0) balance += amt; }
}

Abstraction — Hiding implementation details, showing only what is necessary. Real-life: You drive a car without knowing how the engine works internally.

abstract class Shape {
    abstract double area();  // what — not how
}
class Circle extends Shape {
    double r;
    double area() { return 3.14 * r * r; }
}

Inheritance — A child class acquires properties and behaviours of a parent class. Real-life: A child inherits traits (eye colour, height) from parents.

class Animal { void eat() { System.out.println("eating"); } }
class Dog extends Animal { void bark() { System.out.println("Woof"); } }

Polymorphism — Same method name behaves differently based on context. Real-life: A person acts differently as a parent, employee, and friend.

  • Compile-time (Overloading): same method name, different parameters
  • Run-time (Overriding): child class redefines parent method

Q14. ⭐ What is the difference between an abstract class and an interface?

Answer:

Abstract Class Interface
Methods Abstract + Concrete Only abstract (Java 7); default/static (Java 8+)
Variables Any type public static final only
Constructor Yes No
Multiple inheritance No (single) Yes (multiple)
Access modifier Any public by default
Use when Base class with shared logic Define a contract/capability
abstract class Vehicle {
    String brand;                   // instance variable
    abstract void start();          // must override
    void fuel() { System.out.println("needs fuel"); }  // concrete
}
interface Electric { void charge(); }
class Tesla extends Vehicle implements Electric {
    void start() { System.out.println("silent start"); }
    public void charge() { System.out.println("charging"); }
}

Q15. ⭐ What is the difference between method overloading and method overriding?

Answer:

Overloading Overriding
Also called Compile-time polymorphism Run-time polymorphism
Where Same class Parent–child class
Method signature Different parameters Same signature
Return type Can differ Must be same or covariant
@Override annotation No Yes (recommended)
Static methods Can be overloaded Cannot be overridden
// Overloading — same class
class Calculator {
    int add(int a, int b) { return a + b; }
    double add(double a, double b) { return a + b; }  // different params
}

// Overriding — child class
class Animal { void sound() { System.out.println("..."); } }
class Cat extends Animal {
    @Override
    void sound() { System.out.println("Meow"); }  // same signature
}

Q16. ⭐ What is a constructor? What are its types? Can a constructor be private?

Answer: A constructor is a special method called when an object is created. It has the same name as the class and no return type.

Types:

  • Default constructor — No parameters; provided by Java if no constructor defined
  • Parameterised constructor — Takes arguments to initialise fields
  • Copy constructor — Creates object by copying another object (C++ has it natively)

Can a constructor be private? Yes — used in Singleton Pattern to prevent external instantiation.

class Singleton {
    private static Singleton instance;
    private Singleton() { }               // private constructor
    public static Singleton getInstance() {
        if (instance == null)
            instance = new Singleton();
        return instance;
    }
}

Q17. ⭐ What is the difference between this and super keyword?

Answer:

this super
Refers to Current class object Parent class
Used to call Current class constructor or methods Parent class constructor or methods
this() Calls another constructor in same class
super() Calls parent constructor (must be first line)
class Animal {
    String name;
    Animal(String name) { this.name = name; }
    void display() { System.out.println("Animal: " + name); }
}
class Dog extends Animal {
    String breed;
    Dog(String name, String breed) {
        super(name);           // calls Animal constructor
        this.breed = breed;    // refers to Dog's own field
    }
    void display() {
        super.display();       // calls Animal's display()
        System.out.println("Breed: " + breed);
    }
}

Q18. ⭐ What is a virtual function? What is a pure virtual function?

Answer: Virtual function — A function in base class declared with virtual keyword. Enables run-time polymorphism — the correct overridden version is called through a base class pointer/reference.

Pure virtual function — A virtual function with no body (= 0). Makes the class abstract — cannot be instantiated. Any derived class MUST override it.

class Shape {
public:
    virtual void draw() { cout << "drawing shape"; }    // virtual
    virtual double area() = 0;                           // pure virtual
};
class Circle : public Shape {
public:
    void draw() override { cout << "drawing circle"; }
    double area() override { return 3.14 * r * r; }
private:
    double r = 5;
};
// Shape s;    // ERROR — cannot instantiate abstract class
Circle c;      // OK — all pure virtual functions overridden

Q19. ⭐ What is a destructor? When is it called?

Answer: A destructor is a special method that is automatically called when an object goes out of scope or is explicitly deleted. It cleans up resources (memory, file handles, connections) allocated by the object.

class FileHandler {
    FILE* fp;
public:
    FileHandler(const char* name) { fp = fopen(name, "r"); }
    ~FileHandler() {                  // destructor
        if (fp) fclose(fp);           // auto cleanup
        cout << "File closed";
    }
};
// Destructor called automatically when object scope ends

Key points:

  • Name = ~ClassName()
  • No parameters, no return type
  • Called in reverse order of construction
  • In Java, finalize() plays a similar role (but garbage collector handles most cleanup)

Q20. ⭐ What is multiple inheritance? Why doesn’t Java support it?

Answer: Multiple inheritance — A class inheriting from more than one parent class.

Java doesn’t support multiple inheritance for classes because of the Diamond Problem:

    A
   / \
  B   C
   \ /
    D  ← Which version of A's method should D use?

If B and C both override a method from A, and D inherits from both B and C, it’s ambiguous which version D should call.

Java’s solution: Java allows multiple inheritance through interfaces (since interfaces had no implementation in Java 7; Java 8 default methods have explicit resolution rules).

interface B { default void show() { System.out.println("B"); } }
interface C { default void show() { System.out.println("C"); } }
class D implements B, C {
    public void show() { B.super.show(); }  // explicitly resolve conflict
}

Q21. ⭐ What is the difference between composition and inheritance? When to use which?

Answer:

Inheritance Composition
Relationship “IS-A” “HAS-A”
Coupling Tight Loose
Flexibility Less More
Example Dog IS-A Animal Car HAS-A Engine
// Inheritance (IS-A)
class Dog extends Animal { }

// Composition (HAS-A) — preferred over inheritance
class Car {
    private Engine engine;       // Car HAS-A Engine
    private Wheels wheels;
    Car() { engine = new Engine(); wheels = new Wheels(); }
}

Rule: Prefer composition over inheritance (GoF principle). Use inheritance only when there’s a genuine IS-A relationship that won’t change.


Q22. ⭐ What is the concept of encapsulation? How is it achieved in Java?

Answer: Encapsulation = bundling data (fields) and methods that operate on data into a single unit (class), and restricting direct access to the internal state.

Achieved through:

  1. Making fields private
  2. Providing public getter/setter methods with validation logic
class Employee {
    private String name;
    private double salary;

    public String getName() { return name; }
    public void setName(String name) {
        if (name != null && !name.isEmpty())
            this.name = name;
    }
    public double getSalary() { return salary; }
    public void setSalary(double salary) {
        if (salary > 0) this.salary = salary;    // validation
    }
}

Benefits: Data hiding, controlled access, easier maintenance, increased flexibility.


Q23. ⭐ Is C++ a purely object-oriented language? Is Java?

Answer: C++: NOT purely object-oriented. Reasons:

  • You can write functions outside classes
  • Has primitive data types (int, char, float) which are not objects
  • main() exists outside any class
  • Supports procedural programming

Java: NOT purely object-oriented either (despite common belief). Reasons:

  • Has primitive data types (int, long, double, boolean) which are not objects
  • Static methods can be called without creating objects
  • However, Java is MORE object-oriented than C++

Purely OOP languages: Smalltalk, Ruby — where everything including numbers are objects.


Q24. ⭐ What is the difference between a class and an object?

Answer:

Class Object
Definition Blueprint/template Instance of a class
Memory No memory (blueprint) Allocated in heap
Creation Written by programmer Created using new
Analogy House plan/architecture Actual built house
Count Only one class definition Many objects from one class
// Class — blueprint (defined once)
class Car {
    String brand;
    int speed;
    void drive() { System.out.println("driving " + brand); }
}

// Objects — instances (created many times)
Car c1 = new Car();  c1.brand = "Tesla";
Car c2 = new Car();  c2.brand = "BMW";
// c1 and c2 are separate objects of the same class


🟡 DBMS — Q25 to Q36


Q25. ⭐ What is normalization? Explain 1NF, 2NF, 3NF, and BCNF.

Answer: Normalization organises a database to reduce data redundancy and improve data integrity.

1NF (First Normal Form):

  • Atomic values — no multi-valued or composite attributes
  • Each column has a single value per row
  • Violation: Phone: 9876543210, 9123456789 in one cell

2NF (Second Normal Form):

  • Must be 1NF
  • No partial dependency — every non-key attribute must depend on the FULL primary key
  • Applies only to composite primary keys

3NF (Third Normal Form):

  • Must be 2NF
  • No transitive dependency — non-key column should NOT depend on another non-key column
  • Example violation: EmpID → Dept → DeptLocation (DeptLocation depends on Dept, not EmpID)

BCNF (Boyce-Codd Normal Form):

  • Stronger version of 3NF
  • For every functional dependency X → Y, X must be a super key

Q26. ⭐ What is the difference between a primary key and a unique key?

Answer:

Primary Key Unique Key
NULL values Not allowed Allowed (one NULL per column)
Count per table Only ONE Multiple can exist
Clustered index Yes (auto) No (non-clustered)
Purpose Uniquely identifies each row Ensures no duplicates in column
CREATE TABLE employees (
    emp_id INT PRIMARY KEY,       -- primary key
    email VARCHAR(100) UNIQUE,    -- unique key
    aadhar VARCHAR(12) UNIQUE     -- another unique key
);

Q27. ⭐ What is a foreign key? What is referential integrity?

Answer: A foreign key is a column in one table that references the primary key of another table. It creates a link between two tables.

Referential Integrity ensures that:

  • You cannot insert a foreign key value that doesn’t exist in the referenced table
  • You cannot delete a primary key row that is referenced by a foreign key (unless CASCADE is set)
CREATE TABLE orders (
    order_id INT PRIMARY KEY,
    customer_id INT,
    FOREIGN KEY (customer_id) REFERENCES customers(id)
        ON DELETE CASCADE     -- delete orders when customer is deleted
        ON UPDATE CASCADE     -- update if customer id changes
);

Q28. ⭐ What are the two integrity rules in DBMS?

Answer: (Actual TCS Prime question — PrepInsta)

1. Entity Integrity Rule: Every table must have a primary key, and the primary key column cannot contain NULL values. Every row must be uniquely identifiable.

2. Referential Integrity Rule: Foreign key values must either:

  • Match a primary key value in the referenced table, OR
  • Be NULL

This prevents orphaned records — you cannot have an Order referencing a Customer that doesn’t exist.


Q29. ⭐ What is a transaction in DBMS? What are ACID properties?

Answer: A transaction is a sequence of database operations treated as a single logical unit.

A — Atomicity: All-or-nothing. If any step fails, the entire transaction rolls back. Example: Bank transfer — deduct from A AND credit to B must both succeed or both fail.

C — Consistency: Transaction takes DB from one valid state to another, maintaining all constraints.

I — Isolation: Concurrent transactions don’t interfere. Intermediate states are invisible to others.

D — Durability: Once committed, changes are permanent — survive system crashes (via write-ahead log).


Q30. ⭐ What is a view in SQL? What are its advantages?

Answer: A view is a virtual table based on a SELECT query. It doesn’t store data physically — it stores the query definition.

-- Create a view
CREATE VIEW high_earners AS
SELECT name, department, salary
FROM employees
WHERE salary > 80000;

-- Use it like a table
SELECT * FROM high_earners WHERE department = 'Engineering';

Advantages:

  • Security — hide sensitive columns from users
  • Simplification — complex queries stored once, reused as simple table
  • Data abstraction — underlying table structure can change without affecting users
  • Aggregation — precompute frequently needed aggregations

Q31. ⭐ What is the difference between clustered and non-clustered index?

Answer:

Clustered Index Non-Clustered Index
Data storage Data physically sorted on disk Separate structure pointing to data
Count per table Only ONE Multiple allowed
Speed Faster for range queries Slightly slower (extra pointer lookup)
Default Created for primary key Created with CREATE INDEX
-- Clustered (primary key creates it automatically)
CREATE TABLE emp (id INT PRIMARY KEY, name VARCHAR(50));

-- Non-clustered
CREATE INDEX idx_name ON emp(name);
CREATE INDEX idx_dept_sal ON emp(department, salary);  -- composite

Q32. ⭐ What is a trigger in SQL? When is it used?

Answer: A trigger is a stored procedure that automatically executes in response to a DML event (INSERT, UPDATE, DELETE) on a table.

-- Trigger: log salary changes
CREATE TRIGGER log_salary_change
AFTER UPDATE ON employees
FOR EACH ROW
BEGIN
    INSERT INTO salary_audit(emp_id, old_salary, new_salary, changed_at)
    VALUES (OLD.id, OLD.salary, NEW.salary, NOW());
END;

Types:

  • BEFORE / AFTER triggers
  • ROW-level / Statement-level triggers

Use cases: Audit logging, enforcing business rules, auto-updating derived columns, cascading changes.


Q33. ⭐ What is a stored procedure? How is it different from a function?

Answer:

Stored Procedure Function
Return value Optional (0 or more) Must return ONE value
Usage Called with CALL/EXECUTE Used in SELECT, WHERE
DML inside Yes Limited (depends on DB)
Exception handling Yes Limited
Purpose Business logic Computation/calculation
-- Stored procedure
CREATE PROCEDURE get_employees_by_dept(IN dept_name VARCHAR(50))
BEGIN
    SELECT * FROM employees WHERE department = dept_name;
END;
CALL get_employees_by_dept('Engineering');

-- Function
CREATE FUNCTION get_annual_salary(monthly DECIMAL(10,2))
RETURNS DECIMAL(10,2)
BEGIN
    RETURN monthly * 12;
END;
SELECT name, get_annual_salary(salary) FROM employees;

Q34. ⭐ What is a cursor in SQL?

Answer: A cursor is a database object used to retrieve and process rows one at a time from a result set (like a pointer/iterator for query results).

DECLARE emp_cursor CURSOR FOR
    SELECT name, salary FROM employees WHERE dept = 'IT';

DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
OPEN emp_cursor;

read_loop: LOOP
    FETCH emp_cursor INTO v_name, v_salary;
    IF done THEN LEAVE read_loop; END IF;
    -- process each row
    SET v_salary = v_salary * 1.10;
    UPDATE employees SET salary = v_salary WHERE name = v_name;
END LOOP;

CLOSE emp_cursor;

When to use: When row-by-row processing is required and set-based operations are not possible. Generally avoided due to performance overhead.


Q35. ⭐ What is ER (Entity-Relationship) model?

Answer: An ER model is a conceptual diagram that describes the structure of a database using entities, attributes, and relationships.

Key components:

  • Entity — Real-world object (Employee, Product, Department)
  • Attribute — Property of entity (Name, Age, Salary)
  • Key Attribute — Uniquely identifies entity (EmployeeID)
  • Relationship — Association between entities (Employee WORKS_IN Department)
  • Cardinality — 1:1, 1:M, M:M relationships

Types of entities:

  • Strong entity — Has its own primary key
  • Weak entity — Depends on another entity (OrderItem depends on Order)

Q36. ⭐ What is denormalization? When would you use it?

Answer: Denormalization is the process of intentionally adding redundancy to a database that was previously normalized, to improve read performance.

When to use:

  • Read-heavy systems where query speed matters more than storage
  • Data warehouses and reporting databases
  • When complex JOINs across many tables are too slow
-- Normalized: need JOIN to get product name with order
SELECT o.id, p.name FROM orders o JOIN products p ON o.product_id = p.id;

-- Denormalized: product_name stored directly in orders table
SELECT id, product_name FROM orders;  -- no JOIN needed, faster

Trade-off: Denormalization sacrifices storage efficiency and data consistency for query speed.



🟢 OPERATING SYSTEMS — Q37 to Q46


Q37. ⭐ What is an operating system? What are its main functions?

Answer: An OS is system software that manages hardware resources and provides services to application programs. It acts as an interface between user and hardware.

Main functions:

  • Process Management — Create, schedule, terminate processes
  • Memory Management — Allocate/deallocate RAM, virtual memory, paging
  • File System Management — Organise, store, retrieve files
  • Device Management — Manage I/O devices via device drivers
  • Security & Access Control — Authentication, permissions, user isolation
  • Networking — Manage network connections and protocols

Examples: Windows, Linux, macOS, Android, iOS


Q38. ⭐ What is the difference between a process and a thread?

Answer:

Process Thread
Definition Program in execution Smallest unit of execution
Memory Own address space Shares process memory
Context switch Expensive Cheaper
Communication IPC (pipes, sockets) Shared memory (direct)
Crash impact Other processes safe Can crash entire process
Creation time Slow Fast
Example Chrome + Word open Multiple Chrome tabs

Q39. ⭐ What is deadlock? What are the four Coffman conditions?

Answer: A deadlock is a situation where two or more processes wait for each other indefinitely, each holding a resource the other needs.

Four Coffman Conditions (ALL must hold for deadlock):

  1. Mutual Exclusion — At least one resource is held in non-sharable mode
  2. Hold and Wait — A process holds at least one resource while waiting for others
  3. No Preemption — Resources cannot be forcibly taken from a process
  4. Circular Wait — A circular chain of processes, each waiting for a resource held by the next

Prevention: Break any ONE condition:

  • Use resource ordering to prevent circular wait (most practical)
  • Allow preemption
  • Use Banker’s Algorithm for deadlock avoidance

Q40. ⭐ What is paging in OS?

Answer: Paging is a memory management scheme that eliminates the need for contiguous physical memory allocation.

  • Logical memory (process view) is divided into equal-sized blocks called pages
  • Physical memory is divided into equal-sized blocks called frames
  • OS maintains a Page Table mapping pages to frames
Process Address Space:     Physical Memory (RAM):
Page 0 → Frame 3           Frame 0: OS
Page 1 → Frame 7           Frame 1: ...
Page 2 → Frame 2           Frame 2: Process Page 2
                           Frame 3: Process Page 0

Advantage: Eliminates external fragmentation. Disadvantage: Internal fragmentation possible; page table overhead.


Q41. ⭐ What is the Round Robin scheduling algorithm?

Answer: (Actual TCS Prime question — PrepInsta)

Round Robin (RR) is a CPU scheduling algorithm designed for time-sharing systems.

  • Each process gets a fixed time slot called time quantum (typically 10–100ms)
  • After the quantum expires, the process is preempted and added back to the end of the ready queue
  • Next process in queue gets the CPU
Time Quantum = 3ms
Processes: P1(6ms), P2(4ms), P3(2ms)

Timeline:
P1(3) → P2(3) → P3(2) → P1(3) → P2(1) = Done

Advantage: Fair, no starvation. Disadvantage: High context switching overhead if quantum is too small; long waiting time if quantum is too large.


Q42. ⭐ What is virtual memory? What is thrashing?

Answer: Virtual memory is a technique that allows executing processes that may not be completely in memory. It uses disk space as an extension of RAM.

When a process references a page not in RAM → Page Fault → OS brings the page from disk (page swapping).

Thrashing occurs when a system spends more time swapping pages in and out of memory than executing actual instructions.

Causes: Too many processes running simultaneously with insufficient RAM. Solution: Reduce degree of multiprogramming, increase RAM, use working set model.


Q43. ⭐ What is the difference between internal and external fragmentation?

Answer:

Internal Fragmentation — Wasted space inside allocated memory blocks. Occurs in fixed-size allocation (paging). If a process needs 18KB and gets 20KB pages → 2KB wasted inside.

External Fragmentation — Wasted space outside allocated memory — enough total free memory exists but not as a contiguous block. Occurs in variable-size allocation (segmentation).

External: [USED 10KB] [FREE 5KB] [USED 8KB] [FREE 5KB] [USED 6KB]
→ 10KB total free but cannot allocate 10KB contiguous block

Internal: Process needs 13KB, page size = 4KB
→ Allocated 4 pages = 16KB → 3KB wasted inside

Q44. ⭐ What are semaphores? What is the difference between binary and counting semaphores?

Answer: A semaphore is a synchronisation primitive (integer variable) used to control access to shared resources in a concurrent system.

Operations:

  • wait(S) / P(S): Decrements S; blocks if S = 0
  • signal(S) / V(S): Increments S; wakes up blocked process

Binary Semaphore (Mutex):

  • Value: 0 or 1 only
  • Used for mutual exclusion (one process at a time)
  • Equivalent to a lock

Counting Semaphore:

  • Value: 0 to N
  • Controls access to a resource pool of N instances
  • Example: DB connection pool of 10 connections → semaphore initialised to 10

Q45. ⭐ What is context switching?

Answer: Context switching is the process of saving the state of a currently running process and loading the state of the next process so the CPU can switch between processes.

State saved/restored (Process Control Block — PCB):

  • Program Counter (next instruction address)
  • CPU registers
  • Memory management info
  • Process state (running, waiting, ready)

Cost: Context switching is pure overhead — CPU does no useful work during the switch. High frequency switching wastes CPU cycles. This is why threads are preferred over processes for concurrency (cheaper context switch).


Q46. ⭐ What is the difference between multiprogramming, multitasking, and multiprocessing?

Answer:

Multiprogramming Multitasking Multiprocessing
Definition Multiple programs in memory Multiple tasks sharing CPU (time-sharing) Multiple CPUs executing simultaneously
Goal Maximise CPU utilisation Improve responsiveness to users True parallelism
CPU count One One Multiple
Example Batch OS Modern desktop OS Multi-core processor


🔵 COMPUTER NETWORKS — Q47 to Q56


Q47. ⭐ Explain the OSI model with all 7 layers.

Answer:

Layer Name Function Protocol/Example
7 Application User interface, app services HTTP, HTTPS, FTP, DNS, SMTP
6 Presentation Data formatting, encryption, compression SSL/TLS, JPEG, ASCII
5 Session Establish, manage, terminate sessions NetBIOS, RPC
4 Transport End-to-end delivery, error control, flow control TCP, UDP
3 Network Logical addressing, routing IP, ICMP, ARP
2 Data Link Physical addressing (MAC), error detection Ethernet, Wi-Fi (802.11)
1 Physical Raw bit transmission over physical medium Cables, Hubs, Repeaters

Memory trick: “All People Seem To Need Data Processing” (bottom to top: Physical, Data Link, Network, Transport, Session, Presentation, Application)


Q48. ⭐ What is the difference between TCP and UDP?

Answer:

TCP UDP
Connection Connection-oriented (handshake) Connectionless
Reliability Guaranteed delivery, ACK No guarantee
Order Maintains order No ordering
Speed Slower Faster
Header size 20 bytes 8 bytes
Use case File transfer, web, email Live streaming, gaming, DNS
TCP 3-way handshake:
Client → SYN → Server
Client ← SYN-ACK ← Server
Client → ACK → Server
[Connection established]

Q49. ⭐ What is an IP address? What is the difference between IPv4 and IPv6?

Answer: An IP address is a numerical label assigned to each device on a network that uses the Internet Protocol for communication.

IPv4 IPv6
Length 32 bits 128 bits
Format Dotted decimal: 192.168.1.1 Hexadecimal: 2001:0db8:85a3::8a2e:0370:7334
Addresses ~4.3 billion ~340 undecillion
NAT required Yes (due to shortage) No
Header 20 bytes (min) 40 bytes (fixed)

Q50. ⭐ What is a firewall? How is it different from IDS/IPS?

Answer: (Actual TCS Prime question — PrepInsta)

Firewall — Network security device that monitors and controls incoming/outgoing traffic based on predefined rules. Operates at Layer 3/4 of OSI. Blocks/allows packets based on IP, port, protocol.

IDS (Intrusion Detection System) — Monitors network traffic for suspicious activity and alerts administrators. Passive — doesn’t block.

IPS (Intrusion Prevention System) — Like IDS but actively blocks threats in real-time. Inline device.

Firewall IDS IPS
Action Block/Allow Alert only Alert + Block
Position Network perimeter Monitor mode Inline
Threat type Known rule violations Anomalies/signatures Both

Q51. ⭐ What is DNS? How does it work?

Answer: DNS (Domain Name System) translates human-readable domain names (www.google.com) into IP addresses (142.250.195.36).

DNS Resolution process:

  1. User types www.google.com
  2. Browser checks local cache — if found, done
  3. Query goes to Recursive Resolver (usually ISP’s DNS)
  4. Resolver queries Root Name Server → points to .com TLD server
  5. TLD server → points to google.com Authoritative Name Server
  6. Authoritative server → returns IP address 142.250.195.36
  7. Browser connects to that IP

DNS record types: A (IPv4), AAAA (IPv6), CNAME (alias), MX (mail), TXT (verification)


Q52. ⭐ What is the difference between HTTP and HTTPS?

Answer:

HTTP HTTPS
Full form HyperText Transfer Protocol HTTP Secure
Security No encryption Encrypted via SSL/TLS
Port 80 443
Certificate Not required SSL/TLS certificate required
Data exposure Transmitted as plain text Encrypted
Use case Non-sensitive public content Login, payments, banking

How HTTPS works:

  1. Client requests HTTPS connection
  2. Server sends SSL certificate
  3. Client verifies certificate (CA signed?)
  4. Client generates session key, encrypts with server’s public key
  5. Server decrypts with private key
  6. Encrypted communication begins using session key

Q53. ⭐ What is a MAC address? How is it different from an IP address?

Answer:

MAC Address IP Address
Full form Media Access Control Internet Protocol
Layer Data Link (Layer 2) Network (Layer 3)
Assigned by Manufacturer (hardcoded) Network admin or DHCP
Uniqueness Globally unique per device Unique within network
Changeability Cannot be changed (normally) Can be changed
Format 48-bit, e.g., AA:BB:CC:DD:EE:FF 32-bit (IPv4): 192.168.1.1
Purpose Local network delivery Cross-network delivery

Q54. ⭐ What is the difference between a router, switch, and hub?

Answer:

Hub Switch Router
Layer Physical (1) Data Link (2) Network (3)
Addressing None (broadcasts all) MAC address IP address
Traffic Broadcasts to all ports Sends to specific port Routes between networks
Intelligence None Medium High
Collision domain One for all ports One per port Separate per interface
Use case Legacy/obsolete LAN within organisation Connect LAN to internet

Q55. ⭐ What is the concept of subnetting?

Answer: Subnetting is the process of dividing a large network into smaller sub-networks (subnets) to improve performance, security, and address management.

CIDR Notation: 192.168.1.0/24

  • /24 means 24 bits for network, 8 bits for hosts
  • Hosts = 2^8 – 2 = 254 usable host addresses

Subnet Mask: 255.255.255.0 (for /24)

Why subnet?

  • Reduces broadcast traffic
  • Improves security (isolate departments)
  • More efficient IP address usage
Network: 192.168.1.0/24 → split into 4 subnets:
Subnet 1: 192.168.1.0/26   (62 hosts) → Engineering
Subnet 2: 192.168.1.64/26  (62 hosts) → Marketing
Subnet 3: 192.168.1.128/26 (62 hosts) → Finance
Subnet 4: 192.168.1.192/26 (62 hosts) → HR

Q56. ⭐ What happens when you type www.google.com in your browser and press Enter?

Answer: (Exact TCS Digital question — very popular)

  1. DNS lookup — Browser checks cache → OS cache → Router cache → ISP DNS → Root/TLD/Authoritative servers → gets IP 142.250.x.x
  2. TCP 3-way handshake — SYN → SYN-ACK → ACK with server IP:443
  3. TLS/SSL handshake — Certificate exchange, session key negotiation (for HTTPS)
  4. HTTP GET requestGET / HTTP/1.1 Host: www.google.com
  5. Server processing — Web server receives request → application server processes → DB queries if needed
  6. HTTP response — Server sends HTML, CSS, JS, images
  7. Browser rendering — Parses HTML → builds DOM → processes CSS → executes JS → paints page
  8. Connection — TCP kept alive (keep-alive header) for subsequent resource requests


💻 CODING ON PAPER — Q57 to Q70


Q57. ⭐ Write a program to reverse a linked list. (Actual TCS Prime — paper coding)

Answer:

class Node:
    def __init__(self, val):
        self.val = val
        self.next = None

def reverse(head):
    prev = None
    curr = head
    while curr:
        nxt = curr.next
        curr.next = prev
        prev = curr
        curr = nxt
    return prev   # new head

# Time: O(n)  Space: O(1)

Q58. ⭐ Write a program to find if a number is prime. (Actual TCS TR — paper coding)

Answer:

def is_prime(n):
    if n < 2:
        return False
    if n == 2:
        return True
    if n % 2 == 0:
        return False
    for i in range(3, int(n**0.5) + 1, 2):
        if n % i == 0:
            return False
    return True

# Optimised: only check up to sqrt(n)
# Time: O(sqrt(n))

Q59. ⭐ Write a program to find all words with more than 8 characters in a sentence. (Actual TCS Digital — paper coding)

Answer:

sentence = "TCS is a multinational technology company headquartered in Mumbai"
result = [w for w in sentence.split() if len(w) > 8]
print(result)
# Output: ['multinational', 'technology', 'headquartered']

Q60. ⭐ Write a program to find the frequency of each character in a string. (Actual TCS TR — paper coding)

Answer:

def char_frequency(s):
    freq = {}
    for ch in s:
        freq[ch] = freq.get(ch, 0) + 1
    for ch, count in sorted(freq.items()):
        print(f"'{ch}': {count}")

char_frequency("programming")
# 'a': 1, 'g': 2, 'i': 1, 'm': 2, 'n': 1, 'o': 1, 'p': 1, 'r': 2

Q61. ⭐ Write a program to find the square root of a number without using sqrt(). (Actual TCS Prime — exact PYQ)

Answer:

def sqrt_binary(n):
    if n < 2:
        return n
    low, high, ans = 1, n // 2, 0
    while low <= high:
        mid = (low + high) // 2
        if mid * mid == n:
            return mid
        elif mid * mid < n:
            ans = mid
            low = mid + 1
        else:
            high = mid - 1
    return ans   # floor of sqrt

print(sqrt_binary(6096))  # 78
print(sqrt_binary(25))    # 5
# Time: O(log n)

Q62. ⭐ Print a star pattern (N rows triangle). (Actual TCS TR — paper coding)

Answer:

n = 5
# Right triangle
for i in range(1, n + 1):
    print('* ' * i)

# Output:
# *
# * *
# * * *
# * * * *
# * * * * *

# Pyramid pattern
for i in range(1, n + 1):
    print(' ' * (n - i) + '* ' * i)

Q63. ⭐ Write a program to check if a string is a palindrome. (Actual TCS TR)

Answer:

def is_palindrome(s):
    s = s.lower().replace(' ', '')   # clean input
    return s == s[::-1]

print(is_palindrome("racecar"))   # True
print(is_palindrome("hello"))     # False
print(is_palindrome("A man a plan a canal Panama"))  # True

Q64. ⭐ Write code to find the length of the Longest Palindromic Subsequence. (Actual TCS Prime — exact PYQ from GeeksforGeeks)

Answer:

def lps(s):
    n = len(s)
    t = s[::-1]                    # reverse = LCS trick
    dp = [[0]*(n+1) for _ in range(n+1)]
    for i in range(1, n+1):
        for j in range(1, n+1):
            if s[i-1] == t[j-1]:
                dp[i][j] = dp[i-1][j-1] + 1
            else:
                dp[i][j] = max(dp[i-1][j], dp[i][j-1])
    return dp[n][n]

print(lps("bbabcbcab"))  # 7 ("babcbab")
# Time: O(n^2)  Space: O(n^2)

Q65. ⭐ Write code to create an upper triangular matrix. (Actual TCS Prime — exact coding PYQ)

Answer:

def upper_triangular(matrix):
    n = len(matrix)
    for i in range(n):
        for j in range(n):
            if j < i:
                matrix[i][j] = 0
    return matrix

mat = [[1,2,3],[4,5,6],[7,8,9]]
result = upper_triangular(mat)
for row in result:
    print(row)
# [1, 2, 3]
# [0, 5, 6]
# [0, 0, 9]

Q66. ⭐ Write code for Binary Search. (Actual TCS Digital TR — paper coding)

Answer:

def binary_search(arr, target):
    low, high = 0, len(arr) - 1
    while low <= high:
        mid = (low + high) // 2
        if arr[mid] == target:
            return mid        # found at index mid
        elif arr[mid] < target:
            low = mid + 1     # search right half
        else:
            high = mid - 1    # search left half
    return -1                 # not found

arr = [1, 3, 5, 7, 9, 11, 13]
print(binary_search(arr, 7))   # 3
print(binary_search(arr, 6))   # -1
# Time: O(log n)

Q67. ⭐ Write code to detect a cycle in a linked list. (Actual TCS Prime — paper coding)

Answer:

class Node:
    def __init__(self, val):
        self.val = val
        self.next = None

def has_cycle(head):
    slow = fast = head
    while fast and fast.next:
        slow = slow.next           # move 1 step
        fast = fast.next.next     # move 2 steps
        if slow == fast:
            return True           # cycle detected
    return False

# Floyd's Tortoise and Hare Algorithm
# Time: O(n)  Space: O(1)

Q68. ⭐ Write code to implement a stack using an array. (Actual TCS Digital TR)

Answer:

class Stack:
    def __init__(self, capacity):
        self.stack = []
        self.capacity = capacity

    def push(self, val):
        if len(self.stack) == self.capacity:
            print("Stack Overflow")
            return
        self.stack.append(val)

    def pop(self):
        if not self.stack:
            print("Stack Underflow")
            return None
        return self.stack.pop()

    def peek(self):
        return self.stack[-1] if self.stack else None

    def is_empty(self):
        return len(self.stack) == 0

s = Stack(3)
s.push(10); s.push(20); s.push(30)
print(s.pop())   # 30
print(s.peek())  # 20

Q69. ⭐ Write a program to demonstrate abstraction using OOP. (Actual TCS Digital — exact coding question)

Answer:

from abc import ABC, abstractmethod

class Shape(ABC):             # Abstract class
    @abstractmethod
    def area(self):           # Abstract method
        pass

    @abstractmethod
    def perimeter(self):
        pass

    def describe(self):       # Concrete method
        print(f"Area: {self.area():.2f}, Perimeter: {self.perimeter():.2f}")

class Circle(Shape):
    def __init__(self, r):
        self.r = r
    def area(self):
        return 3.14 * self.r ** 2
    def perimeter(self):
        return 2 * 3.14 * self.r

class Rectangle(Shape):
    def __init__(self, l, w):
        self.l, self.w = l, w
    def area(self):
        return self.l * self.w
    def perimeter(self):
        return 2 * (self.l + self.w)

Circle(5).describe()       # Area: 78.50, Perimeter: 31.40
Rectangle(4, 6).describe() # Area: 24.00, Perimeter: 20.00

Q70. ⭐ Write code to find the Fibonacci series using both recursion and dynamic programming. (Actual TCS TR — exact PYQ)

Answer:

# Method 1: Recursion (simple, exponential time)
def fib_recursive(n):
    if n <= 1: return n
    return fib_recursive(n-1) + fib_recursive(n-2)
# Time: O(2^n) — very slow for large n

# Method 2: Dynamic Programming (memoisation)
from functools import lru_cache
@lru_cache(maxsize=None)
def fib_memo(n):
    if n <= 1: return n
    return fib_memo(n-1) + fib_memo(n-2)
# Time: O(n)  Space: O(n)

# Method 3: DP Tabulation (most efficient)
def fib_dp(n):
    if n <= 1: return n
    dp = [0] * (n + 1)
    dp[1] = 1
    for i in range(2, n + 1):
        dp[i] = dp[i-1] + dp[i-2]
    return dp[n]
# Time: O(n)  Space: O(n)

print([fib_dp(i) for i in range(10)])
# [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]


🧠 BEHAVIOURAL + SCENARIO — Q71 to Q82


Q71. ⭐ Tell me about a time you failed. What did you learn?

Answer (STAR): Situation: In my 3rd semester, I was overconfident going into the database design exam and didn’t revise thoroughly.

Task: Score well and understand relational design concepts deeply.

Action: I failed to account for a complex normalisation question. After the exam, I didn’t make excuses — I revisited the entire topic, built a small database project from scratch, and taught it to a classmate to reinforce my understanding.

Result: In my next related exam I scored 92%. More importantly, DBMS became one of my strongest interview topics. Failure taught me that confidence without preparation is arrogance.


Q72. ⭐ Describe a project you are most proud of. Walk me through it technically.

Answer (Framework):

  1. Problem statement — What problem did it solve?
  2. Tech stack — Languages, frameworks, databases used
  3. Architecture — How the system was designed (frontend → backend → DB)
  4. Your specific contribution — Not the team’s work, YOUR work
  5. Challenges faced — Technical hurdles and how you overcame them
  6. Outcome/impact — Results, users, performance improvements

Sample opening: “My most proud project is a real-time attendance management system I built using Flask, SQLite, and OpenCV for face recognition. The problem was our college’s manual attendance was error-prone and time-consuming. I designed the database schema, built the REST API, and integrated face detection — which was my biggest challenge because accuracy dropped in low-light conditions. I solved it by adding image preprocessing…”


Q73. ⭐ How do you handle disagreements with teammates or a senior?

Answer: “I believe disagreements are healthy when handled constructively. My approach is to first ensure I fully understand the other person’s point — I listen completely before responding. If I disagree with a senior, I frame it professionally: ‘I see your point, may I share a concern?’ and present data or reasoning to support my view. If the disagreement is with a peer, I suggest we take both approaches to a smaller test scenario and let results decide. I’ve found that separating the idea from the person makes technical disagreements much easier to resolve. Ultimately, I defer to hierarchy when a decision must be made, but I always ensure my concern is documented.”


Q74. ⭐ Give an example where you showed leadership.

Answer (STAR): “During our final year project, our team of four had unclear responsibilities and we were behind schedule two weeks before the deadline. I recognised that nobody had taken ownership, so I stepped up — I called a meeting, mapped out remaining tasks, assigned them based on each person’s strengths, and set daily check-in deadlines. I also paired the weakest team member with myself for the database component so nothing would block progress. We submitted on time with a complete feature set. Our guide complimented the project’s quality. This taught me that leadership isn’t about authority — it’s about taking responsibility when others hesitate.”


Q75. ⭐ What would you do if you were given an impossible deadline?

Answer: “My first step would be to break the task down and get a realistic estimate of what’s achievable. I would immediately communicate transparently with my manager: ‘Here is what can be delivered by X date and here is what cannot — what is the priority?’ I would not promise something I cannot deliver and then fail silently. I believe setting honest expectations early is far better than delivering incomplete work at the last minute. I would also look for ways to optimise — reduce scope, automate repetitive tasks, or ask for temporary resources. If the deadline genuinely cannot move, I would work extended hours for a short sprint but flag that this isn’t sustainable long-term.”


Q76. ⭐ You have a bug in production that is affecting thousands of users. What do you do?

Answer: “Step one is immediate containment — if there’s a rollback available, I roll back to the last stable version while we investigate. If not, I check if the bug can be patched with a hotfix in under an hour. Step two is identification — I look at logs, error reports, and replicate the issue locally. Step three is communication — I inform the team lead immediately and provide a clear status update. I never go silent during an incident. Step four is fix and test — write the fix, test it in staging, then deploy with monitoring. Step five is post-mortem — after resolution, I document what went wrong, why, and what preventive measure stops it from happening again.”


Q77. ⭐ How do you prioritise tasks when you have multiple deadlines?

Answer: “I use a combination of urgency and importance — the Eisenhower Matrix approach. I first identify what’s truly urgent AND important (do immediately), what’s important but not urgent (schedule), what’s urgent but not important (delegate if possible), and what’s neither (drop or defer). I also consider dependencies — which task blocks others. I communicate early if I think something is at risk. In practice, I maintain a task list with deadlines and estimate time per task at the start of each day. This visual clarity prevents the feeling of being overwhelmed and ensures I’m making conscious priority decisions rather than reactive ones.”


Q78. ⭐ Tell me about a time you had to learn something very quickly.

Answer (STAR): “Situation: During my internship, I was suddenly assigned to a task that required React.js — a framework I hadn’t formally learned.

Task: Build a dashboard component in one week.

Action: I spent the first day going through the official React docs and building a mini to-do app. On day 2, I started the actual task with a simplified scope and gradually added complexity. I asked targeted questions to senior developers rather than general ‘how does React work’ questions.

Result: I delivered the dashboard component within 5 days. My manager said it was ‘production-ready’ with minor tweaks. This experience reinforced my belief that the fastest way to learn a technology is to build something real with it immediately.”


Q79. ⭐ What is your biggest strength? How does it apply to software engineering?

Answer: “My biggest strength is structured problem decomposition — the ability to take a complex problem and break it into smaller, manageable parts before writing a single line of code. In software engineering, this directly maps to system design, where rushing to code without clarity creates technical debt. When I face a difficult coding problem, I spend the first 20% of the time understanding and decomposing it — drawing the flow, identifying edge cases, planning the data structures — before I write anything. This approach consistently produces cleaner solutions. It also helps me communicate clearly with non-technical stakeholders, because I can translate a complex system into understandable components.”


Q80. ⭐ If a team member is not contributing and it’s affecting your project, what will you do?

Answer: “I would first try to understand if there’s a genuine reason — personal issues, lack of clarity on tasks, skill gaps. I would have a private, non-judgmental conversation: ‘I noticed you’ve been quiet on the project — is there anything I can help with?’ Many times, people are struggling silently. If it’s a skills gap, I would offer to pair with them. If they are simply disengaged, I would have an honest conversation: ‘Our deadline is X and we need Y from you specifically.’ If the issue persists and starts genuinely risking the project, I would escalate to the team lead — not to get them in trouble, but because the project’s success and the entire team’s effort deserves protection.”


Q81. ⭐ Are you comfortable working in a team or alone? Which do you prefer?

Answer: “I work effectively in both environments and adapt based on what the situation demands. For creative and exploratory tasks — like architecting a solution or debugging a tricky problem — I do my best thinking independently. For execution, review, and iteration — sharing code, discussing approaches, catching each other’s blind spots — a team is far superior. In a professional setting, both skills are essential. My internship gave me experience in a cross-functional team of 6, and I’ve also completed significant solo projects. I’m genuinely comfortable in both modes.”


Q82. ⭐ How do you stay updated with technology trends?

Answer: “I have a structured approach. For daily updates I follow specific newsletters — TLDR Tech, The Pragmatic Engineer. For deep dives I use official documentation, YouTube channels like Fireship, and read tech blogs from companies like Netflix Engineering, Uber Engineering, and Google Research. I try to build something small with any new technology I read about — theory without practice is forgettable. I’m also active on GitHub, where I explore popular open-source repositories to understand how production-level code is structured. Recently I’ve been tracking developments in vector databases and RAG systems for AI applications.”



📊 MANAGERIAL ROUND — Q83 to Q91


Q83. ⭐ What is your opinion on Work From Home vs Work From Office?

Answer: “Both modes have genuine strengths. Office work is invaluable early in a career — the informal knowledge transfer, mentorship, and cultural absorption that happen organically in an office are very difficult to replicate remotely. For a fresher joining TCS, the office environment would accelerate my learning significantly. Remote work, on the other hand, offers focused deep-work time, eliminates commute, and can be more productive for autonomous tasks. I believe a hybrid model captures the best of both. I am completely adaptable to whatever model TCS requires for my project, and I’ve already practiced self-discipline through online learning and solo project work.”


Q84. ⭐ If we give you a technology you have never worked with, how will you handle it?

Answer: “I would treat it as an opportunity rather than a challenge. My approach is: first, spend a day with the official documentation to understand the core concepts and mental model of the technology. Second, build the smallest possible working program — even a ‘Hello World’ equivalent for that technology — to break the psychological barrier. Third, attempt a simplified version of the actual task. Fourth, use targeted questions to seniors or communities like Stack Overflow for specific blockers — never general ‘how does X work’ questions.

I learned Python this way in three weeks while already knowing C and Java. The underlying concepts — variables, loops, functions, OOP — transfer across languages. What changes is syntax and idioms, and those are learnable quickly with practice.”


Q85. ⭐ If we downgrade your offer from Digital to Ninja, would you accept?

Answer: “I appreciate you being direct with this question. I’ll be equally direct — my preparation, the profile I interviewed for, and my career expectations are aligned with the Digital profile. I wouldn’t want to start my career at TCS under the wrong expectations on either side.

That said, I genuinely want to work at TCS. If there is a clear path and timeline to transition to Digital based on performance, and if the work I’d be doing as a Ninja fresher gives me meaningful exposure, I’d want to understand that roadmap clearly before deciding. I believe in making informed decisions rather than emotional ones.”


Q86. ⭐ You are from ECE. Why did you choose IT over core electronics?

Answer: “ECE gave me a strong foundation in systems thinking, embedded logic, and how hardware and software interact at the fundamental level. During my second year, I built a project that combined sensors with a web dashboard — that intersection of hardware and software was what drew me to programming. I realised that software could reach millions of people in a way that hardware products alone couldn’t.

Since then, I’ve deliberately built my software skills — DSA, web development, databases, and system design. My ECE background is actually an advantage in IT, especially for roles involving IoT, embedded systems, or cloud-connected hardware. I see it as a complement, not a compromise.”


Q87. ⭐ What do you know about TCS’s business and current initiatives?

Answer: “TCS is India’s largest IT services company by market capitalisation — approximately $168 billion as of early 2025 — and consistently one of the top 10 IT companies globally. TCS operates in 46 countries with over 600,000 employees.

Currently, TCS is heavily investing in AI through its TCS.AI platform, offering GenAI services to enterprise clients. Their TCS Pace innovation hubs focus on quantum computing, cloud, and AI research. TCS has significant presence in BFSI, healthcare, retail, and government sectors. Recent wins include major cloud transformation deals with European financial institutions and a long-term partnership with Jaguar Land Rover. Their iON platform handles large-scale digital assessments, and BaNCS is a leading banking product used globally.”


Q88. ⭐ If your manager gives you a task you disagree with technically, what will you do?

Answer: “My first step is to make sure I fully understand the reasoning — sometimes a technical decision that looks wrong has context I’m missing. I would ask: ‘Could you help me understand the constraints driving this approach?’ If after understanding their perspective I still have a genuine concern, I would raise it professionally: ‘I understand your approach. I have a concern about X — may I share it?’ and back it with data, benchmarks, or a concrete example.

If my concern is heard but overruled, I’d accept the decision and execute it to the best of my ability — expressing disagreement and then delivering poorly is worse than just complying. However, I would document my concern so if an issue arises later there’s a record. Healthy technical disagreement expressed respectfully is what separates good engineers from yes-men.”


Q89. ⭐ How would you handle a very difficult client who is never satisfied?

Answer: “Difficult clients are usually driven by unmet expectations, not personality. My approach would be to first understand exactly what ‘satisfied’ means to them — what specific outcome would make them happy? Often, frustration comes from vague requirements that led to vague delivery.

I would set up a structured communication cadence — weekly updates with concrete metrics, not general ‘we’re working on it’ updates. I would involve them in milestone reviews so they see progress incrementally rather than only at final delivery. If expectations are genuinely unreasonable, I would involve my manager early — never promise what cannot be delivered just to keep peace in the short term. Ultimately, a good client relationship is built on predictability and honesty, not just saying yes.”


Q90. ⭐ Where do you see yourself in 5 years?

Answer: “In five years I want to be a technically strong engineer with deep expertise in at least one domain — my current interest is in cloud-native systems and distributed architecture. I want to have contributed meaningfully to at least 2–3 end-to-end enterprise projects, preferably with client-facing exposure. At TCS, that would put me at the IT Analyst or Assistant Consultant level on the technical track.

Beyond titles, I want to be someone my team comes to for technical guidance — not because I’m the most senior, but because I’ve consistently delivered quality work and mentored others. I’m committed to continuous learning through TCS’s internal training platforms and relevant cloud certifications.”


Q91. ⭐ What motivates you when work becomes repetitive or boring?

Answer: “I look for the hidden learning within repetition. Even in repetitive tasks, there’s usually a way to optimise, automate, or refactor — finding that keeps me engaged. If I’m doing the same data transformation daily, I’ll write a script that does it in seconds. That’s how many great tools get built.

If the task is genuinely unavoidable and repetitive with no room for optimisation, I stay motivated by connecting it to the bigger outcome — ‘this report I’m generating matters to the client’s decision-making.’ I’m also honest with myself — if I’ve been on the same work for a long time with no growth, I’d have a conversation with my manager about new opportunities, because intellectual stagnation doesn’t serve either me or the company.”



🤝 HR + PERSONAL — Q92 to Q100


Q92. ⭐ Why should we hire you?

Answer: “You should hire me because I bring three things that matter specifically for TCS Digital: technical depth in the areas you test for — OOPs, DSA, databases, and systems — demonstrated through my consistent preparation and [specific project/achievement]. Second, I have a genuine curiosity about technology that means I’ll keep learning without being pushed to. Third, I communicate well — I can explain technical concepts to non-technical people, which matters in a client-facing organisation like TCS.

I’m not just looking for a job. I want to build a career at TCS, and I’ve been deliberately preparing for this profile, not applying everywhere and hoping something sticks.”


Q93. ⭐ What is your biggest weakness?

Answer: “My biggest weakness is that I sometimes over-engineer solutions — I tend to think about edge cases and scalability even when the immediate requirement doesn’t need them. This can slow down delivery of simple tasks.

I’ve been actively working on this by setting internal scope boundaries before I start coding: ‘For this task, good enough is X — don’t go beyond it unless asked.’ This has significantly improved my delivery speed. I’ve learned that premature optimisation, as the saying goes, is the root of all evil — there’s a time for robustness and a time for speed.”


Q94. ⭐ Tell me about yourself.

Answer (Structure): “My name is [Name]. I’m a [Branch] engineering graduate from [College]. I chose engineering because [genuine reason], and I gravitated toward software during [specific moment/project].

Technically, I’m strongest in [2–3 skills], and I have hands-on experience through [project/internship] where I [specific achievement]. My most meaningful technical work was [one project], where I [what you built, what problem it solved].

Beyond academics, I [relevant extra-curricular that shows discipline or curiosity]. I applied to TCS Digital specifically because [genuine specific reason related to TCS’s work]. I’m excited about the opportunity to contribute to [specific TCS domain/project type].”


Q95. ⭐ Do you have any other offer? How are you deciding between companies?

Answer: “Yes, I have [/I’m in the process with] [Company X]. My decision criteria are: the quality of technical work I’d be doing in the first 2 years, the learning infrastructure available, the company’s scale and global presence, and the team culture.

TCS stands out because of its scale — working on systems that serve millions of users is genuinely different from smaller environments, and that exposure early in a career is invaluable. The TCS Digital profile specifically, with its focus on emerging technologies, aligns with the kind of engineering I want to do.

I haven’t decided yet but TCS Digital is my top preference.”


Q96. ⭐ Are you comfortable with night shifts or extended working hours when required?

Answer: “Yes, I understand that the nature of enterprise IT delivery — especially with global clients across time zones — sometimes requires flexibility in working hours. I’m comfortable with that, especially for time-bound deliverables like go-live support or production incidents. I believe this kind of commitment is part of what makes a professional reliable.

That said, I also value sustainable work practices for long-term productivity. I’d aim to ensure that extended hours are the exception for genuine business needs rather than a substitute for poor planning. I’m committed to doing what the role requires.”


Q97. ⭐ How do you rate yourself in your favourite programming language on a scale of 1–10?

Answer: “I’d rate myself a 7.5 in Python — my strongest language. I’m very comfortable with core Python: data structures, OOP principles, file handling, generators, decorators, and standard libraries. I’ve used it for [projects].

I rate myself 7.5 and not higher because there are areas I’m still actively developing — asynchronous programming with asyncio, metaclasses, and some performance profiling tools. I believe a 9 or 10 would mean there’s nothing left to learn, which is never true in any technology. I prefer honest self-assessment — I know what I know and I know what I don’t.”


Q98. ⭐ What are your hobbies? How do they relate to your professional life?

Answer: “Outside of academics, I enjoy [genuine hobby]. If it’s technical: ‘I enjoy contributing to open-source projects on GitHub — it has taught me how to read and understand codebases I didn’t write, which is one of the most underrated professional skills.’ Or if non-technical: ‘I play chess, which has strengthened my ability to think multiple steps ahead before acting — something I directly apply when designing system architecture or debugging complex problems.’

[Connect the hobby to a professional trait — discipline, problem-solving, creativity, communication.] I believe who you are outside work shapes how you work, and I try to bring that intentionality to both.”


Q99. ⭐ Do you have any questions for us?

Answer: “Yes, I have three:

First — What does the onboarding and initial training journey look like for a Digital hire? How quickly would I be expected to work on client-facing projects?

Second — What technologies or domains are TCS Digital fresh hires currently being oriented toward — are there specific cloud platforms, AI stacks, or industry verticals that are growing?

Third — How does TCS evaluate performance during the first year for fresher engineers? What does a strong first-year trajectory look like from your observation?”

(Never ask about salary, leave policy, or work hours in the first interview.)


Q100. ⭐ What is the current market cap of TCS? Tell me something recent about TCS.

Answer: (Actual TCS Digital HR question — exact PYQ from PrepInsta Prime)

“As of March 2025, TCS’s market capitalisation is approximately $168 billion USD (around ₹14 lakh crore), making it consistently India’s most valuable company by market cap and one of the top global IT firms.

Recent TCS developments worth mentioning:

  • TCS launched its TCS.AI platform offering GenAI-powered enterprise services
  • TCS Pace Ports innovation hubs are actively researching quantum computing and cloud AI
  • TCS recently won a multi-year cloud transformation deal with a major European bank
  • Their BaNCS banking platform continues to dominate globally with new implementations
  • TCS employs over 600,000 people across 46+ countries — a testament to its scale
  • TCS has been working on eGovernance modernisation projects in India including the income tax portal”


COMPLETE 100-QUESTION MASTER REFERENCE

Category Q# Count Round
🔷 SQL Q1–Q12 12 TR
🟠 OOPs Q13–Q24 12 TR
🟡 DBMS Q25–Q36 12 TR
🟢 Operating Systems Q37–Q46 10 TR
🔵 Computer Networks Q47–Q56 10 TR
💻 Coding on Paper Q57–Q70 14 TR
🧠 Behavioural + Scenario Q71–Q82 12 TR/MR
📊 Managerial Round Q83–Q91 9 MR
🤝 HR + Personal Q92–Q100 9 HR

Final Preparation Strategy:

  • SQL: Practice writing queries by hand — no IDE help. Focus on JOINs, GROUP BY, subqueries, window functions
  • OOPs: Be able to write actual code for every concept, not just define it
  • DBMS: Normalization + ER diagrams + ACID are non-negotiable
  • OS: Deadlock, scheduling, paging — understand the WHY, not just definitions
  • Networks: OSI model + TCP/UDP + DNS flow — draw the diagrams
  • Coding: Practise on paper with a pen. No autocomplete, no Google
  • Behavioural: Prepare 5 real stories from your life using STAR format — reuse them across questions
  • HR: Research TCS’s recent news 24 hours before your interview