Viva Questions

INT222

Unit I Getting Started with Node.JS Intermediate
1
Node.js is described as single-threaded. If that is the case, how does it handle concurrent requests efficiently without blocking the main thread?
Unit I NPM modules Basic
2
What is the specific purpose of the 'package-lock.json' file, and how does it differ from 'package.json'?
Unit I EventEmitter in Node.js Intermediate
3
Scenario: You have an EventEmitter with multiple listeners for the same event. If one listener throws an error, what happens to the subsequent listeners?
Unit I Handling Data I/O (Stream Module) Advanced
4
Why would you choose 'fs.createReadStream' over 'fs.readFile' when serving a large video file to a client?
Unit I Handling Data I/O (Zlib) Intermediate
5
Explain the concept of 'piping' in the context of Streams and Zlib.
Unit I Promises and async/await Intermediate
6
If you use 'await' inside a loop (e.g., a for-loop) versus using 'Promise.all' with map, how does the execution behavior differ?
Unit I REPL Basic
7
Beyond simple calculations, what is a practical use case for the Node.js REPL during the development phase?
Unit I Handling Data I/O (fs module) Intermediate
8
What is the difference between 'fs.writeFile' and 'fs.appendFile'? What happens if the specified file does not exist in both cases?
Unit II Implementing HTTP Services Basic
9
In the native HTTP module, what is the significance of the 'response.end()' method?
Unit II Request and Response objects Intermediate
10
Where does the data reside when a client sends JSON data via a POST request in a native Node.js HTTP server (without Express)?
Unit II Setting response headers Intermediate
11
Why is it important to set the 'Content-Type' header to 'application/json' when sending a JSON response?
Unit II Basic Websites With Node.JS (Express) Basic
12
What is the primary advantage of using 'express.Router' in a large application?
Unit II body-parser Intermediate
13
If you forget to include body-parser (or the built-in express.json middleware) in your Express app, what will be the value of 'req.body' on a POST request?
Unit II Status codes Basic
14
Distinguish between HTTP status codes 200 and 201.
Unit II express validator Advanced
15
In an Express route handler, you have validation middleware. If the validation fails, does the request automatically stop?
Unit II HTTP Methods Intermediate
16
From an architectural standpoint, why should GET requests not be used to modify data on the server?
Unit III Socket Services (WebSocket) Basic
17
How does the communication protocol of a WebSocket differ from a standard HTTP request?
Unit III Socket.IO Chat Server Intermediate
18
In Socket.IO, what is the difference between 'socket.emit()' and 'io.emit()'?
Unit III Socket.IO Broadcast Intermediate
19
Scenario: A user joins a chat room. How do you send a 'User Joined' message to everyone except the user who just joined?
Unit III Creating middlewares Basic
20
What are the three arguments passed to a standard middleware function in Express, and what is the role of the third one?
Unit III app.use() vs app.all() Advanced
21
Compare 'app.use("/api", ...)' and 'app.all("/api", ...)'.
Unit III cookie-parser Basic
22
What is the security risk of storing sensitive data (like a user's role or ID) directly in a cookie without signing or encryption?
Unit III express-session vs cookie-session Intermediate
23
Architecture-wise, what is the main difference between 'express-session' and 'cookie-session'?
Unit III Middleware Execution Advanced
24
If you define an error-handling middleware function, how many arguments must it accept for Express to recognize it as an error handler?
Unit IV MongoDB Terminology Basic
25
What is the relationship between a Collection and a Document in MongoDB?
Unit IV MongoDB Shell Commands Basic
26
Which shell command would you use to remove a specific collection named 'users' from the database?
Unit IV Data Manipulation (Update) Intermediate
27
In MongoDB, what is the difference between 'updateOne' and 'replaceOne'?
Unit IV Introduction to Mongoose Intermediate
28
Since MongoDB is schema-less, why do we use Mongoose Schemas in Node.js applications?
Unit IV Mongoose Models Basic
29
What does a Mongoose 'Model' represent in your code?
Unit IV Connect MongoDB using Node.js Intermediate
30
Why is the database connection logic usually asynchronous, and how do you handle server startup relative to this connection?
Unit IV CRUD Operations Basic
31
When finding a document by ID in Mongoose, which method is most efficient/convenient?
Unit IV MongoDB Update Operators Intermediate
32
What does the '$push' operator do in a MongoDB update operation?
Unit V Introduction to PostgreSQL Basic
33
How does PostgreSQL differ fundamentally from MongoDB regarding data structure?
Unit V Basic SQL commands Basic
34
What is the SQL command to create a new table named 'students' with columns for 'id' and 'name'?
Unit V CRUD operations (SQL) Intermediate
35
In SQL, what is the difference between the 'DELETE' command and the 'TRUNCATE' command?
Unit V SQL Queries Basic
36
Which SQL clause is used to filter records?
Unit V PostgreSQL Installation/Setup Intermediate
37
When connecting Node.js to PostgreSQL, what is a 'Connection Pool' and why is it recommended?
Unit V SQL Update Basic
38
What happens if you run an UPDATE statement in SQL without a WHERE clause?
Unit VI Testing RestAPI Intermediate
39
When testing a REST API, why is it important to mock external services or databases?
Unit VI Testing RestAPI Basic
40
What are the two primary things you check when asserting a test response for an API endpoint?
Unit VI Deployment with GitHub Basic
41
What is the role of CI/CD (Continuous Integration/Continuous Deployment) when deploying via GitHub?
Unit VI Third party rendering Intermediate
42
What is the main SEO (Search Engine Optimization) benefit of Server-Side Rendering (Third party rendering) over Client-Side Rendering?
Unit VI Deployment Basic
43
Why should you never commit your '.env' file to GitHub?
Unit VI Deployment Intermediate
44
What is 'Process Management' (e.g., PM2) in the context of Node.js deployment?
General/Practical Course Outcome CO1 Intermediate
45
Explain the difference between blocking and non-blocking code in Node.js with a real-world analogy.
General/Practical Course Outcome CO2 Basic
46
What is the difference between a URL Parameter and a Query String in Express routing?
General/Practical Course Outcome CO3 Advanced
47
In a Socket.IO application, what is a 'Room'?
General/Practical Course Outcome CO4 Intermediate
48
Why is 'Validation' technically unnecessary in MongoDB but crucial in Mongoose?
General/Practical Course Outcome CO5 Basic
49
When would you choose PostgreSQL over MongoDB for a specific project?
General/Practical Course Outcome CO6 Basic
50
What is the purpose of 'Regression Testing' before deployment?