NBKRIST JavaHub – Interview Q&A

Infosys Interview Preparation – Core Technical Topics

☕ Core Java Questions

OOP organizes code into objects. Advantages: modularity, encapsulation, inheritance, polymorphism, abstraction, and reusability.

Immutable strings can’t be changed once created. Java makes them immutable for thread-safety, caching, and security.

StringBuilder (faster, non-synchronized) and StringBuffer (thread-safe, synchronized).

String: Immutable. StringBuffer: Mutable and synchronized, suitable for multi-threaded use.

Arrays have fixed size and homogeneous data. Lists are dynamic and part of Java Collections Framework.

Array: primitive structure. List implemented by ArrayList, LinkedList, Vector, Stack.

List – ordered, duplicates allowed. Set – unordered, unique elements. Map – key-value pairs, unique keys.

Single, Multilevel, Hierarchical. Multiple inheritance via interfaces only.

Yes, using default and static methods inside interfaces.

Static (compile-time) via method overloading. Dynamic (runtime) via overriding (polymorphism).

Java compiles to bytecode that runs on any JVM (“Write Once, Run Anywhere”).

Stack: local variables, method calls. Heap: objects managed by Garbage Collector.

Constant value that can’t change once initialized.

Constructors initialize objects (no return type). Methods define behavior and have a return type.

Public: accessible anywhere. Private: only within class – supports encapsulation.

🧮 RDBMS – SQL Questions

SELECT MAX(salary) FROM employees WHERE salary < (SELECT MAX(salary) FROM employees);

WHERE filters rows before grouping. HAVING filters after aggregation.

SELECT e.name, d.dept_name FROM employee e JOIN department d ON e.dept_id = d.id;

SELECT dept_id, COUNT(*) FROM employee GROUP BY dept_id;

Use COALESCE() or ISNULL() to replace NULLs.

UPDATE employee SET salary = salary * 1.10;

Speeds up searches by minimizing full table scans using B-tree or hash structures.

SELECT * FROM employee WHERE join_date >= CURDATE() - INTERVAL 30 DAY;

Primary: unique row identifier. Foreign: establishes relation between tables.

DELETE FROM employees WHERE id NOT IN (SELECT MIN(id) FROM employees GROUP BY name, salary);

🌐 Computer Networks Questions

Interconnected devices share data and resources.

LAN (local), MAN (metro), WAN (wide), PAN (personal).

IPv4: 32-bit. IPv6: 128-bit, more secure and scalable.

Physical, Data Link, Network, Transport, Session, Presentation, Application.

TCP: reliable, connection-oriented. UDP: faster, connectionless.

Router: connects networks. Switch: connects devices. Hub: broadcasts to all.

Domain Name System translates domain names to IP addresses.

Hardware address identifying a device; unique and permanent.

Monitors and filters network traffic for security.

Assigns dynamic IP addresses automatically to devices.

⚙️ Operating Systems Questions

Manages hardware, software, memory, and user interaction.

Process: independent execution. Thread: lightweight unit within a process.

Two or more processes waiting indefinitely for each other’s resources.

FCFS, SJF, Round Robin, Priority Scheduling.

Uses part of disk as temporary RAM for large programs.

Mutex: single resource lock. Semaphore: manages multiple instances.

CPU saves and restores process state during multitasking.

Organizes and manages data storage (e.g., FAT32, NTFS, ext4).

New → Ready → Running → Waiting → Terminated.

Contiguous (fixed/variable) and Non-contiguous (paging, segmentation).