Question 1
Question
Which of the following will return a live HTML collection?
Answer
-
document.querySelector()
-
document.getElementByClassName()
-
document.getElementById()
-
document.querySelectorAll()
Question 2
Question
Which method would you use to stop a default action?
Question 3
Question
During a keydown event, altKey and ctrlKey will repeat if result of Boolean operator is true
Question 4
Question
The Array.from() method will not work in which of the following browsers
Answer
-
Internet Explorer
-
Google Chrome
-
Microsoft Edge
-
Mozilla Firefox
Question 5
Question
An HTML file can contain a reference for an external file. The…
Answer
-
Javascript
-
CSS
-
An image
-
All of the above
Question 6
Question
To add a class to an element without overwriting the other class…
Question 7
Question
What is the property on the event object for a click event…
Answer
-
clickedOn
-
event
-
click
-
rub
Question 8
Question
In order to reduce security problems, JavaScript runs in a restrictive environment called a:
Answer
-
firewall
-
sandbox
-
sean's house
-
tunnel
Question 9
Question
When adding event handler
Answer
-
add event listener
-
add event
-
event
-
event listener
Question 10
Question
Events are fired on the target element and then each of the target element’s parents.
Answer
-
propagation
-
targeting
-
capturing
-
observing
Question 11
Question
Leaf nodes can contain...
Answer
-
HTML nodes
-
HTML tags
-
text content
-
other elements
Question 12
Question
In order to use JavaScript on a web page, there must be a(n) _______ file.
Question 13
Question
When linking to JavaScript in a web page, the defer attribute will:
Answer
-
download the JavaScript file and run it right away
-
defer is not used with JavaScript
-
wait until the page is loaded and then download and run the JavaScript file
-
download the JavaScript file but run it after the page is loaded
Question 14
Question
How would you edit the background color of the element paragraph?
Answer
-
paragraph.style.backgroundcolor
-
paragraph.style.background-color
-
paragraph.backgroundcolor
-
paragraph.style.backgroundColor
Question 15
Question
Which of these is an event?
Answer
-
dblclick
-
click
-
keydown
-
All of the above
Question 16
Question
DOM stand for __________________
Answer
-
Document Object Model
-
Document Overall Method
-
Document variable
-
Document Observer Method
Question 17
Question
In order to reduce security problems, JavaScript runs in a restricted environment…
Question 18
Question 19
Question
An event can be ________
Question 20
Question
Using querySelector(), the . symbol will select elements:
Answer
-
By the class
-
By the tag
-
By the name
-
By the ID
Question 21
Question
Using querySelector(), the # symbol will select elements:
Answer
-
By the class
-
By the tag
-
By the name
-
By the id
Question 22
Question
Which has the highest order of precedence?
Answer
-
Internal Stylesheets
-
the style property
-
Embedded Stylesheets
-
Inherited styles
Question 23
Question
The first thing the browser does when loading a webpage is:
Answer
-
size the HTML file to the screen
-
download the HTML file
-
load the JavaScript DOM functions to the page
-
open a model of the HTML file
Question 24
Question
What are the steps of a webpage being displayed?
Answer
-
a request is made when a link is clicked
-
the page and its resources are downloaded
-
javascript file downloaded and loaded by defer
Question 25
Question
event.repeat will return what type of value if a key is held?
Answer
-
Boolean
-
null
-
number
-
Array
Question 26
Question
Which command allows you to add text directly without first creating a text node?
Answer
-
el.textContent
-
el.appendChild()
-
el.CreateTextNode()
-
el.setAttribute()
Question 27
Question
In HTML, the type attribute is required in the <script> tag
Question 28
Question
You have added an event listen to the following code. Which of these will remove…
beta.addEventListener(‘click’, newgame);
Answer
-
newgame.removeEventListener(‘click’, alpha);
-
beta.removeEventListener();
-
beta.removeEventListener(‘click’, newgame);
-
removeEventListener(‘click’, newgame);
Question 29
Question
When using document.querySelectorAll() it returns:
Question 30
Question
A URL is used to:
Answer
-
download the closest match
-
get email
-
determine what program should download the file
-
uniquely identifies files on the Web
Question 31
Question
The second parameter of an addEventListener() accepts a ______________ variable.
Answer
-
event
-
array
-
list
-
function
Question 32
Question
The DOM is organized like a _____.
Question 33
Question
Like HTML, the default character-set for JavaScript is:
Answer
-
utf-8
-
emoji-23
-
defer
-
type
Question 34
Question
When a user releases a key, which event is sent?
Answer
-
keyup
-
shiftKey
-
space
-
keydown
Question 35
Question
If you have a <p> element stored in the variable para and you want to add text, which command should you use?
Answer
-
para.insert(txt)
-
para.addChild(txt)
-
paragraph.add(txt)
-
para.appendChild(txt)
Question 36
Question
To stop many events that may fire many times in a row, we can use stopPropagation()
Question 37
Question
You can use the function setTimeout() to schedule a function.
Question 38
Question
What is the global variable that contains the DOM?
Answer
-
head
-
window
-
body
-
document
Question 39
Question
What is the advantage of HTTPS over HTTP?
Answer
-
it is less expensive
-
it is encrypted
-
it is faster
-
all of the above
Question 40
Question
In order to use JavaScript on a webpage, you must include the _____.
Question 41
Question
Which event relates to the action of a keyboard being pressed?
Answer
-
keyclick
-
keypress
-
keyset
-
keybutton
Question 42
Question
The scroll event is fired every time the page is scrolled.