CIW JavaScript Specialist 1D0 735 Complete Study and Exam Guide, Exams of Technology

A comprehensive resource covering JavaScript programming concepts, DOM manipulation, debugging techniques, and modern scripting practices. Designed with structured lessons and certification-focused exercises.

Typology: Exams

2025/2026

Available from 02/24/2026

shilpi-jain-3
shilpi-jain-3 🇮🇳

2.5

(11)

80K documents

1 / 55

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CIW JavaScript Specialist 1D0 735 Complete
Study and Exam Guide
**Question 1.** Which keyword creates a blockscoped variable? A) var B) let C) const D)
function
Answer: B
Explanation: `let` limits the variable to the surrounding block.
**Question 2.** What does the `===` operator check? A) Value only B) Type only C) Both value
and type D) Neither
Answer: C
Explanation: Strict equality compares both value and data type.
**Question 3.** In which environment does the `window` object exist? A) Node.js B) Browser C)
Both D) Neither
Answer: B
Explanation: `window` is the global object for browsers only.
**Question 4.** Which method displays a dialog that returns true/false based on user choice?
A) alert() B) prompt() C) confirm() D) console.log()
Answer: C
Explanation: `confirm()` shows OK/Cancel and returns a boolean.
**Question 5.** What is the output of `typeof null`? A) "null" B) "object" C) "undefined" D)
"boolean"
Answer: B
Explanation: Historically, `null` is reported as an object.
**Question 6.** Which of the following is NOT a valid comment syntax? A) // comment B) /*
comment */ C) # comment D) <!-- comment -->
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37

Partial preview of the text

Download CIW JavaScript Specialist 1D0 735 Complete Study and Exam Guide and more Exams Technology in PDF only on Docsity!

Study and Exam Guide

Question 1. Which keyword creates a block‑scoped variable? A) var B) let C) const D) function Answer: B Explanation: let limits the variable to the surrounding block. Question 2. What does the === operator check? A) Value only B) Type only C) Both value and type D) Neither Answer: C Explanation: Strict equality compares both value and data type. Question 3. In which environment does the window object exist? A) Node.js B) Browser C) Both D) Neither Answer: B Explanation: window is the global object for browsers only. Question 4. Which method displays a dialog that returns true/false based on user choice? A) alert() B) prompt() C) confirm() D) console.log() Answer: C Explanation: confirm() shows OK/Cancel and returns a boolean. Question 5. What is the output of typeof null? A) "null" B) "object" C) "undefined" D) "boolean" Answer: B Explanation: Historically, null is reported as an object. Question 6. Which of the following is NOT a valid comment syntax? A) // comment B) /* comment */ C) # comment D)

Study and Exam Guide

Answer: C Explanation: # starts comments only in some scripting languages, not JavaScript. Question 7. Which statement correctly declares a constant that cannot be reassigned? A) var PI = 3.14; B) let PI = 3.14; C) const PI = 3.14; D) const var PI = 3.14; Answer: C Explanation: const creates an immutable binding. Question 8. Which loop guarantees at least one execution? A) for B) while C) do...while D) forEach Answer: C Explanation: do...while runs the body before testing the condition. Question 9. What does the Array.prototype.map method return? A) The original array B) A new array with transformed elements C) The length of the array D) undefined Answer: B Explanation: map creates a new array containing the results of the callback. Question 10. Which operator performs a bitwise OR? A) && B) || C) | D) ^ Answer: C Explanation: | is the bitwise OR operator. Question 11. Which statement creates an anonymous function assigned to a variable? A) function foo() {} B) var foo = function() {}; C) const foo = () => {}; D) Both B and C Answer: D Explanation: Both function expressions and arrow functions can be anonymous.

Study and Exam Guide

Question 17. Which property changes the background color of an element via JavaScript? A) style.backgroundColor B) style.bgColor C) css('background') D) setAttribute('bg') Answer: A Explanation: style.backgroundColor sets the CSS background-color property. Question 18. Which attribute prevents a form from being submitted if the field is empty? A) required B) placeholder C) disabled D) readonly Answer: A Explanation: required forces the user to fill the field before submission. Question 19. Which method safely stores data that persists across sessions? A) sessionStorage.setItem() B) localStorage.setItem() C) cookie.expires = … D) document.write() Answer: B Explanation: localStorage retains data even after the browser is closed. Question 20. Which HTTP header is most relevant for preventing XSS? A) Content-Type B) X-Frame-Options C) Content-Security-Policy D) Accept-Encoding Answer: C Explanation: CSP restricts sources of executable scripts, mitigating XSS. Question 21. Which JavaScript feature introduced in ES6 provides default parameter values? A) Rest parameters B) Default parameters C) Destructuring D) Spread operator Answer: B Explanation: Functions can declare defaults directly in the parameter list. Question 22. Which keyword is used to import a module in ES6? A) require B) import C) include D) using

