| Pass Guarantee | Instant Download PDF
1. In order to add drag-and-drop functionality to your Web pages, you must
define an element as able to be dragged by:
setting its draggable attribute to the value "on".
setting its draggable attribute to the value "yes".
setting its draggable attribute to the value "drag".
setting its draggable attribute to the value "true".
2. Describe a scenario in which using an <aside> element would be appropriate
in a web page.
An <aside> element would be appropriate for displaying a sidebar
with related links or additional information that complements the
main content.
An <aside> element should be used for the main article content of the
page.
An <aside> element is used to define the header of a webpage.
An <aside> element is best used for creating a footer section.
3. If you were to create a JavaScript function named 'calculateSum' that takes
two parameters, what would the correct syntax look like?
function calculateSum: a, b { }
function calculateSum(a, b) { return; }
function calculateSum(a, b) => { }
function calculateSum(a, b) { }
,4. If a web application needs to update the URL to reflect the current state of
the application without reloading the page, which method should be used
and why?
history.pushState() should be used to update the URL without
reloading the page, allowing for a smoother user experience.
window.location.assign() should be used to navigate to a new URL,
which reloads the page.
document.createElement() should be used to create new elements in
the DOM.
history.replaceState() should be used to remove the current entry
from the history stack.
5. Which data type contains properties and methods?
Null
Function
Object
String
6. Describe how using <fieldset> and <legend> elements can enhance form
accessibility.
They group related inputs together, making it easier for users to
understand the form structure.
They change the color of the form elements.
They increase the size of the form inputs.
They automatically validate form inputs.
,7. What can client-side JavaScript be used for?
To interact with other programs, control the operating system, and
dynamically create standalone content.
To interact with hardware, control devices, and dynamically create
embedded content.
To interact with the user, control the browser, and dynamically
create HTML content.
To interact with the server, control the database, and dynamically
create server-side content.
8. What is the purpose of the <aside> element in HTML?
To embed multimedia content.
To create a navigation menu.
To define the main content of a document.
To represent content that is tangentially related to the content
around it.
9. What CSS rule would you use to set the font size to 18 pixels and the font
family to Arial for all h2 elements?
h2 { font-size: 18pt; font-family: Arial; }
h2 { font-size: 18px; font-style: Arial; }
h2 { font-size: 18px; font-family: Arial; }
h2 { font: 18px Arial; }
10. Describe how you would modify the 'sum' function to accept no parameters
and still return a number.
, You would change the function name to avoid confusion.
You would add parameters to the function to ensure it can accept
inputs.
You would change the function to return a fixed number or a
calculation that does not require parameters.
You would remove the return statement to avoid outputting a value.
11. Identify the correct syntax for a JavaScript alert command.
alert: 'Hello World!';
alert 'Hello World!';
alert('Hello World!')
alert('Hello World!');
12. If a developer wants to implement a drag-and-drop feature for images onto
a specific section of a webpage, which additional step must be taken after
adding event.preventDefault() in the dragOver function?
Add a mouseover event to highlight the drop area.
Create a new image element in the dragStart function.
Implement the drop event handler to process the dropped image.
Use CSS to change the cursor style during the drag operation.
13. Describe how the 'max-width' property contributes to responsive web
design for images.
'max-width' sets a fixed size for images regardless of screen size.
'max-width' allows images to scale down to fit the screen size while
maintaining their aspect ratio.