0% found this document useful (0 votes)
5 views2 pages

Backend Interview QA With Cover Sample

This document is a compilation of comprehensive backend interview questions and answers focused on Node.js, Express.js, MySQL, and MongoDB, prepared for Satyanarayan Patra. It includes explanations of key concepts such as the differences between process.nextTick(), setImmediate(), and setTimeout() in Node.js, as well as methods to prevent SQL injection in MySQL applications. The document provides practical examples and best practices for backend development.
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)
5 views2 pages

Backend Interview QA With Cover Sample

This document is a compilation of comprehensive backend interview questions and answers focused on Node.js, Express.js, MySQL, and MongoDB, prepared for Satyanarayan Patra. It includes explanations of key concepts such as the differences between process.nextTick(), setImmediate(), and setTimeout() in Node.js, as well as methods to prevent SQL injection in MySQL applications. The document provides practical examples and best practices for backend development.
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/ 2

Fullstack Backend Interview Q&A: Node.js, Express.

js, MySQL, MongoDB

Comprehensive Backend Interview Questions & Answers

Covering Node.js, Express.js, MySQL, MongoDB

Prepared for: Satyanarayan Patra

Compiled by: ChatGPT

Date: June 2025

Page 1
Fullstack Backend Interview Q&A: Node.js, Express.js, MySQL, MongoDB

1. What is the difference between process.nextTick(), setImmediate(), and setTimeout() in Node.js?

In Node.js, the event loop handles asynchronous operations. These three methods queue functions

differently:

- `process.nextTick()` queues the callback to be invoked after the current operation completes but before the

event loop continues. It's part of the microtask queue.

- `setImmediate()` queues the callback to be executed in the next iteration of the event loop (macrotask

queue).

- `setTimeout(fn, 0)` schedules the callback after a minimum delay of 0 ms, meaning it will be put in the timer

queue and executed after the timer phase is reached.

Use `nextTick` for code that must be executed immediately after the current function, and `setImmediate` for

deferring execution until the next loop iteration.

2. How do you prevent SQL Injection in a Node.js MySQL application?

To prevent SQL injection:

- Use parameterized queries or prepared statements provided by libraries like `mysql2` or `sequelize`.

- Avoid directly concatenating user inputs into SQL queries.

- Use ORM frameworks that auto-sanitize inputs.

Example with `mysql2`:

```js

const mysql = require('mysql2');

const connection = mysql.createConnection({host: 'localhost', user: 'root', database: 'test'});

const username = req.body.username;

connection.query('SELECT * FROM users WHERE username = ?', [username], function (err, results) {

// Safe query

});

```

Page 2

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy