NEW
Font size
WorksheetsModule 5: Creating Dynamic Web Pages with Scripting
Total questions: 15
Worksheet time: 5mins
Which of the following best describes client-side scripting?
Runs on the web server
Requires server requests for execution
Executes in the user's browser
Does not interact with HTML
What is the primary benefit of server-side scripting over client-side scripting?
Faster execution
Less processing load on the server
Security of sensitive data
Immediate response without server interaction
Which JavaScript data type is used to store multiple values in a single variable?
Object
Array
String
Number
What is the correct syntax to display an alert box in JavaScript?
alert("Hello World!");
msg("Hello World!");
display("Hello World!");
show("Hello World!");
Which of the following scenarios would use alert() effectively?
Displaying a welcome message on page load
Debugging JavaScript code
Hiding and showing page content
Building an interactive clock
What error message does JavaScript return for syntax errors?
ReferenceError
SyntaxError
TypeError
RangeError
What tool is most effective for debugging JavaScript errors in a browser?
Notepad
Browser Developer Tools
FTP client
Web server logs
Which JavaScript function retrieves the current time for a clock?
getTime()
new Date()
setInterval()
toLocaleTimeString()
How would you dynamically update a clock every second using JavaScript?
By calling setInterval()
By using a for loop
By reloading the page
By writing a recursive function
Evaluate the following code: Does it correctly display the current time in an alert box?
let now = new Date();
alert(now.toTimeString());
Yes, it displays the current time.
No, it only displays the date.
No, toTimeString() is incorrect.
No, alert() cannot display time.
What modifications would you suggest to enhance the readability of a JavaScript clock script?
Add comments explaining the logic
Use shorter variable names
Minimize the use of functions
Avoid using CSS styles
Which JavaScript method toggles the visibility of an HTML element?
toggleVisibility()
getElementById()
setAttribute()
style.display
Analyze the following code: What error might it cause?
document.getElementById("content").style.visibility = show;
show is undefined
getElementById is not a function
visibility is not a valid property
Missing semicolon causes error
What approach would you use to add a custom control to a video player in JavaScript?
Modify the HTML <video> element directly
Use the createElement and appendChild methods
Manipulate the innerHTML of the player
Replace the <video> element with a canvas element
Evaluate the benefits of using custom controls over default video player controls.
Custom controls are more intuitive for all users.
Custom controls allow better styling and integration.
Custom controls use less code than default controls.
Custom controls improve browser compatibility.
