# Mphasis Interview Questions with Answers

8 previously-asked interview questions from Mphasis'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. What is the difference between a structure and a union in C?

**Answer:** A structure allocates separate memory for every member, so all can hold values at once, and its size is the sum of members (plus padding). A union shares one memory block among all members, so only one is valid at a time, and its size equals its largest member.

**Explanation:** Struct: separate memory for all; union: shared memory, one at a time.

### 2. What is a constructor in object oriented programming?

**Answer:** A constructor is a special method that is called automatically when an object is created, used to initialise the object state. It has the same name as the class, has no return type, and can be overloaded. If none is defined, a default constructor is provided.

**Explanation:** Special method that initialises an object on creation.

### 3. What is the difference between SQL and NoSQL databases?

**Answer:** SQL databases are relational, use fixed schemas and tables, and support ACID transactions (MySQL, PostgreSQL). NoSQL databases are non-relational, use flexible schemas (documents, key-value, graph), and scale horizontally for large or unstructured data (MongoDB, Cassandra).

**Explanation:** Relational fixed-schema vs non-relational flexible-schema.

### 4. What is an operating system and what are its main functions?

**Answer:** An operating system manages hardware and software resources and provides services to programs. Its main functions include process management, memory management, file system management, device or IO management, and security.

**Explanation:** Resource manager: process, memory, file, device, security.

### 5. What is a deadlock and how can it be prevented?

**Answer:** A deadlock is when processes wait indefinitely for resources held by each other. It needs four conditions: mutual exclusion, hold and wait, no preemption, and circular wait. Preventing any one (for example ordering resource requests to avoid circular wait) prevents deadlock.

**Explanation:** Circular waiting; break one of the four conditions.

### 6. What are the different types of inheritance in OOP?

**Answer:** Single (one parent), multilevel (a chain of inheritance), hierarchical (many children of one parent), multiple (a class from several parents, via interfaces in Java), and hybrid (a combination). They enable code reuse and polymorphism.

**Explanation:** Single, multilevel, hierarchical, multiple, hybrid.

### 7. Tell me about yourself.

**Answer:** Give a concise 60 to 90 second summary: your degree, key technical strengths, a project or internship with its impact, and why you are interested in Mphasis. Keep it structured and role-relevant.

**Explanation:** Structured pitch: background, strengths, project, fit.

### 8. Why do you want to join Mphasis?

**Answer:** Mention Mphasis focus on applied technology and cloud and cognitive services, its client exposure, and the learning opportunities for a fresher in the Associate Software Engineer role. Connect it to your own growth goals.

**Explanation:** Applied tech focus, client exposure, learning; be specific.

More Mphasis preparation, including the full recruitment process: https://useastra.in/campus/mphasis
