Title: Quiz Week 5 Functions
Course: Fall 2023 - WEBD 164 (41934) > Section: Week 5 (Sep 18) How to Use Functions and Events

Q: Which of the below statements are true about a JavaScript function? Check as many as apply
- It is a block of code that executes at least one JavaScript Statement
- Functions allow the same code to be used over and over
- Functions are executed when an event occurs
- Functions can be programmed to be executed when you want them to run
A: It is a block of code that executes at least one JavaScript Statement; Functions allow the same code to be used over and over; Functions are executed when an event occurs; Functions can be programmed to be executed when you want them to run

Q: In the below code, the word "what" represents a ___________________

function showMessage(what)
{
alert(what);
}
- parameter
- method
- value
- literal
A: parameter

Q: Copy of  In the below code, the word "Hello World" represents a(n)  ___________________ , which is passed to the function

function showMessage(what)
{
alert(what);
}

window.onload = showMessage("Hello World");
- parameter
- method
- variable
- argument
A: argument

Q: A function can take several parameters - true or false
- True
- False
A: True

Q: A function can return a value - true or false
- True
- False
A: True

Q: An event is an action that occurs on the webpage such as a
- click
- mouseover
- page load
- all of the above
A: all of the above

Q: A event can be responded to by using a(n)
- event handler
- the return statement
- an argument
- an event driver
A: event handler