Independent Preparation Bank for Pakistani Computing Graduates • 100% Free • No Signup
NSCTPrep.
Home/Subjects/Web Development/JavaScript Fundamentals
Web DevelopmentTopic #4 of 541 MCQs Available

JavaScript Fundamentals

Comprehensive question bank, step-by-step rationales, and dedicated timed quiz for JavaScript Fundamentals.

Launch Quiz Mode ↗

JavaScript Fundamentals Question Bank

Showing 41 questions of 41 with verified answers

1Multiple Choice

(Conceptual) What is the primary purpose of the Virtual DOM in frameworks like React?

2Multiple Choice

(Scenario-Based) A developer is building a large dashboard where the user's login status must be accessible by 50+ components, many of which are nested deeply. What is the most standard architectural solution?

3Multiple Choice

(Code-Tracing) Analyze the code snippet. What is this concept called in React? Component.jsx function Welcome({ name }) { return <h1>Hello {name}</h1>;

4Multiple Choice

(Comparison) Compare a Single Page Application (SP

5Multiple Choice

(Conceptual) What is One-Way Data Binding (common in React)?

6Multiple Choice

(Code-Tracing) A developer sees this in a Vue/Angular template. What is this logic trying to achieve? } template.html

7Multiple Choice

(Conceptual) What does the "Hooks" feature in React allow you to do?

8Multiple Choice

(Scenario-Based) A UI framework automatically updates the screen when a JavaScript variable changes. What is this mechanism called?

9Multiple Choice

(Conceptual) What is the main benefit of Server-Side Rendering (SSR)? <li v-for="item in items"> {{ item.name }} </li>

10Multiple Choice

(Conceptual) Which of the following is considered a "Component" in modern web development?

11Multiple Choice

(Comparison) What is the difference between State and Props in React?

12Multiple Choice

(Scenario-Based) A team is using a "Component Library" (e.g., Bootstrap, Material UI). Why does this improve development efficiency?

13Multiple Choice

(Conceptual) What is Hydration?

14Multiple Choice

(Conceptual) What is the main advantage of using TypeScript with modern frameworks like React or Angular?

15Multiple Choice

(Conceptual) What does the term "Declarative UI" imply?

1Multiple Choice

(Conceptual) What is the main purpose of Middleware in a backend web application?

2Multiple Choice

(Scenario-Based) You are building a system that requires handling 10,000 concurrent database connections. Why might Node.js be preferred over a traditional synchronous server like a standard PHP configuration?

3Multiple Choice

(Code-Tracing) In a typical Express.js (Node.js) middleware chain, what happens if you forget to call the next() function? server.js app.use((req, res, next) => { console.log('Logging request...'); // next() is missing here });

4Multiple Choice

(Conceptual) What is the primary difference between Authentication and Authorization?

5Multiple Choice

(Scenario-Based) You are using a RESTful API. A user requests DELETE /api/ products/5. What should the server return if the product does not exist?

6Multiple Choice

(Code/Logic) What is a JWT (JSON Web Token) typically used for in a backend application?

7Multiple Choice

(Conceptual) What is the purpose of an Environment Variable (like DB_PASSWORD)?

8Multiple Choice

(Scenario-Based) You need to share a database connection across multiple requests to avoid the high cost of creating a new connection every time. What is this optimization called?

9Multiple Choice

(Comparison) What is the difference between Synchronous and Asynchronous backend operations?

10Multiple Choice

(Conceptual) What is the purpose of CORS (Cross-Origin Resource Sharing) headers?

1Multiple Choice

(Comparison) What is the primary difference between a "Micro-framework" (e.g., Flask, Express) and a "Full-Stack Framework" (e.g., Django, Spring Boot)?

2Multiple Choice

(Conceptual) Why is an ORM (Object-Relational Mapping) layer generally used in server-side development?

3Multiple Choice

(Scenario-Based) A server-side application experiences high memory consumption. Every time a request comes in, the server opens a new connection to the database. What is the most likely solution?

4Multiple Choice

(Code-Tracing) A developer is writing a backend controller. Which method correctly follows the RESTful principle for creating a new user?

5Multiple Choice

(Conceptual) What is a Templating Engine (e.g., Jinja2, EJS) doing when it processes an HTML file? api_controller.js // Which route is REST compliant? app.post('/api/create-new-user-now', ...); app.post('/api/users', ...);

6Multiple Choice

(Scenario-Based) A server application needs to run a very long calculation (e.g., video processing) that takes 10 minutes. If the server is synchronous and single-threaded (like basic Node.js setups if not handled carefully), what will happen during these 10 minutes?

7Multiple Choice

(Conceptual) What is an Environment Variable primarily used for in backend deployment?

8Multiple Choice

(Conceptual) What is the difference between Authentication and Authorization middleware?

9Multiple Choice

(Comparison) What is a Graceful Shutdown in a backend server?

10Multiple Choice

(Conceptual) Why is Request Validation (e.g., checking if email is actually an email format) performed on the server even if it is also performed on the browser?

1Multiple Choice

(Scenario-Based) A web application needs to store temporary user session data that expires every 30 minutes. Which type of database is the industry standard for this task due to its speed and expiration features?

2Multiple Choice

(Conceptual) A web developer is using an ORM to fetch user data. What is the danger of writing code like: const users = db.query("SELECT * FROM Users WHERE name = '" + req.body.name + "'")? • • •

3Multiple Choice

(Scenario-Based) You are designing a high-traffic website. Your database team suggests using Read Replicas. What is the purpose of this?

4Multiple Choice

(Conceptual) What is a Database Connection Pool?

22Multiple Choice

In JavaScript, what is the output of: typeof NaN and NaN === NaN?

24Multiple Choice

What is the primary role of the Cross-Origin Resource Sharing (CORS) mechanism implemented by web browsers?