MCQs / Computer Science / NSCT: Web Development
NSCT: Web Development MCQs — Computer Science (page 4) 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.
76. What does this JavaScript code print to the console? js console.log(1 + 2 + '3'); 123 6 33 15 Answer: C) 33
Explanation: Running the code prints 33. Lesson 6.3 · Web Development
Discuss this question
77. If the root font size is 16px, 2rem equals: 8px 2px 32px 16px Answer: C) 32px
Explanation: rem is relative to the root element. Lesson 6.2 · Web Development
Discuss this question
78. Removing whitespace and comments from JS/CSS files to reduce size is: Obfuscation for security Normalization Encryption Minification Answer: D) Minification
Explanation: Smaller files download faster. Lesson 6.5 · Web Development
Discuss this question
79. Which CSS selector has the highest specificity? header header .header Answer: C) header
Explanation: Id selectors beat class and element selectors. Lesson 6.2 · Web Development
Discuss this question
80. A two-dimensional page layout with rows and columns is best done with: <br tags CSS Grid position: absolute Flexbox only Answer: B) CSS Grid
Explanation: Grid controls both axes. Lesson 6.2 · Web Development
Discuss this question
81. To run a function when a button is clicked, you use: addEventListener("click", fn) console.log setTimeout only onLoad only Answer: A) addEventListener("click", fn)
Explanation: Event listeners respond to user actions. Lesson 6.3 · Web Development
Discuss this question
82. Which HTTP status code means "Not Found"? 200 404 301 500 Answer: B) 404
Explanation: The requested resource does not exist. Lesson 6.1 · Web Development
Discuss this question
83. What does this JavaScript code print to the console? js const o = {name: 'Ali', age: 22}; console.log(Object.keys(o).length); 0 2 22 1 Answer: B) 2
Explanation: Running the code prints 2. Lesson 6.3 · Web Development
Discuss this question
84. Angular is developed by Google and is written mainly in: Python Java TypeScript PHP Answer: C) TypeScript
Explanation: TypeScript adds static types to JavaScript. Lesson 6.4 · Web Development
Discuss this question
85. The React hook used to store component state is: useEffect useMemo only useState useRef only Answer: C) useState
Explanation: const [count, setCount] = useState(0). Lesson 6.4 · Web Development
Discuss this question
86. Changing /orders/105 to /orders/106 in the URL shows another customer's order. This vulnerability is: XSS Broken access control (IDOR) Clickjacking Phishing Answer: B) Broken access control (IDOR)
Explanation: The server must check ownership on every request. Lesson 6.5 · Web Development
Discuss this question
87. A one-dimensional layout of items in a row or column is best done with: CSS Grid only Tables Floats only Flexbox Answer: D) Flexbox
Explanation: Flexbox aligns items along one axis. Lesson 6.2 · Web Development
Discuss this question
88. A site sends the header Content-Security-Policy: script-src 'self'. This mainly helps prevent: DDoS Weak passwords SQL injection XSS by blocking scripts from other origins Answer: D) XSS by blocking scripts from other origins
Explanation: Only same-origin scripts may run. Lesson 6.5 · Web Development
Discuss this question
89. What does this JavaScript code print to the console? js function counter() { let c = 0; return () = ++c; } const next = counter(); next(); next(); console.log(next()); 3 2 1 0 Answer: A) 3
Explanation: Running the code prints 3. Lesson 6.3 · Web Development
Discuss this question
90. What does this JavaScript code print to the console? js console.log(typeof []); object undefined list array Answer: A) object
Explanation: Running the code prints object. Lesson 6.3 · Web Development
Discuss this question
91. Variables declared with var are: Always global Not allowed in modern browsers Block-scoped constants Function-scoped and hoisted Answer: D) Function-scoped and hoisted
Explanation: let/const are block-scoped. Lesson 6.3 · Web Development
Discuss this question
92. Validating form input only in browser JavaScript is insufficient because: Attackers can bypass the browser and send requests directly Browsers do not support validation The server cannot read forms JavaScript is slow Answer: A) Attackers can bypass the browser and send requests directly
Explanation: Always validate on the server. Lesson 6.5 · Web Development
Discuss this question
93. React is best described as a: Web server Database CSS framework JavaScript library for building user interfaces Answer: D) JavaScript library for building user interfaces
Explanation: Created by Meta (Facebook). Lesson 6.4 · Web Development
Discuss this question
94. A small piece of data that a server asks the browser to store and send back with later requests is a: Cookie Cache line Packet Header file Answer: A) Cookie
Explanation: Cookies maintain sessions in stateless HTTP. Lesson 6.1 · Web Development
Discuss this question
95. Loading images only when they are about to appear on screen is: Lazy loading Caching headers only Minification Eager loading Answer: A) Lazy loading
Explanation: It speeds up initial page load. Lesson 6.5 · Web Development
Discuss this question
96. In JavaScript, "5" == 5 is true but "5" === 5 is false because: == is a syntax error === converts types === compares both value and type Strings cannot be compared Answer: C) === compares both value and type
Explanation: Use strict equality to avoid surprises. Lesson 6.3 · Web Development
Discuss this question
97. Status code 429 means: Server overloaded permanently Too many requests (rate limit exceeded) Not authorised Content moved Answer: B) Too many requests (rate limit exceeded)
Explanation: The client must slow down. Lesson 6.1 · Web Development
Discuss this question
98. Which is a semantic HTML5 element? <article <span <div <b Answer: A) <article
Explanation: Semantic tags describe meaning. Lesson 6.2 · Web Development
Discuss this question
99. JavaScript in the browser handles asynchronous tasks using: Busy waiting Multiple threads per function An event loop Interrupts Answer: C) An event loop
Explanation: Callbacks run when the call stack is free. Lesson 6.3 · Web Development
Discuss this question
100. Which array method transforms every element and returns a new array of the same length? filter() map() find() push() Answer: B) map()
Explanation: map applies a function to each element. Lesson 6.3 · Web Development
Discuss this question
Previous Page 4 of 5 Next
Practise NSCT: Web Development MCQs
More Computer Science chapters