
- Main
- Catalog
- Computer science
- Advertising on the Telegram channel «Coding interview preparation»
Advertising on the Telegram channel «Coding interview preparation»
Preparing programmers for coding interviews. Addressing questions asked by major global programming companies. Cool programming resources.
Channel statistics
id column in Users table.
4️⃣ What is a Foreign Key?
A: A field in one table that refers to the primary key of another table to maintain relationships.
5️⃣ CRUD Operations
- Create: INSERT INTO table_name ...
- Read: SELECT * FROM table_name ...
- Update: UPDATE table_name SET ... WHERE ...
- Delete: DELETE FROM table_name WHERE ...
6️⃣ What is Indexing?
A: A performance optimization technique to speed up data retrieval. Types: B-Tree, Hash indexes.
7️⃣ What is Normalization?
A: Process of organizing tables to reduce redundancy and improve data integrity. Forms: 1NF, 2NF, 3NF, BCNF.
8️⃣ What is Denormalization?
A: Combining tables or duplicating data to improve read performance at the cost of redundancy.
9️⃣ ACID Properties
- Atomicity: All or nothing transaction
- Consistency: Database remains valid
- Isolation: Transactions don’t interfere
- Durability: Committed changes persist
🔟 Difference between JOIN types
- INNER JOIN: Only matching rows
- LEFT JOIN: All left + matching right rows
- RIGHT JOIN: All right + matching left rows
- FULL OUTER JOIN: All rows from both tables
1️⃣1️⃣ What is a NoSQL Database?
A: Database designed for large-scale, unstructured, or semi-structured data. Types: Document (MongoDB), Key-Value (Redis), Column (Cassandra), Graph (Neo4j).
1️⃣2️⃣ What is a Transaction?
A: A set of SQL operations executed as a single unit of work. Either all succeed or all fail.
1️⃣3️⃣ Difference between DELETE and TRUNCATE
- DELETE: Row-by-row, can use WHERE, slower, logs each row.
- TRUNCATE: Removes all rows, faster, cannot use WHERE, resets auto-increment.
1️⃣4️⃣ What is a View?
A: A virtual table representing a stored query. Useful for abstraction, security, and complex queries.
1️⃣5️⃣ Difference between SQL and ORM
- SQL: Direct queries to DB
- ORM: Object-Relational Mapping, allows interacting with DB using programming language objects (e.g., Sequelize, SQLAlchemy)
💬 Tap ❤️ if you found this useful!
app.get('/error', (req, res) => {
throw new Error('Something went wrong!');
});{}
📍 3. Custom Error-handling Middleware
- Middleware with 4 parameters (err, req, res, next) handles errors globally.
app.use((err, req, res, next) => {
console.error(err.stack);
res.status(500).send({ message: err.message });
});{}
📍 4. Try-Catch in Async Functions
- Async route handlers need try-catch to handle errors.
app.get('/async', async (req, res, next) => {
try {
const data = await getData();
res.send(data);
} catch (err) {
next(err);
}
});{}
📍 5. Sending Proper Status Codes
- 400 → Bad Request
- 401 → Unauthorized
- 403 → Forbidden
- 404 → Not Found
- 500 → Internal Server Error
📍 6. Error Logging
- Use console.error() or logging libraries like winston or morgan for debugging.
📍 7. Best Practices
- Keep error messages user-friendly.
- Don’t expose stack traces in production.
- Centralize error handling.
- Validate inputs to prevent errors early.
💬 Tap ❤️ for more!GET → Read data
- POST → Create data
- PUT → Update data
- DELETE → Delete data
- PATCH → Partial update
📍 4. Example – Creating a GET Route
app.get('/users', (req, res) => {
res.send(users); // Return all users
});{}
📍 5. Example – POST Route
app.post('/users', (req, res) => {
const newUser = req.body;
users.push(newUser);
res.status(201).send(newUser);
});{}
📍 6. Route Parameters & Query Parameters
app.get('/users/:id', (req, res) => {
res.send(users.find(u => u.id == req.params.id));
});
app.get('/search', (req, res) => {
res.send(users.filter(u => u.name.includes(req.query.name)));
});{}
📍 7. Status Codes
- 200 → OK
- 201 → Created
- 400 → Bad Request
- 404 → Not Found
- 500 → Server Error
📍 8. Best Practices
- Validate request data
- Handle errors properly
- Use consistent endpoint naming
- Keep routes modular using express.Router()
💬 Double Tap ❤️ for more!req/res, execute code, or end the request.
📍 2. Types of Middleware
- Application-level: Applied to all routes or specific routes
- Router-level: Applied to router instances
- Built-in: e.g., express.json(), express.static()
- Third-party: e.g., cors, morgan, helmet
📍 3. Example – Logging Middleware
app.use((req, res, next) => {
console.log(`req.method{req.url}`);
next(); // Pass to next middleware/route
});{}
📍 4. Built-in Middleware
app.use(express.json()); // Parses JSON body
app.use(express.urlencoded({ extended: true })); // Parses URL-encoded body{}
📍 5. Router-level Middleware
const router = express.Router();
router.use((req, res, next) => {
console.log('Router Middleware Active');
next();
});{}
📍 6. Error-handling Middleware
app.use((err, req, res, next) => {
console.error(err.stack);
res.status(500).send('Something broke!');
});{}
📍 7. Chaining Middleware
app.get('/profile', authMiddleware, logMiddleware, (req, res) => {
res.send('User Profile');
});{}
💡 Pro Tip: Middleware order matters — always place error-handling middleware last.
💬 Tap ❤️ for more!
app.get('/home', (req, res) => {
res.send('Welcome Home');
});{}
📍3. Route Methods
- app.get() – Read data
- app.post() – Create data
- app.put() – Update data
- app.delete() – Delete data
📍 4. Route Parameters
app.get('/user/:id', (req, res) => {
res.send(req.params.id);
});{}
📍 5. Query Parameters
app.get('/search', (req, res) => {
res.send(req.query.keyword);
});{}
📍 6. Route Chaining
app.route('/product')
.get(getHandler)
.post(postHandler)
.put(putHandler);{}
📍 7. Router Middleware
const router = express.Router();
router.get('/about', (req, res) => res.send('About Page'));
app.use('/info', router); // URL: /info/about{}
📍 8. Error Handling Route
app.use((req, res) => {
res.status(404).send('Page Not Found');
});{}
💡 Pro Tip: Always place dynamic routes after static ones to avoid conflicts.
💬 Tap ❤️ if this helped you!package.json file?
A: It stores metadata about your project (name, version, scripts) and dependencies. It’s essential for managing and sharing Node.js projects.
📍 4. What are CommonJS modules in Node.js?
A: Node uses CommonJS to handle modules. You use require() to import and module.exports to export code between files.
📍 5. What is the Event Loop in Node.js?
A: It allows Node.js to handle many connections asynchronously without blocking. It’s the heart of Node’s non-blocking architecture.
📍 6. What is middleware in Node.js (Express)?
A: Middleware functions process requests before sending a response. They can be used for logging, auth, validation, etc.
📍 7. What is the difference between process.nextTick(), setTimeout(), and setImmediate()?
A:
- process.nextTick() runs after the current operation, before the next event loop.
- setTimeout() runs after a minimum delay.
- setImmediate() runs on the next cycle of the event loop.
📍 8. What is a callback function in Node.js?
A: A function passed as an argument to another function, executed after an async task finishes. It’s the core of async programming in Node.
📍 9. What are Streams in Node.js?
A: Streams let you read/write data piece-by-piece (chunks), great for handling large files. Types: Readable, Writable, Duplex, Transform.
📍 10. What is the difference between require and import?
A:
- require is CommonJS (used in Node.js by default).
- import is ES6 module syntax (used with "type": "module" in package.json).
💬 Tap ❤️ for more!
function outer() {
let count = 0;
return function inner() {
count++;
console.log(count);
}
}
const counter = outer();
counter(); // 1
counter(); // 2{}
2. Explain event delegation.
Event delegation is a technique where you attach a single event listener to a parent element to handle events on its child elements using event.target.
3. What is the difference between == and ===?
- == checks for value equality (type coercion allowed).
- === checks for both value and type (strict equality).
'5' == 5 // true
'5' === 5 // false{}
4. What is the "this" keyword?
this refers to the object that is executing the current function. In arrow functions, this is lexically bound (based on where it's defined).
5. What are Promises?
Promises handle asynchronous operations. They have 3 states: *pending, resolved, rejected*.
const p = new Promise((resolve, reject) => {
resolve("Success");
});
p.then(console.log);{}
6. Explain async/await.
Syntactic sugar over Promises for better readability in async code.
async function fetchData() {
const res = await fetch(url);
const data = await res.json();
}{}
7. What is hoisting?
Variables and function declarations are moved to the top of their scope before code execution.
console.log(a); // undefined
var a = 5;{}
8. What are arrow functions and how do they differ?
Arrow functions are shorter and do not have their own this, arguments, or super.
const add = (a, b) => a + b;{}
9. What is the event loop?
The event loop handles asynchronous callbacks and ensures non-blocking behavior in JS by placing them in the task queue after the call stack is clear.
10. What are IIFEs (Immediately Invoked Function Expressions)?
Functions that run as soon as they are defined.
(function() {
console.log("Runs immediately");
})();{}
💬 Double Tap ❤️ For MoreReviews channel
12 total reviews
- Added: Newest first
- Added: Oldest first
- Rating: High to low
- Rating: Low to high
Catalog of Telegram Channels for Native Placements
Advertising on the Telegram channel «Coding interview preparation» is a Telegram channel in the category «Интернет технологии», offering effective formats for placing advertising posts on TG. The channel has 5.8K subscribers and provides quality content. The advertising posts on the channel help brands attract audience attention and increase reach. The channel's rating is 30.6, with 12 reviews and an average score of 5.0.
You can launch an advertising campaign through the Telega.in service, choosing a convenient format for placement. The Platform provides transparent cooperation conditions and offers detailed analytics. The placement cost is 7.8 ₽, and with 30 completed requests, the channel has established itself as a reliable partner for advertising on Telegram. Place integrations today and attract new clients!
You will be able to add channels from the catalog to the cart again.
Комментарий