WITH QUESTIONS AND ANSWERS||
GUARANTEED PASS|| LATEST UPDATE 2026
Which two placement options are valid for JavaScript in a web page? (Choose
two answers.) - ANSWER-internal, inline
Which statement describes the role of a function in JavaScript code? -
ANSWER-It packs up commands to perform a task on the page.
Which code should a web developer use to define a function in JavaScript? -
ANSWER-function test(a, b) {...}
Which change is necessary to make the declaration accept the function to be
called without input parameters but still return a number? function sum(a, b)
{return a+b} - ANSWER-function sum(a=0, b=0)
Which two code examples are valid DOM window methods? (Choose two
answers.) - ANSWER-confirm('Hello World!') alert('Hello World!')
Which two JavaScript commands have errors? (Choose two answers). -
ANSWER-if (a => b) { toggle = true; }
alert "Hello World!';
What is the Document Object Model (DOM)? - ANSWER-A logical structure
for accessing and manipulating HTML or XML documents
,Which element allows a developer to add a caption for a created group of items?
- ANSWER-<legend>
Which attribute value presents form data to a server for processing? -
ANSWER-submit
Which global attribute should a developer use to bind a label element to an
input element? - ANSWER-for
Given the following HTML:
What color would you like to use?
<select autofocus>
<option value = "red">Red</option>
<option value = "blue">Blue</option>
<option value = "green">Green</option>
<option value = "pink">Pink</option>
</select>
What happens when the page loads? - ANSWER-The select element in the form
takes focus.
Which code segment creates input text that has its value checked against a
regular expression? - ANSWER-<input type="text" name="name" pattern="[a-
zA-Z]">
What is a limitation of user input validation? - ANSWER-Validation detects
only incorrect formatting and missing information.
, Given the following markup:
<input id="password" name="password" type="password" class="password"
pattern=".{8,12}" required>
What does the markup do? - ANSWER-It allows a user to enter a password
between 8 and 12 characters long.
Which HTML pattern attribute validates an IPv4 address? - ANSWER-<input
type="text" pattern="\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}">
What are three reasons why a tree is a good representation of a web page?
Choose 3 answers. - ANSWER-An HTML element can have many children,
An HTML element can only ever have one parent,
It can accurately represent the nesting of elements in an HTML document.
What is a programming API? - ANSWER-A set of well-defined functions
which can be used to interact with a system
Which browser API is used when an online shopping site suggests a user's
nearest physical store? - ANSWER-Geolocation
Which browser API requests a user's permission to open a file directly without
uploading it? - ANSWER-File system access
Which code is used to retrieve the two dimensional drawing context of a canvas
element? - ANSWER-var ctx = canvas.getContext('2d');