WorksheetsWeb 102 Assessment
Total questions: 20
Worksheet time: 11mins
How can a developer show a pop-up message to the user?
alert
<input> tag
console.log
<p> tag
Which of the following will successfully display a message to the user?
Alert(Hello, user);
alert("Hello, " user);
Alert("Hello, user");
alert("Hello, user");
Which of the following will successfully display a message to the user?
alert("hello, " + "user");
Alert("hello, " + user);
alert("hello", + "user");
alert("Hello, " + user";
What's the data type for the phoneNumber variable?
String
Number
In a <script> tag, which attribute do we need to use to link to an external JS file?
src
herf
script
filename
What attribute/value do we use to make a button execute JavaScript when clicked?
onclick="doSomething"
on-click="doSomething"
onclick="doSomething()"
onclick=do Something()
How do you make a button in HTML?
<button>Text</button>
<button text="Text"></button>
<button>Text<button>
<button Text>
What is the syntax to declare a function called doSomething?
function doSomething() { }
doSomething() function { }
function () doSomething { }
doSomething { } function ()
True or False?
True
False
What's the Data Type?
"this is data"
String
Number
Boolean
Object
What's the Data Type?
document.querySelector("p");
String
Number
Boolean
Object
What's the first thing we need when defining a function?
function
function name
parentheses
call the function
What do we need in order to call a function?
Curly brackets
Function name and parentheses
alert
onclick
Does defining a function run any of the JavaScript code in its body?
Yes
No
Which function do we use to create a new HTML element in JavaScript?
document.querySelector
document.getElementById
document.appendChild
document.createElement
In JavaScript, how would you select an HTML input element with an ID of text?
document.
selectElement("text")
document.
querySelector("#input")
document.
querySelector("#text")
document.
getElement("text")
Which message will the user see?
"7 > 7"
"alert"
"x > 7"
no message
Which message will the user see?
"Math is not broken"
"Math is broken"
Which message will the user see?
The value is Banana
The value is count
The value is 0
The value is 5
