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:

  1. Stack Overflow
  2. Let's Encrypt
  3. W3Schools
  4. 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:

  1. Encrypting passwords
  2. Writing CSS automatically
  3. Compressing databases
  4. 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:

  1. Image compression
  2. CSS styling
  3. Database replication
  4. 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:

  1. Constructor
  2. Prototype
  3. Closure
  4. 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:

  1. Each request is independent and the server does not remember previous requests by default
  2. It only works offline
  3. It has no headers
  4. 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:

  1. No Content
  2. Moved Permanently
  3. Created
  4. 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);

  1. 15
  2. undefined
  3. 5
  4. 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. 1,2,3,10
  2. 1,10,2,3
  3. 10,3,2,1
  4. 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. 1
  2. 4
  3. 3
  4. 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:

  1. Real-time database
  2. Virtual DOM
  3. Stored procedure
  4. 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:

  1. HTML comments
  2. A public README
  3. The front-end JavaScript
  4. 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:

  1. Digital Output Method
  2. Document Object Model
  3. Document Order Map
  4. 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:

  1. Run SQL on the server
  2. Style pages
  3. Replace HTML
  4. 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:

  1. Programming languages
  2. Browsers
  3. Web servers
  4. 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?

  1. Rendering the DOM
  2. DNS lookup of the domain name
  3. Running JavaScript
  4. 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?

  1. <section
  2. <span
  3. <div
  4. <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:

  1. Stays in the same place in the viewport while scrolling
  2. Is positioned relative to its parent only
  3. Is hidden
  4. 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'));

  1. 50
  2. 428
  3. 42px8
  4. 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:

  1. AJAX
  2. SSL
  3. CDN
  4. SEO

Answer: A) AJAX

Explanation: Today usually done with fetch(). Lesson 6.3 · Web Development

Discuss this question

20. Which tag creates a hyperlink?

  1. <url
  2. <link
  3. <a
  4. <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?

  1. GET /api/courses/new
  2. DELETE /api/courses
  3. POST /api/courses
  4. 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:

  1. CSRF
  2. SQL injection
  3. Brute force
  4. 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);

  1. true true
  2. false false
  3. true false
  4. 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('-'));

  1. 246
  2. 2-4-6
  3. 2,4,6
  4. 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:

  1. It needs no server
  2. It uses only XML
  3. It cannot read data
  4. 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