MCQs / Computer Science / NSCT: Web Development
NSCT: Web Development MCQs — Computer Science 105 multiple-choice questions on NSCT: Web Development from Computer Science, each with the correct answer and, where available, a teacher's explanation. Read through them to revise the chapter, then practise the same questions one by one to test yourself.
1. Free SSL/TLS certificates are commonly obtained from: Stack Overflow Let's Encrypt W3Schools GitHub Pages only Answer: B) Let's Encrypt
Explanation: It automates certificate issuance. Lesson 6.5 · Web Development
Discuss this question
2. A Content Delivery Network (CDN) improves performance by: Encrypting passwords Writing CSS automatically Compressing databases Serving content from servers close to the user Answer: D) Serving content from servers close to the user
Explanation: Edge servers cache static files. Lesson 6.5 · Web Development
Discuss this question
3. CORS controls: Image compression CSS styling Database replication Which other origins may call an API from a browser Answer: D) Which other origins may call an API from a browser
Explanation: Cross-Origin Resource Sharing headers. Lesson 6.4 · Web Development
Discuss this question
4. A function that remembers variables from the scope in which it was created is a: Constructor Prototype Closure Callback only Answer: C) Closure
Explanation: Closures power many JS patterns. Lesson 6.3 · Web Development
Discuss this question
5. HTTP is called a stateless protocol because: Each request is independent and the server does not remember previous requests by default It only works offline It has no headers It cannot transfer files Answer: A) Each request is independent and the server does not remember previous requests by default
Explanation: State is added with cookies, sessions or tokens. Lesson 6.1 · Web Development
Discuss this question
6. HTTP status code 201 means: No Content Moved Permanently Created OK Answer: C) Created
Explanation: Usually returned after a successful POST. Lesson 6.1 · Web Development
Discuss this question
7. What does this JavaScript code print to the console? js let x = 5; { let x = 10; } console.log(x); 15 undefined 5 10 Answer: C) 5
Explanation: Running the code prints 5. Lesson 6.3 · Web Development
Discuss this question
8. What does this JavaScript code print to the console? js let a = [3, 1, 10, 2]; a.sort(); console.log(a.join(',')); 1,2,3,10 1,10,2,3 10,3,2,1 3,1,10,2 Answer: B) 1,10,2,3
Explanation: Running the code prints 1,10,2,3. Lesson 6.3 · Web Development
Discuss this question
9. What does this JavaScript code print to the console? js console.log([5, 12, 8, 20].filter(x = x 10).length); 1 4 3 2 Answer: D) 2
Explanation: Running the code prints 2. Lesson 6.3 · Web Development
Discuss this question
10. React updates the page efficiently using a: Real-time database Virtual DOM Stored procedure Service worker only Answer: B) Virtual DOM
Explanation: It compares virtual trees and patches only the changes. Lesson 6.4 · Web Development
Discuss this question
11. Secret API keys for a web app should be stored in: HTML comments A public README The front-end JavaScript Environment variables on the server, not in Git Answer: D) Environment variables on the server, not in Git
Explanation: Anything in client code or a public repo is exposed. Lesson 6.5 · Web Development
Discuss this question
12. DOM stands for: Digital Output Method Document Object Model Document Order Map Data Object Management Answer: B) Document Object Model
Explanation: The browser's tree of page objects. Lesson 6.3 · Web Development
Discuss this question
13. Service workers enable progressive web apps to: Run SQL on the server Style pages Replace HTML Work offline and cache resources Answer: D) Work offline and cache resources
Explanation: They act as a network proxy in the browser. Lesson 6.5 · Web Development
Discuss this question
14. Nginx and Apache are examples of: Programming languages Browsers Web servers Databases Answer: C) Web servers
Explanation: They serve HTTP requests. Lesson 6.1 · Web Development
Discuss this question
15. When you type a URL and press Enter, which happens FIRST? Rendering the DOM DNS lookup of the domain name Running JavaScript Sending the HTTP response Answer: B) DNS lookup of the domain name
Explanation: The browser needs the IP address before connecting. Lesson 6.1 · Web Development
Discuss this question
16. Which element is inline by default? <section <span <div <p Answer: B) <span
Explanation: Inline elements do not start a new line. Lesson 6.2 · Web Development
Discuss this question
17. An element with position: fixed: Stays in the same place in the viewport while scrolling Is positioned relative to its parent only Is hidden Moves with the page Answer: A) Stays in the same place in the viewport while scrolling
Explanation: Used for sticky headers/buttons. Lesson 6.2 · Web Development
Discuss this question
18. What does this JavaScript code print to the console? js console.log(parseInt('42px') + Number('8')); 50 428 42px8 NaN Answer: A) 50
Explanation: Running the code prints 50. Lesson 6.3 · Web Development
Discuss this question
19. Loading data from the server and updating part of the page without a full reload is called: AJAX SSL CDN SEO Answer: A) AJAX
Explanation: Today usually done with fetch(). Lesson 6.3 · Web Development
Discuss this question
20. Which tag creates a hyperlink? <url <link <a <href Answer: C) <a
Explanation: <a href="...". Lesson 6.2 · Web Development
Discuss this question
21. In a RESTful API, which request creates a new course? GET /api/courses/new DELETE /api/courses POST /api/courses PATCH /api/course/create Answer: C) POST /api/courses
Explanation: POST creates a new resource in the collection. Lesson 6.4 · Web Development
Discuss this question
22. A logged-in user visits a malicious site that silently submits a money-transfer request to their bank. This attack is: CSRF SQL injection Brute force XSS Answer: A) CSRF
Explanation: Defend with CSRF tokens and SameSite cookies. Lesson 6.5 · Web Development
Discuss this question
23. What does this JavaScript code print to the console? js console.log(null == undefined, null === undefined); true true false false true false false true Answer: C) true false
Explanation: Running the code prints true false. Lesson 6.3 · Web Development
Discuss this question
24. What does this JavaScript code print to the console? js console.log([1, 2, 3].map(x = x 2).join('-')); 246 2-4-6 2,4,6 1-2-3 Answer: B) 2-4-6
Explanation: Running the code prints 2-4-6. Lesson 6.3 · Web Development
Discuss this question
25. GraphQL differs from REST mainly because: It needs no server It uses only XML It cannot read data The client requests exactly the fields it needs from a single endpoint Answer: D) The client requests exactly the fields it needs from a single endpoint
Explanation: It avoids over-fetching and under-fetching. Lesson 6.4 · Web Development
Discuss this question
Page 1 of 5 Next
Practise NSCT: Web Development MCQs
More Computer Science chapters