Study and Exam Guide

Answer: B Explanation: import loads exported bindings from another module. Question 23. Which method creates a new object that inherits from a prototype? A) Object.create() B) new Object() C) Object.assign() D) Object.defineProperty() Answer: A Explanation: Object.create sets the prototype of the new object. Question 24. In JavaScript, which value is falsy? A) [] B) {} C) 0 D) "false" Answer: C Explanation: 0 coerces to false in Boolean contexts. Question 25. Which loop is most appropriate for iterating over an object’s own enumerable properties? A) for...of B) for...in C) while D) forEach Answer: B Explanation: for...in enumerates property names; you should filter with hasOwnProperty. Question 26. Which operator will convert a string to a number? A) ++ B) + (unary) C) parseInt() D) Both B and C Answer: D Explanation: Unary + and parseInt (or Number) coerce strings to numbers. Question 27. Which event fires when a user releases a mouse button over an element? A) click B) mousedown C) mouseup D) mouseover Answer: C Explanation: mouseup occurs on button release.

Study and Exam Guide

Question 33. Which method sends an asynchronous HTTP GET request using the Fetch API? A) fetch(url) B) XMLHttpRequest.open('GET') C) $.get(url) D) ajax.get(url) Answer: A Explanation: fetch returns a promise that resolves with the response. Question 34. Which header must be set to indicate JSON data in an AJAX request? A) Content-Type: text/plain B) Accept: / C) Content-Type: application/json D) X-Requested-With: XMLHttpRequest Answer: C Explanation: application/json tells the server the payload is JSON. Question 35. Which JavaScript feature allows a function to retain access to its lexical scope after execution? A) Closure B) Prototype C) Inheritance D) Hoisting Answer: A Explanation: Closures capture variables from their defining environment. Question 36. Which statement correctly declares a function expression named calc? A) function calc(){ } B) var calc = function(){ }; C) let calc = () => { }; D) Both B and C Answer: D Explanation: Both assignments create function expressions; the second uses an arrow function. Question 37. Which method is used to add a new element at the end of an array? A) push() B) pop() C) shift() D) unshift() Answer: A Explanation: push appends items to the array’s tail.

Study and Exam Guide

Question 38. Which operator returns true only if both operands are true? A) || B) && C)! D) ?? Answer: B Explanation: Logical AND (&amp;&amp;) requires both sides to be truthy. Question 39. Which statement best describes the tag? A) Executes JavaScript when disabled B) Provides fallback content for non‑JavaScript browsers C) Hides content from screen readers D) Declares a script that never runs Answer: B Explanation: displays its content when scripting is unavailable. Question 40. Which method clones a node, optionally including its descendants? A) copyNode() B) cloneNode(true) C) duplicate() D) clone(true) Answer: B Explanation: cloneNode(true) performs a deep copy. Question 41. Which of the following is a valid way to prevent default form submission? A) event.stopPropagation() B) event.preventDefault() C) return false; D) Both B and C Answer: D Explanation: Both preventDefault and returning false stop the default action. Question 42. Which property of the navigator object provides geographic location? A) navigator.geolocation B) navigator.location C) navigator.geo D) navigator.position Answer: A Explanation: navigator.geolocation gives access to the Geolocation API.

Study and Exam Guide

document.getElementById('btn').addEventListener('click',handler); C) $('#btn').on('click',handler); D) Both A and B Answer: D Explanation: Both direct assignment and addEventListener work; the latter allows multiple listeners. Question 49. Which of the following is a synchronous XHR request? A) xhr.open('GET',url,true) B) xhr.open('GET',url,false) C) fetch(url,{async:true}) D) $.ajax({async:true}) Answer: B Explanation: Setting the third argument to false makes the request synchronous. Question 50. Which operator can be used to check if a variable is defined without throwing a ReferenceError? A) typeof B) instanceof C) in D) hasOwnProperty Answer: A Explanation: typeof returns "undefined" for undeclared variables safely. Question 51. Which method returns an array of the keys of an object? A) Object.keys(obj) B) obj.getKeys() C) Object.values(obj) D) obj.keys() Answer: A Explanation: Object.keys lists own enumerable property names. Question 52. Which statement correctly creates a shallow copy of an object? A) let copy = {...original}; B) let copy = Object.assign({},original); C) Both A and B D) Neither Answer: C Explanation: Both spread syntax and Object.assign produce shallow copies.

