Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
25 views24 pages

Interview Questions by Skill

Uploaded by

Garvit Dani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views24 pages

Interview Questions by Skill

Uploaded by

Garvit Dani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

Interview Questions by Skill

Uploaded image

I mentioned these skills in my resume , give me all


important interview question regarding each skill for
interview

Great — based on the technical skills listed in your resume image, here's a
categorized list of important interview questions for each skill. These are tailored to
help you prepare for technical interviews effectively.

🔹 C, C++
C:

1. What is the difference between call by value and call by reference in C?

2. How does memory allocation work in C ( malloc , calloc , free )?

3. What is a dangling pointer? How can it be avoided?

4. Explain static vs global variables.

5. What are storage classes in C?

C++:

1. What is the difference between C and C++?

2. Explain OOP concepts: Inheritance, Polymorphism, Encapsulation, Abstraction.

3. What are constructors and destructors?

4. What is function overloading and operator overloading?

5. Difference between deep copy and shallow copy.

6. What is a virtual function? How does it work?

1/24
🔹 Java
1. What is the difference between JDK , JRE , and JVM ?

2. Explain OOP principles with examples.

3. What is the difference between == and .equals() in Java?

4. What is inheritance in Java? Types?

5. What are abstract classes and interfaces ?

6. What is exception handling in Java?

7. How does garbage collection work?

8. Difference between ArrayList and LinkedList.

9. What is multithreading? How do you implement it?

10. What is the use of static keyword?

🔹 HTML, CSS, JavaScript


HTML:

1. What is the difference between id and class ?

2. Semantic vs non-semantic elements.

3. How does HTML5 differ from previous versions?

CSS:

1. What is the difference between inline, internal, and external CSS?

2. Explain specificity and the box model.

3. What is the difference between relative , absolute , and fixed positioning?

JavaScript:

1. Difference between var , let , and const ?

2. What are closures?

3. What is hoisting?

4. What is event bubbling and event delegation?

2/24
5. Difference between synchronous and asynchronous JS.

6. What are Promises and async/await?

🔹 MERN Stack (MongoDB, Express.js, React.js, Node.js)


MongoDB:

1. Difference between SQL and NoSQL.

2. What are collections and documents in MongoDB?

3. How do you perform CRUD operations?

Express.js:

1. What is middleware in Express?

2. How do you define routes?

3. How do you handle errors in Express?

React.js:

1. What are components in React?

2. Difference between class and functional components.

3. What are hooks (useState, useEffect)?

4. Explain virtual DOM.

5. What is prop drilling?

Node.js:

1. What is Node.js and why is it used?

2. What is event-driven programming?

3. How is non-blocking I/O implemented in Node.js?

🔹 SQL
1. What is the difference between INNER JOIN , LEFT JOIN , RIGHT JOIN , and FULL
JOIN ?

3/24
2. What is normalization? Explain different normal forms.

3. Difference between WHERE and HAVING .

4. What are subqueries and correlated subqueries?

5. What are indexes and how do they improve performance?

6. Write a query to find the second highest salary in a table.

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

Would you like a PDF version or formatted document of this for easier study or
printing?

give Answer of each question according to interview

python Always show details

