MCQs / Computer Science / NSCT: Web Development
NSCT: Web Development MCQs — Computer Science (page 3) 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.
51. What does this JavaScript code print to the console? js console.log(0.1 + 0.2 === 0.3); true false NaN undefined Answer: B) false
Explanation: Running the code prints false. Lesson 6.3 · Web Development
Discuss this question
52. REST APIs usually exchange data in: BMP JSON MP3 DOCX Answer: B) JSON
Explanation: JSON is lightweight and easy to parse. Lesson 6.4 · Web Development
Discuss this question
53. What does this JavaScript code print to the console? js console.log(1 + '2' + 3); 15 123 6 33 Answer: B) 123
Explanation: Running the code prints 123. Lesson 6.3 · Web Development
Discuss this question
54. The best way to prevent SQL injection in a web app is: Hiding the login page Using prepared statements/parameterised queries Using GET instead of POST Minifying JavaScript Answer: B) Using prepared statements/parameterised queries
Explanation: User input is treated as data, not code. Lesson 6.5 · Web Development
Discuss this question
55. What does this JavaScript code print to the console? js console.log(Boolean(''), Boolean('0')); false true true true false false true false Answer: A) false true
Explanation: Running the code prints false true. Lesson 6.3 · Web Development
Discuss this question
56. What does this JavaScript code print to the console? js console.log('JavaScript'.slice(0, 4).toUpperCase()); JAVA SCRIPT JAVASCRIPT Java Answer: A) JAVA
Explanation: Running the code prints JAVA. Lesson 6.3 · Web Development
Discuss this question
57. The meta viewport tag is mainly needed for: SEO keywords Security headers Database access Proper display on mobile devices Answer: D) Proper display on mobile devices
Explanation: It sets the page width to the device width. Lesson 6.2 · Web Development
Discuss this question
58. Media queries in CSS are used for: Database queries Loading JavaScript Responsive design for different screen sizes Playing video Answer: C) Responsive design for different screen sizes
Explanation: e.g. @media (max-width: 600px). Lesson 6.2 · Web Development
Discuss this question
59. Setting element.innerHTML = userInput is risky because: It can execute injected scripts (XSS) It only works in Chrome It is slow It deletes the DOM Answer: A) It can execute injected scripts (XSS)
Explanation: Use textContent for untrusted text. Lesson 6.3 · Web Development
Discuss this question
60. Which is the best way to apply the same CSS to many pages? Inline styles on every element JavaScript alerts An external stylesheet linked with <link <font tags Answer: C) An external stylesheet linked with <link
Explanation: External CSS is reusable and cached. Lesson 6.2 · Web Development
Discuss this question
61. Express is a popular framework for: Database design Spreadsheets Mobile games Node.js back-end applications Answer: D) Node.js back-end applications
Explanation: It handles routing and middleware. Lesson 6.4 · Web Development
Discuss this question
62. A permanent redirect (old URL moved forever) uses status code: 304 302 301 307 only Answer: C) 301
Explanation: Search engines update their index on 301. Lesson 6.1 · Web Development
Discuss this question
63. Which HTTP method is NOT idempotent? DELETE PUT GET POST Answer: D) POST
Explanation: Repeating a POST may create duplicate resources. Lesson 6.1 · Web Development
Discuss this question
64. JSON.parse() is used to: Validate HTML Send HTTP requests Convert an object into a string Convert a JSON string into a JavaScript object Answer: D) Convert a JSON string into a JavaScript object
Explanation: JSON.stringify does the reverse. Lesson 6.3 · Web Development
Discuss this question
65. In the CSS box model, the space between the border and the content is: Gap Outline Margin Padding Answer: D) Padding
Explanation: Margin is outside the border. Lesson 6.2 · Web Development
Discuss this question
66. Which HTTP method should be used to retrieve data without changing it? PATCH DELETE GET POST Answer: C) GET
Explanation: GET is safe and idempotent. Lesson 6.1 · Web Development
Discuss this question
67. The await keyword can be used: In any CSS file To declare variables Inside an async function to wait for a Promise Only in loops Answer: C) Inside an async function to wait for a Promise
Explanation: It pauses the async function until the Promise settles. Lesson 6.3 · Web Development
Discuss this question
68. event.preventDefault() in a form submit handler: Stops the browser's default form submission Deletes the form Reloads the page Submits twice Answer: A) Stops the browser's default form submission
Explanation: Useful for validating or sending with fetch. Lesson 6.3 · Web Development
Discuss this question
69. HTTPS protects data in transit using: Compression TLS encryption Base64 encoding Cookies Answer: B) TLS encryption
Explanation: TLS encrypts the connection. Lesson 6.5 · Web Development
Discuss this question
70. An ORM (e.g. Prisma, Django ORM, Hibernate) lets developers: Encrypt networks Draw UI mock-ups Compress images Work with database tables as objects in code Answer: D) Work with database tables as objects in code
Explanation: Object-Relational Mapping. Lesson 6.4 · Web Development
Discuss this question
71. An attacker posts a comment containing <script that runs in other users' browsers. This is: SQL injection Cross-site scripting (XSS) CSRF DDoS Answer: B) Cross-site scripting (XSS)
Explanation: The script runs with the victim's privileges. Lesson 6.5 · Web Development
Discuss this question
72. A user who is logged in tries to open an admin page they have no permission for. The correct status code is: 403 Forbidden 404 Not Found 200 OK 401 Unauthorized Answer: A) 403 Forbidden
Explanation: 401 is for missing authentication; 403 for missing permission. Lesson 6.1 · Web Development
Discuss this question
73. Two rules target the same paragraph: p { color: blue } and .note { color: red }. The paragraph has class="note". Its colour is: Blue Purple Black Red Answer: D) Red
Explanation: The class selector is more specific. Lesson 6.2 · Web Development
Discuss this question
74. A DNS record that maps a domain to an IPv4 address is a/an: A record MX record TXT record CNAME record Answer: A) A record
Explanation: MX is for mail; CNAME is an alias. Lesson 6.5 · Web Development
Discuss this question
75. When an event on a child element also triggers handlers on its parent elements, it is called: Closure Event hoisting Debouncing Event bubbling Answer: D) Event bubbling
Explanation: Events propagate up the DOM tree. Lesson 6.3 · Web Development
Discuss this question
Previous Page 3 of 5 Next
Practise NSCT: Web Development MCQs
More Computer Science chapters