Study and Exam Guide

Question 53. Which property indicates the number of milliseconds elapsed since the page loaded? A) performance.now() B) Date.now() C) window.timeSinceLoad D) performance.timing.loadEventEnd Answer: A Explanation: performance.now() returns a high‑resolution timestamp relative to navigation start. Question 54. Which CSS selector can be used with querySelectorAll to select every third element? A) li:nth-child(3) B) li:nth-of-type(3n) C) li:3n D) li:nth(3) Answer: B Explanation: `:nth-of-type(3n)` matches every third. Question 55. Which method can be used to debounce a function call? A) setTimeout B) clearInterval C) requestAnimationFrame D) None of the above (requires custom implementation) Answer: D Explanation: Debouncing is a pattern that must be coded, often using setTimeout internally. Question 56. Which of the following is a valid way to export multiple values from a module? A) export { foo, bar }; B) module.exports = { foo, bar }; C) export default { foo, bar }; D) Both A and B Answer: D Explanation: Both ES6 named exports and CommonJS module.exports work. Question 57. Which event is fired when the DOM is fully parsed, without waiting for stylesheets and images? A) load B) DOMContentLoaded C) ready D) init Answer: B Explanation: DOMContentLoaded occurs after the document is parsed.

Study and Exam Guide

Question 63. Which of these is a built‑in method for formatting numbers as currency? A) toLocaleString() B) toCurrency() C) formatCurrency() D) Intl.NumberFormat().format() Answer: D (and A with options) Explanation: Intl.NumberFormat provides locale‑aware currency formatting; toLocaleString can also be used with options. Question 64. Which of the following is true about arrow functions? A) They have their own this binding. B) They cannot be used as constructors. C) They support arguments object. D) Both A and C. Answer: B Explanation: Arrow functions inherit this and lack their own arguments, and cannot be called with new. Question 65. Which method returns a promise that resolves after a given delay? A) setTimeout() B) Promise.delay() C) new Promise(resolve => setTimeout(resolve, ms)) D) asyncDelay(ms) Answer: C Explanation: Wrapping setTimeout in a promise creates a delayed resolution. Question 66. Which of the following is the correct syntax for a template literal? A) "Hello ${name}" B) Hello ${name} C) 'Hello ${name}' D) <> Answer: B Explanation: Backticks enable expression interpolation. Question 67. Which property of the event object tells you which mouse button was pressed? A) button B) which C) keyCode D) mouseButton Answer: A Explanation: event.button indicates left (0), middle (1), right (2).

Study and Exam Guide

Question 68. Which method can be used to serialize form data into a URL‑encoded string? A) new FormData(form) B) new URLSearchParams(new FormData(form)).toString() C) form.serialize() D) JSON.stringify(form) Answer: B Explanation: Converting FormData to URLSearchParams yields a query string. Question 69. Which of the following is a correct way to set a cookie that expires in 7 days? A) document.cookie = "user=Bob; max-age=604800"; B) document.cookie = "user=Bob; expires=7"; C) document.cookie = "user=Bob; expires=Tue, 01 Jan 2030 00:00:00 GMT"; D) Both A and C Answer: D Explanation: max-age in seconds or a proper GMT date string both define expiration. Question 70. Which method creates an HTML element dynamically? A) document.createElement('div') B) document.newElement('div') C) $('') D) element.append('div') Answer: A Explanation: createElement constructs a new DOM node. Question 71. Which HTTP method is idempotent? A) POST B) GET C) PATCH D) DELETE Answer: B (and DELETE is also idempotent, but GET is the classic example) Explanation: Repeating a GET request yields the same result without side effects. Question 72. Which of the following statements about async functions is false? A) They always return a promise. B) They can use await inside. C) They can be called without new. D) They must contain at least one await. Answer: D

Study and Exam Guide