# Create a structured outline with the questions listed and prepare space for answers.
skills_questions = {
"C, C++": {
"C": [
"What is the difference between call by value and call by reference in C?",
"How does memory allocation work in C (malloc, calloc, free)?",
"What is a dangling pointer? How can it be avoided?",
"Explain static vs global variables.",
"What are storage classes in C?"
],
"C++": [
"What is the difference between C and C++?",
"Explain OOP concepts: Inheritance, Polymorphism, Encapsulation, Abstraction.",
"What are constructors and destructors?",
"What is function overloading and operator overloading?",
"Difference between deep copy and shallow copy.",
"What is a virtual function? How does it work?"
]
},
"Java": [
"What is the difference between JDK, JRE, and JVM?",

4/24
"Explain OOP principles with examples.",
"What is the difference between == and .equals() in Java?",
"What is inheritance in Java? Types?",
"What are abstract classes and interfaces?",
"What is exception handling in Java?",
"How does garbage collection work?",
"Difference between ArrayList and LinkedList.",
"What is multithreading? How do you implement it?",
"What is the use of static keyword?"
],
"HTML, CSS, JavaScript": {
"HTML": [
"What is the difference between id and class?",
"Semantic vs non-semantic elements.",
"How does HTML5 differ from previous versions?"
],
"CSS": [
"What is the difference between inline, internal, and external CSS?",
"Explain specificity and the box model.",
"What is the difference between relative, absolute, and fixed positioning?"
],
"JavaScript": [
"Difference between var, let, and const?",
"What are closures?",
"What is hoisting?",
"What is event bubbling and event delegation?",
"Difference between synchronous and asynchronous JS.",
"What are Promises and async/await?"
]
},
"MERN Stack": {
"MongoDB": [
"Difference between SQL and NoSQL.",
"What are collections and documents in MongoDB?",
"How do you perform CRUD operations?"
],
"Express.js": [
"What is middleware in Express?",
"How do you define routes?",
"How do you handle errors in Express?"
],
"React.js": [

5/24
"What are components in React?",
"Difference between class and functional components.",
"What are hooks (useState, useEffect)?",
"Explain virtual DOM.",
"What is prop drilling?"
],
"Node.js": [
"What is Node.js and why is it used?",
"What is event-driven programming?",
"How is non-blocking I/O implemented in Node.js?"
]
},
"SQL": [
"What is the difference between INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL JOIN?",
"What is normalization? Explain different normal forms.",
"Difference between WHERE and HAVING.",
"What are subqueries and correlated subqueries?",
"What are indexes and how do they improve performance?",
"Write a query to find the second highest salary in a table.",
"What is the difference between DELETE, TRUNCATE, and DROP?"
]
}

# Output the structure as a draft for review before adding all answers
skills_questions.keys()

Result

