# HCLTech Core CS Questions with Answers

8 previously-asked core cs questions from HCLTech's hiring process, each with the correct answer and a worked explanation. Written against the company's actual test pattern.

_Source: Astra (https://useastra.in). Updated 2026-09-05._

### 1. Which SQL command is used to add a new column to an existing table?

A. ALTER
B. UPDATE
C. INSERT
D. MODIFY

**Answer:** ALTER

**Explanation:** ALTER TABLE ADD COLUMN changes the table structure to add a column.

### 2. How many layers are there in the OSI reference model?

A. 5
B. 6
C. 7
D. 4

**Answer:** 7

**Explanation:** The OSI model has 7 layers: physical, data link, network, transport, session, presentation, application.

### 3. Which of the following is a NoSQL database?

A. MySQL
B. MongoDB
C. Oracle
D. PostgreSQL

**Answer:** MongoDB

**Explanation:** MongoDB is a document oriented NoSQL database; the others are relational.

### 4. Which OOP concept lets one interface have many implementations?

A. Polymorphism
B. Encapsulation
C. Inheritance
D. Abstraction

**Answer:** Polymorphism

**Explanation:** Polymorphism allows the same interface to behave differently for different types.

### 5. Which of the following sorting algorithms is stable?

A. Quicksort
B. Merge sort
C. Heap sort
D. Selection sort

**Answer:** Merge sort

**Explanation:** Merge sort preserves the relative order of equal elements, so it is stable.

### 6. A semaphore in an operating system is mainly used for?

A. Process synchronization
B. Memory compression
C. File encryption
D. Disk formatting

**Answer:** Process synchronization

**Explanation:** Semaphores coordinate access to shared resources, providing process synchronization.

### 7. Which header file is required to use printf in C?

A. stdio.h
B. conio.h
C. stdlib.h
D. string.h

**Answer:** stdio.h

**Explanation:** printf is declared in the standard input output header stdio.h.

### 8. Which of the following is a DML command?

A. CREATE
B. DROP
C. UPDATE
D. TRUNCATE

**Answer:** UPDATE

**Explanation:** UPDATE modifies data, so it is DML; CREATE, DROP, and TRUNCATE are DDL.

More HCLTech preparation, including the full recruitment process: https://useastra.in/campus/hcl