Explanation: _.debounce creates a debounced version of func. Question 78. Which of the following statements about the this keyword inside a regular function called as a method is true? A) It refers to the global object. B) It refers to the object the method belongs to. C) It is undefined in strict mode. D) It always refers to the function itself. Answer: B Explanation: When called as obj.method(), this is bound to obj. Question 79. Which of these is a correct way to add a polyfill for Array.prototype.includes? A) if (!Array.prototype.includes) { Array.prototype.includes = function(v){ return this.indexOf(v) !== - 1; }; } B) Array.prototype.includes = function(v){ return this.indexOf(v) !== - 1; }; C) polyfill('Array.includes'); D) None of the above Answer: A Explanation: The conditional adds the method only if it is missing. Question 80. Which of the following is the correct way to listen for a custom event named “dataReady”? A) element.addEventListener('dataReady', handler); B) element.on('dataReady', handler); C) element.attachEvent('dataReady', handler); D) element.listen('dataReady', handler); Answer: A Explanation: addEventListener works for custom events as well. Question 81. Which of these statements correctly creates a WeakMap? A) let wm = new WeakMap(); B) let wm = WeakMap(); C) let wm = {}; D) let wm = new Map(); Answer: A Explanation: new WeakMap() constructs a weakly‑referenced map.

Study and Exam Guide

Question 82. Which method can be used to pause execution of an async function for 2 seconds? A) await setTimeout(resolve,2000) B) await new Promise(r => setTimeout(r,2000)) C) sleep(2000) D) pause(2000) Answer: B Explanation: Wrapping setTimeout in a promise allows await to pause. Question 83. Which of the following is true about the fetch API? A) It automatically throws on HTTP error status. B) It returns a promise that resolves to a Response object. C) It only works in Node.js. D) It cannot send request bodies. Answer: B Explanation: fetch resolves even for 4xx/5xx; you must check response.ok. Question 84. Which CSS property can be modified via JavaScript to hide an element? A) display B) visibility C) opacity D) All of the above Answer: D Explanation: Changing any of these can affect element visibility. Question 85. Which of the following is a correct way to iterate over a Map’s entries? A) for (let [k,v] of myMap) { … } B) myMap.forEach((v,k) => { … }) C) Both A and B D) Neither Answer: C Explanation: Both the for...of loop and forEach iterate over entries. Question 86. Which method can be used to convert a NodeList to an Array? A) Array.from(nodeList) B) nodeList.toArray() C) [...nodeList] D) Both A and C Answer: D Explanation: Array.from and spread syntax both create an array from an iterable.

Study and Exam Guide

Question 92. Which of the following is a correct way to add a class “active” to all elements? A) document.querySelectorAll('li').forEach(el =&gt; el.classList.add('active')); B) document.getElementsByTagName('li').addClass('active'); C) $('li').addClass('active'); D) Both A and C Answer: D Explanation: Native `forEach` and jQuery both add the class. **Question 93.** Which of these is a valid way to create a reusable component in React? A) function MyComp() { return ; } B) class MyComp extends React.Component { render(){ return ; } } C) const MyComp = () =&gt; ; D) All of the above Answer: D Explanation: Functional, class, and arrow components are all valid. **Question 94.** Which of the following is true about the `let` keyword inside a `for` loop? A) Each iteration gets a fresh binding. B) The variable is shared across iterations. C) `let` cannot be used in loops. D) It behaves like `var`. Answer: A Explanation: `let` in a `for` creates a new binding per iteration. **Question 95.** Which of these is a correct way to set the `src` attribute of an element using JavaScript? A) img.setAttribute('src','path.jpg'); B) img.src = 'path.jpg'; C) Both A and B D) Neither Answer: C Explanation: Both property assignment and setAttribute work. Question 96. Which method can be used to asynchronously load a script file? A) document.createElement('script') with async=true B) import('script.js') C) Both A and B D) Neither

Study and Exam Guide

Answer: C Explanation: Dynamically created script tags with async and dynamic import() both load scripts asynchronously. Question 97. Which of the following is a valid way to create a regular expression that matches digits? A) /\d+/ B) new RegExp('\d+') C) Both A and B D) Neither Answer: C Explanation: Both literal and constructor forms create the same regex. Question 98. Which of these statements about the sessionStorage API is false? A) Data persists after the browser is closed. B) Data is scoped to the origin. C) It stores only string values. D) It is synchronous. Answer: A Explanation: sessionStorage is cleared when the session ends (browser/tab closed). Question 99. Which of the following statements correctly describes the Proxy object? A) It allows interception of fundamental operations on an object. B) It creates a shallow copy of an object. C) It is used for deep cloning. D) It replaces the need for getters/setters. Answer: A Explanation: Proxy can trap operations like get, set, etc. Question 100. Which of the following is a correct way to listen for changes to localStorage across tabs? A) window.addEventListener('storage', handler) B) document.addEventListener('storage', handler) C) localStorage.onchange = handler D) Both A and B Answer: A Explanation: The storage event fires on other windows when localStorage changes.