dict_keys(['C, C++', 'Java', 'HTML, CSS, JavaScript', 'MERN Stack', 'SQ

Great! You've categorized skills into:

1. C, C++

2. Java

3. HTML, CSS, JavaScript

4. MERN Stack

5. SQL

I’ll now begin by providing interview-style answers for each question under "C, C++"
as the first batch. Once you're happy with that format, I’ll continue with the others.
Let’s start:

6/24
🔹 C Interview Questions & Answers
1. What is the difference between call by value and call by reference in C?

Call by value: Passes a copy of the variable to the function. Changes don’t affect
the original variable.

Call by reference: Achieved using pointers in C; changes reflect in the original


variable as the function works on its memory address.

2. How does memory allocation work in C ( malloc , calloc , free )?

malloc(size) : Allocates uninitialized memory.

calloc(n, size) : Allocates and initializes memory to 0.

free(ptr) : Frees dynamically allocated memory. Always call free() to prevent

memory leaks.

3. What is a dangling pointer? How can it be avoided?

A dangling pointer points to memory that has been freed.

Avoid it by setting the pointer to NULL after freeing it.

4. Explain static vs global variables.

Global variables: Declared outside any function; accessible throughout the


program.

Static variables: Preserve value between function calls and limit scope to the file
or function where declared.

5. What are storage classes in C?

Storage classes: auto , register , static , extern .

Define variable scope, visibility, and lifetime.

Example: static preserves value, extern is used to declare variables from


other files.

🔹 C++ Interview Questions & Answers


7/24
1. What is the difference between C and C++?

C is a procedural language, C++ is multi-paradigm (supports both procedural and


object-oriented programming).

C++ supports classes, inheritance, polymorphism.

2. Explain OOP concepts: Inheritance, Polymorphism, Encapsulation, Abstraction.

Inheritance: Deriving new class from existing one.

Polymorphism: One function behaves differently in different contexts (e.g.,


overloading).

Encapsulation: Wrapping data & methods into a class and restricting access via
access specifiers.

Abstraction: Hiding implementation details and showing only functionality.

3. What are constructors and destructors?

Constructor: Special method called when an object is created.

Destructor: Called automatically when an object is destroyed to release resources.

4. What is function overloading and operator overloading?

Function overloading: Multiple functions with the same name but different
parameters.

Operator overloading: Defining new behavior for operators (like + ) for user-
defined types.

5. Difference between deep copy and shallow copy.

Shallow copy: Copies pointer values; both objects point to the same memory.

Deep copy: Allocates separate memory and copies the data, preventing shared
memory issues.

6. What is a virtual function? How does it work?

A virtual function allows overriding in derived classes.

Enables runtime polymorphism using virtual table (vtable).

Declared using virtual keyword in base class.

8/24
Shall I continue with Java next? Or would you like this in PDF/Word format once all
are done?

next

Excellent. Let's proceed with detailed Java interview questions and answers:

🔹 Java Interview Questions & Answers


1. What is the difference between JDK, JRE, and JVM?

JVM (Java Virtual Machine): Runs Java bytecode and provides platform
independence.

JRE (Java Runtime Environment): Contains JVM + libraries required to run Java
applications.

JDK (Java Development Kit): Contains JRE + development tools (e.g., javac ,
debugger).

2. Explain OOP principles with examples.

Encapsulation: Wrapping data with methods; use of private variables and public
getters/setters.

Abstraction: Hiding internal details; using abstract classes or interfaces.

Inheritance: One class inherits properties from another using extends .

Polymorphism: One function behaves differently for different objects


( overloading & overriding ).

3. What is the difference between == and .equals() in Java?

== checks reference equality (i.e., same memory location).

9/24
.equals() checks content equality (i.e., whether values are the same).

Example: "abc" == new String("abc") → false;


"abc".equals(new String("abc")) → true.

4. What is inheritance in Java? Types?

Mechanism to reuse existing code by deriving new classes from existing ones.

Types:

Single

Multilevel

Hierarchical

Java does not support multiple inheritance with classes (but allows it via
interfaces).

5. What are abstract classes and interfaces?

Abstract class: Can have both abstract and concrete methods; used when some
implementation is shared.

Interface: Only method declarations (Java 8+ allows default and static methods).
A class can implement multiple interfaces, but only extend one class.

6. What is exception handling in Java?

Mechanism to handle runtime errors.

Keywords: try , catch , finally , throw , throws .

Example:

java

try {
int a = 10 / 0;
} catch (ArithmeticException e) {

10/24
System.out.println("Error: " + e.getMessage());
}

7. How does garbage collection work?

Java automatically removes unused objects via Garbage Collector (GC).

Uses algorithms like Mark & Sweep.

Developers can suggest GC using System.gc() , but it’s not guaranteed.

8. Difference between ArrayList and LinkedList.

Feature ArrayList LinkedList

Internal Data Dynamic array Doubly-linked list

Access Time Fast (O(1)) Slow (O(n))

Insert/Delete Slower Faster in middle

Memory Usage Less More

9. What is multithreading? How do you implement it?

Allows concurrent execution of two or more threads.

Can be implemented by:

Extending Thread class

Implementing Runnable interface


Example:

java

class MyThread extends Thread {


public void run() {

11/24
System.out.println("Thread running...");
}
}

10. What is the use of static keyword?

Used to create methods or variables that belong to the class rather than any
instance.

Shared among all objects.

Can be used in:

Static variables

Static methods

Static blocks

Static nested classes

Would you like to move to HTML, CSS, JavaScript next?

next

Great! Let’s now cover HTML, CSS, and JavaScript interview questions with answers
—each grouped clearly for easy review.

🔹 HTML Interview Questions & Answers


1. What is the difference between id and class ?

id : Unique identifier (one element per page).

class : Reusable identifier (can be used by multiple elements).

Example:

12/24
html

<div id="header"></div>
<div class="menu-item"></div>

2. Semantic vs non-semantic elements.

Semantic elements: Clearly describe their meaning (e.g., <header> , <footer> ,


<article> ).

Non-semantic elements: Don't convey meaning (e.g., <div> , <span> ).

3. How does HTML5 differ from previous versions?

Introduced semantic tags ( <section> , <article> , <nav> ).

Native support for audio/video ( <audio> , <video> ).

Improved form inputs ( date , email , range ).

Local storage and offline capabilities ( localStorage , sessionStorage ).

🔹 CSS Interview Questions & Answers


1. What is the difference between inline, internal, and external CSS?

Inline: Inside the HTML element using style attribute.

Internal: Within <style> in the HTML <head> .

External: In separate .css file linked using <link> tag.

Best practice: Use external CSS for maintainability.

2. Explain specificity and the box model.

Specificity: Determines which CSS rule is applied (inline > id > class > element).

13/24
Box model: Structure of an element:

Content → Padding → Border → Margin .

3. What is the difference between relative , absolute , and fixed positioning?

Relative: Positioned relative to its normal position.

Absolute: Positioned relative to nearest positioned ancestor.

Fixed: Positioned relative to the browser window (doesn’t scroll).

Sticky: Switches between relative and fixed depending on scroll.

🔹 JavaScript Interview Questions & Answers


1. Difference between var , let , and const ?

var : Function-scoped, hoisted, can be redeclared.

let : Block-scoped, cannot be redeclared in the same scope.

const : Block-scoped, constant reference (can’t be reassigned).

js

var x = 10; let y = 20; const z = 30;

2. What are closures?

A closure is a function that remembers variables from its outer lexical scope even
after the outer function has closed.

js

function outer() {
let count = 0;
return function inner() {
return ++count;

14/24
};
}
const counter = outer(); counter(); // 1

3. What is hoisting?

JavaScript's behavior of moving variable/function declarations to the top of their


scope before execution.

js

console.log(a); // undefined
var a = 5;

4. What is event bubbling and event delegation?

Event bubbling: Events propagate from child to parent (default behavior).

Event delegation: Attaching a single event listener to a parent to manage events


for its children dynamically.
Useful for performance and handling dynamic elements.

5. Difference between synchronous and asynchronous JS.

Synchronous: Tasks run one after another.

Asynchronous: Tasks run independently; next task doesn’t wait.


Uses: callbacks, promises, async/await.

6. What are Promises and async/await ?

Promise: Represents the future value of an async operation.

js

15/24
new Promise((resolve, reject) => { /* async work */ });

async/await: Syntactic sugar over Promises for easier async code.

js

async function getData() {


let data = await fetch(url);
}

Next up: MERN Stack (MongoDB, Express.js, React.js, Node.js). Proceed?

yes next

Perfect. Let’s now dive into important MERN Stack (MongoDB, Express, React,
Node.js) interview questions with answers — grouped by technology:

🔹 MongoDB Interview Questions & Answers


1. Difference between SQL and NoSQL.

SQL (Relational): Structured schema, uses tables (MySQL, PostgreSQL).

NoSQL (Non-relational): Schema-less, stores data as JSON-like documents


(MongoDB).

MongoDB allows high scalability and flexibility.

2. What are collections and documents in MongoDB?

Collection: Group of MongoDB documents (like a table in SQL).

Document: Individual record in BSON/JSON format.


Example:

16/24
json

{ "_id": 1, "name": "John", "age": 25 }

3. How do you perform CRUD operations?

Create: db.users.insertOne({ name: "Alice" })

Read: db.users.find({ name: "Alice" })

Update: db.users.updateOne({ name: "Alice" }, { $set: { age: 30 } })

Delete: db.users.deleteOne({ name: "Alice" })

🔹 Express.js Interview Questions & Answers


1. What is middleware in Express?

Functions that execute during the request–response cycle.

Used for logging, authentication, parsing, etc.

js

app.use((req, res, next) => {


console.log('Middleware triggered');
next();
});

2. How do you define routes?

Use app.get() , app.post() , etc. to handle different HTTP requests.

js

app.get('/user', (req, res) => {


res.send('User route');
});

17/24
3. How do you handle errors in Express?

Use an error-handling middleware with four parameters.

js

app.use((err, req, res, next) => {


res.status(500).send('Something broke!');
});

🔹 React.js Interview Questions & Answers


1. What are components in React?

Reusable building blocks of UI. Two types:

Functional (stateless, with hooks)

Class (with lifecycle methods)

2. Difference between class and functional components.

Functional
Feature Class Component Component

Syntax Uses ES6 class Uses function

State Yes Yes (via useState )

Lifecycle Yes Yes (via useEffect )

3. What are hooks ( useState , useEffect )?

useState: Manages local component state.

js

18/24
const [count, setCount] = useState(0);

useEffect: Performs side effects (API calls, subscriptions).

js

useEffect(() => {
fetchData();
}, []);

4. Explain virtual DOM.

A lightweight JavaScript representation of the real DOM.

React compares (diffs) virtual DOM with the previous one and updates only
what's changed (efficient rendering).

5. What is prop drilling?

Passing data from parent to deeply nested child components through


intermediate components.

Can be avoided using Context API or state management libraries like Redux.

🔹 Node.js Interview Questions & Answers


1. What is Node.js and why is it used?

Node.js is a runtime environment that lets you run JavaScript on the server-side.

Built on Chrome's V8 engine, it is non-blocking and event-driven — perfect for


scalable network applications.

2. What is event-driven programming?

19/24
Architecture where the flow is determined by events like user input, messages,
or sensor outputs.

Node uses an event loop to handle async operations.

3. How is non-blocking I/O implemented in Node.js?

Via asynchronous APIs and the event loop.

Instead of waiting for tasks to finish (like reading a file), Node continues
processing other tasks.

js

fs.readFile('file.txt', (err, data) => {


if (err) throw err;
console.log(data.toString());
});

Ready for the final section: SQL Interview Questions & Answers?

yes

Great! Let’s wrap it up with SQL interview questions and answers—these are
common in technical interviews and important for any data-driven role:

🔹 SQL Interview Questions & Answers


1. What is the difference between INNER JOIN , LEFT JOIN , RIGHT JOIN , and FULL
JOIN ?

INNER JOIN : Returns records that match in both tables.

LEFT JOIN : All records from the left table and matched records from the right.

20/24
RIGHT JOIN : All records from the right table and matched records from the left.

FULL JOIN : All records when there is a match in either table.

Example:

sql

SELECT * FROM orders


LEFT JOIN customers ON orders.customer_id = customers.id;

2. What is normalization? Explain different normal forms.

Normalization: Organizing data to reduce redundancy and improve integrity.

1NF: Atomic columns (no repeating groups).

2NF: 1NF + no partial dependencies.

3NF: 2NF + no transitive dependencies.

Higher forms (BCNF, 4NF) handle more complex scenarios.

3. Difference between WHERE and HAVING .

WHERE : Filters rows before grouping.

HAVING : Filters groups after aggregation.

Example:

sql

SELECT department, COUNT(*)


FROM employees
GROUP BY department
HAVING COUNT(*) > 5;

21/24
4. What are subqueries and correlated subqueries?

Subquery: A query inside another query.


Example:

sql

SELECT name FROM employees WHERE salary >


(SELECT AVG(salary) FROM employees);

Correlated subquery: Depends on the outer query.


Example:

sql

SELECT e1.name FROM employees e1


WHERE salary > (SELECT AVG(salary) FROM employees e2 WHERE e1.department =
e2.department);

5. What are indexes and how do they improve performance?

Indexes are data structures that speed up data retrieval.

Work like a book’s index.

Can be on one or more columns (composite indexes).

Speeds up SELECT but may slow down INSERT/UPDATE/DELETE .

6. Write a query to find the second highest salary in a table.

sql

SELECT MAX(salary) AS SecondHighest


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

Alternate using LIMIT :

sql

22/24
SELECT salary FROM employees
ORDER BY salary DESC
LIMIT 1 OFFSET 1;

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

Command Use Case Can Rollback Resets Identity Deletes Structure

DELETE Deletes specific ✅ Yes ❌ No ❌ No


rows (with WHERE )

TRUNCATE Deletes all rows ❌ No ✅ Yes ❌ No


fast

DROP Deletes entire ❌ No ✅ Yes ✅ Yes


table

✅ You're Done!
You now have answers to all the technical skills you listed in your resume:

C, C++

Java

HTML/CSS/JavaScript

MERN Stack

SQL

Would you like:

A PDF document version of this for download/study?

A mock interview session to practice live questions?

Or help with project-based questions related to your resume?

23/24
Let me know what you'd like to do next.

24/24

You might also like