WorksheetsWeb Development Essentials
Total questions: 12
Worksheet time: 6mins
What is the basic structure of an HTML document?
,
,,
,The basic structure of an HTML document includes: , ,
, and .Which tag is used to define the title of an HTML page?
What does CSS stand for?
Cascading Style Sheets
Cascading Style System
Creative Style Sheets
Computer Style Sheets
How do you select an element with the class 'example' in CSS?
example-class
.sample
.example
#example
What is the purpose of the 'id' attribute in HTML?
The 'id' attribute uniquely identifies an HTML element.
The 'id' attribute is used to link external stylesheets.
The 'id' attribute allows multiple elements to share the same identifier.
The 'id' attribute is used for styling elements.
How can you change the background color of a webpage using CSS?
Apply a gradient using the 'background-gradient' property.
Set the 'background-image' property to a color value.
Use the CSS property 'color' to change the background.
Use the CSS property 'background-color' to set the desired color.
What is an event in JavaScript?
A way to define a new data type in JavaScript.
An event in JavaScript is an action or occurrence that can be detected and handled by the program.
A function that executes when a variable changes.
A method to create new objects in JavaScript.
How do you attach a click event to a button in JavaScript?
myButton.addEventListener('click', function() { /* your code here */ });
document.getElementById('myButton').onclick = function() { /* your code here */ };
$('#myButton').click(function() { /* your code here */ });
document.getElementById('myButton').addEventListener('click', function() { /* your code here */ });
What is the difference between 'let' and 'var' in JavaScript?
'let' is block-scoped; 'var' is function-scoped.
'let' is function-scoped; 'var' is block-scoped.
'let' is hoisted; 'var' is not hoisted.
'let' can be redeclared; 'var' cannot.
How do you prevent the default action of an event in JavaScript?
Use event.cancelBubble = true;
Use event.preventDefault() in the event handler.
Call event.returnValue = false;
Use event.stopPropagation() in the event handler.
What is the purpose of the 'DOMContentLoaded' event in JavaScript?
To indicate that all external resources are loaded.
The purpose of the 'DOMContentLoaded' event is to signal that the DOM is fully loaded and can be manipulated.
To notify when the page is fully rendered visually.
To trigger animations on the page.
How can you change the text of an HTML element using JavaScript?
Use element.setText('new text');
Use element.innerText = 'new text'; or element.textContent = 'new text';
element.updateText('new text');
Change element.value = 'new text';
