wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Module 5: Creating Dynamic Web Pages with Scripting

Total questions: 15

Worksheet time: 5mins

Name
Class
Date
1.

Which of the following best describes client-side scripting?

a)

Runs on the web server

b)

Requires server requests for execution

c)

Executes in the user's browser

d)

Does not interact with HTML

2.

What is the primary benefit of server-side scripting over client-side scripting?

a)

Faster execution

b)

Less processing load on the server

c)

Security of sensitive data

d)

Immediate response without server interaction

3.

Which JavaScript data type is used to store multiple values in a single variable?

a)

Object

b)

Array

c)

String

d)

Number

4.

What is the correct syntax to display an alert box in JavaScript?

a)

alert("Hello World!");

b)

msg("Hello World!");

c)

display("Hello World!");

d)

show("Hello World!");

5.

Which of the following scenarios would use alert() effectively?

a)

Displaying a welcome message on page load

b)

Debugging JavaScript code

c)

Hiding and showing page content

d)

Building an interactive clock

6.

What error message does JavaScript return for syntax errors?

a)

ReferenceError

b)

SyntaxError

c)

TypeError

d)

RangeError

7.

What tool is most effective for debugging JavaScript errors in a browser?

a)

Notepad

b)

Browser Developer Tools

c)

FTP client

d)

Web server logs

8.

Which JavaScript function retrieves the current time for a clock?

a)

getTime()

b)

new Date()

c)

setInterval()

d)

toLocaleTimeString()

9.

How would you dynamically update a clock every second using JavaScript?

a)

By calling setInterval()

b)

By using a for loop

c)

By reloading the page

d)

By writing a recursive function

10.

Evaluate the following code: Does it correctly display the current time in an alert box?

let now = new Date();

alert(now.toTimeString());

a)

Yes, it displays the current time.

b)

No, it only displays the date.

c)

No, toTimeString() is incorrect.

d)

No, alert() cannot display time.

11.

What modifications would you suggest to enhance the readability of a JavaScript clock script?

a)

Add comments explaining the logic

b)

Use shorter variable names

c)

Minimize the use of functions

d)

Avoid using CSS styles

12.

Which JavaScript method toggles the visibility of an HTML element?

a)

toggleVisibility()

b)

getElementById()

c)

setAttribute()

d)

style.display

13.

Analyze the following code: What error might it cause?

document.getElementById("content").style.visibility = show;

a)

show is undefined

b)

getElementById is not a function

c)

visibility is not a valid property

d)

Missing semicolon causes error

14.

What approach would you use to add a custom control to a video player in JavaScript?

a)

Modify the HTML <video> element directly

b)

Use the createElement and appendChild methods

c)

Manipulate the innerHTML of the player

d)

Replace the <video> element with a canvas element

15.

Evaluate the benefits of using custom controls over default video player controls.

a)

Custom controls are more intuitive for all users.

b)

Custom controls allow better styling and integration.

c)

Custom controls use less code than default controls.

d)

Custom controls improve browser compatibility.