Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

[AP CSP] JavaScript Basics

Total questions: 14

Worksheet time: 28mins

Name
Class
Date
1.
To display writing on the screen you must include this direction;
a)
Document Write
b)
documentWrite
c)
document.write( )
d)
document.write
2.
A variable;
a)
Expresses a true false statement
b)
stores a string, number, or boolean, and gives it a specific, case-sensitive name
c)
takes in an input, does something with it, and then returns an output.
d)
Runs a boolean (true/false) statement based on data entered
3.

Which one of the following symbols is used for JavaScript comments? / Lequel des symboles suivants est utilisé pour les commentaires JavaScript?

a)

\\

b)

^

c)

?

d)

//

4.

Which message will the user see? / Quel message l'utilisateur verra-t-il?

a)

"Hello user"

b)

No message

c)

"Goodbye user"

d)

"message + user"

5.

How do I declare a new variable? / Comment déclarer une nouvelle variable?

a)

var newVariable = 5

b)

Variable int = new Variable()

c)

var 5 = myVariable

d)

int var = 5

6.
A JavaScript file has an extension name of
a)
.jscp
b)
.js
c)
.css
d)
.Jp
7.

How can a developer show a pop-up message to the user?

a)

alert

b)

prompt

c)

console.log

d)

<p> tag

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.

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>

10.

Indicates the beginning and the end of a JavaScript section.

a)

<html> </html>

b)

<style> </style>

c)

<javascript> </javascript>

d)

<script> </script>

11.

Where do the <script></script> tags go in your document

a)

Within <img> tags

b)

In the <p></p> tags

c)

In the <title>

d)

In the <head> or <body>

12.

You can change an image's size using Javascript?

a)

True

b)

False

13.

Javascript can:

a)

Interact with HTML

b)

Check or validate user input

c)

Can make your web pages dynamic

d)

All of the above

14.

JavaScript is used to enhance what kind of document?

a)

JS

b)

HTML

c)

Brackets