Quiz
Javascript Test
Create a free account to finish this quiz
Save your progress and see your final score.
Already have an account? Sign in
Questions in this quiz (51)
1Which of the following will return a live HTML collection?
- Adocument.querySelector()
- Bdocument.getElementByClassName()
- Cdocument.getElementById()
- Ddocument.querySelectorAll()
2Which method would you use to stop a default action?
- AstopDefault()
- BpreventDefault()
- CendDefault()
- Dyou can’t stop a default action
3During a keydown event, altKey and ctrlKey will repeat if held.
- ATrue
- BFalse
4The Array.from() method will not work in which of the following browsers
- AInternet Explorer
- BGoogle Chrome
- CMicrosoft Edge
- DMozilla Firefox
5An HTML file can contain a reference for an external file. The…
- AJavascript
- BCSS
- CAn image
- DAll of the above
6To add a class to an element without overwriting the other class
- Aelement.classList.add()
- Belement.className
- Celement.classList.contains()
- Delement.class
7What is the property on the event object for a click event…
- AclickedOn
- Bevent
- Cclick
- Drub
8In order to reduce security problems, JavaScript runs in a restrictive environment called a:
- Afirewall
- Bsandbox
- Csean's house
- Dtunnel
9When adding event handler
- Aadd event listener
- Badd event
- Cevent
- Devent listener
10Events are fired on the target element and then each of the target element’s parents.
- Apropagation
- Btargeting
- Ccapturing
- Dobserving
11Leaf nodes can contain...
- AHTML nodes
- BHTML tags
- Ctext content
- Dother elements
12In order to use JavaScript on a web page, there must be a(n) _______ file.
- ACSS
- Bsecurity
- Cimage
- DHTML
13When linking to JavaScript in a web page, the defer attribute will:
- Adownload the JavaScript file and run it right away
- Bdefer is not used with JavaScript
- Cwait until the page is loaded and then download and run the JavaScript file
- Ddownload the JavaScript file but run it after the page is loaded
14How would you edit the background color of the element paragraph?
- Aparagraph.style.backgroundcolor
- Bparagraph.style.background-color
- Cparagraph.backgroundcolor
- Dparagraph.style.backgroundColor
15Which of these is an event?
- Adblclick
- Bclick
- Ckeydown
- DAll of the above
16DOM stand for __________________
- ADocument Object Model
- BDocument Overall Method
- CDocument variable
- DDocument Observer Method
17To select the next child in the DOM you use which of the following?
- Aelement.next.sibling
- Belement.nextElementSibling
- Celement.next
- Delement.nextElementChild
18When would event.button return the number 2 for a mouse button pressed?
- AWhen the left button is pressed
- BWhen no button is pressed
- CWhen the middle button is pressed
- DWhen the right button is pressed
19An event can be ________
- Anever initiated by the user
- Ban interaction with our page
- Ca list of node child
- Dnone of the above
20Using querySelector(), the . symbol will select elements:
- ABy the class
- BBy the tag
- CBy the name
- DBy the ID
21Using querySelector(), the # symbol will select elements:
- ABy the class
- BBy the tag
- CBy the name
- DBy the id
22Which has the highest order of precedence?
- AInternal Stylesheets
- Bthe style property
- CEmbedded Stylesheets
- DInherited styles
23The first thing the browser does when loading a webpage is:
- Asize the HTML file to the screen
- Bdownload the HTML file
- Cload the JavaScript DOM functions to the page
- Dopen a model of the HTML file
24What are the steps of a webpage being displayed?
- Aa request is made when a link is clicked
- Bthe page and its resources are downloaded
- Cjavascript file downloaded and loaded by defer
25event.repeat will return what type of value if a key is held?
- ABoolean
- Bnull
- Cnumber
- DArray
26Which command allows you to add text directly without first creating a text node?
- Ael.textContent
- Bel.appendChild()
- Cel.CreateTextNode()
- Del.setAttribute()
27In HTML, the type attribute is required in the <script> tag
- ATrue
- BFalse
28You have added an event listen to the following code. Which of these will remove…
beta.addEventListener(‘click’, newgame);- Anewgame.removeEventListener(‘click’, alpha);
- Bbeta.removeEventListener();
- Cbeta.removeEventListener(‘click’, newgame);
- DremoveEventListener(‘click’, newgame);
29When using document.querySelectorAll() it returns:
- AA list
- BIndividual objects for each element selected
- CAn array like object
- DAn array
30A URL is used to:
- Adownload the closest match
- Bget email
- Cdetermine what program should download the file
- Duniquely identifies files on the Web
31The second parameter of an addEventListener() accepts a ______________ variable.
- Aevent
- Barray
- Clist
- Dfunction
32The DOM is organized like a _____.
- ACircle
- BBlock
- CTree
- DSquare
33Like HTML, the default character-set for JavaScript is:
- Autf-8
- Bemoji-23
- Cdefer
- Dtype
34When a user releases a key, which event is sent?
- Akeyup
- BshiftKey
- Cspace
- Dkeydown
35If you have a <p> element stored in the variable para and you want to add text, which command should you use?
- Apara.insert(txt)
- Bpara.addChild(txt)
- Cparagraph.add(txt)
- Dpara.appendChild(txt)
36To stop many events that may fire many times in a row, we can use clearTimeout
- ATrue
- BFalse
37You can use the function setTimeout() to schedule a function.
- ATrue
- BFalse
38What is the global variable that contains the DOM?
- Ahead
- Bwindow
- Cbody
- Ddocument
39What is the advantage of HTTPS over HTTP?
- Ait is less expensive
- Bit is encrypted
- Cit is faster
- Dall of the above
40In order to use JavaScript on a webpage, you must include the _____ element
- Asrc
- Bscript
- Cjs
- Dlink
41Which event relates to the action of a keyboard being pressed?
- Akeyclick
- Bkeypress
- Ckeyset
- Dkeybutton
42The scroll event is fired every time the page is scrolled.
- ATrue
- BFalse
43All Javascript code will wait for other code to finish before running
- ATrue
- BFalse
44To add an element as the last child of an element parent you would use
- Aparent.replaceChild()
- Bparent.appendChild()
- Cparent.insertAfter()
- Dparent.addChild()
45A mouseover event is going to fire when the mouse pointer is _ an element
- Ahover overs
- Bclick
- Ctouch
46 If the body of a document contains a paragraph element inside of it, the paragraph is considered to be
- Aa sibling of the body element
- Bnot related to the body element
- Ca parent of the body element
- Da child of the body element
47 You have selected all of the list elements and put them in a variable called items. How would you add the class first to the elements?
- Aitems.add.class(‘first’)
- Bitems.classSet.add(‘first’)
- Citems.class.add(‘first’)
- Dnone of the above
48Which command can either add or remove a class from an element?
- Ael.classList.remove()
- Bel.classList.contains()
- Cel.classList.add()
- Del.classList.toggle()
49When adding an event we should use:
- AaddEvent ()
- Bevent()
- CaddEventListener ()
- DeventListener ()
50When you use document.createTextNode command, what happens?
- AA text node is created and stored in memory
- BA text node is created and inserted into the paragraph element
- CA text node is created and added to the end of the document
- DA text node is created and added to the beginning of the document
51When adding an event we should use:
- AaddEvent ()
- Bevent()
- CaddEventListener ()
- DeventListener ()
Information
- Description
- Good luck everyone!
- Author
- Sean Connell
- Language
- English
- Views
- 27
- Tags
- Rating
- No ratings yet Rate this quiz