Font size
S
M
L
XL
WorksheetsJavaScript Basics
Total questions: 15
Worksheet time: 8mins
Name
Class
Date
1.
Indicates the beginning and the end of a JavaScript section.
a)
<html> </html>
b)
<style> </style>
c)
<article> </article>
d)
<script> </script>
2.
A JavaScript file has an extension name of
a)
.jscp
b)
.js
c)
.css
d)
.Jp
3.
Which keyword do we need to define a function?
a)
function
b)
method
c)
onclick
d)
functionName()
4.
Which 1 of the following symbols is used for JavaScript comments?
a)
\\
b)
^
c)
?
d)
//
5.
What type of variable is
var typeOfApples="Fuji";
var typeOfApples="Fuji";
a)
Int
b)
Float
c)
Boolean
d)
String
6.
How can a developer show a pop-up message to the user?
a)
alert
b)
prompt
c)
console.log
d)
<p> tag
7.
Which message will the user see?
a)
"Hello user"
b)
No message
c)
"Goodbye user"
d)
"message + user"
8.
What attribute/value do we use to make a button execute JavaScript when clicked?
a)
onclick="doSomething;"
b)
on-click="doSomething;"
c)
onclick="doSomething();"
d)
onclick=doSomething();
9.
How do I declare a new variable?
a)
var newVariable = 5;
b)
Variable int = new Variable();
c)
var 5 = myVariable;
d)
int var = 5;
10.
What is CSS used for?
a)
styling web pages
b)
formatting script correctly
c)
client side scripting
d)
server side scripting
11.
How do we generate a random number?
a)
Math.random()
b)
random.number()
c)
number.random()
d)
Random.math()
12.
Which of the following platform(s) can be used to run Javascript Code
a)
Google Chrome
b)
Firefox
c)
Microsoft Edge
d)
Safari
13.
How do I change the size of an image?
a)
width / height
b)
scale
c)
size
d)
shrink
14.
What is the correct syntax for referring to an external JavaScript script?
a)
<script src="myscript.js"></script>
b)
<script href="myscript.js"></script>
c)
<js href="myscript.js"></js>
d)
<js src="myscript.js"></js>
15.
Which attribute(s) of the FORM and INPUT tags become the properties of the created object?
a)
value
b)
value and name
c)
name
d)
name and type
Reset
