wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

JS test1

Total questions: 40

Worksheet time: 25mins

Name
Class
Date
1.

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)

//

2.

What type of variable is / Quel type de variable est

var typeOfApples="Fuji"

a)

Boolean

b)

Number

c)

String

3.

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"

4.

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

5.

What surrounds an if/else statement?

Qu'est-ce qui entoure une déclaration if / else?

a)

Quotations / Citations " "

b)

Curly Brackets / Accolades { }

c)

Parenthesis / Parenthesis ( )

d)

Square Brackets / Square Brackets [ ]

6.

Which one of the following is the symbol for implementing the OR operator?

Lequel des symboles suivants est utilisé pour implémenter l’opérateur OU?

a)

**

b)

&&

c)

||

d)

!

7.

Which one of the following is the symbol for implementing the AND operator?

Lequel des symboles suivants est utilisé pour implémenter l’opérateur AND?

a)

&&

b)

**

c)

||

d)

++

8.

What character do we use for multiplication?

Quel personnage utilisons-nous pour la multiplication?

a)

#

b)

x

c)

*

d)

/

9.

What surrounds a string or words?

Qu'est-ce qui entoure une chaîne ou des mots?

a)

Quotations / Citations " "

b)

Curly Brackets / Accolades { }

c)

Parenthesis / Parenthèse

d)

Square Brackets / Crochets [ ]

10.

Why do we use if/else statements in JavaScript?

Pourquoi utilisons-nous les instructions if / else en JavaScript?

a)

To repeat something for a fixed number of times

Répéter quelque chose un nombre de fois déterminé

b)

To either do something if a condition is true or do something else

Faire quelque chose si une condition est vraie ou faire autre chose

c)

To break out of some block of code

Pour sortir d'un bloc de code

d)

To repeat something while a condition is true

Répéter quelque chose tant qu'une condition est vraie

11.

What's the data type for the phoneNumber variable?

Quel est le type de données pour la variable de numéro de téléphone?

a)

String

b)

Number

12.

What's the data type for the ageInput variable?

Quel est le type de données de la variable ageInput?

a)

String

b)

Number

13.

What's the value of the ageCalc variable?

Quelle est la valeur de la variable ageCalc?

a)

"19.27"

b)

26.2

c)

"25.7"

d)

19.27

14.

In JavaScript, which of the following operator symbols means not equal to?

En JavaScript, lequel des symboles d’opérateur suivants signifie non égal à?

a)

<>

b)

==

c)

!=

d)

##

15.

His name is Fred and he is less than 16 years old

Which of the following is the best way to write the above statement?


Il s'appelle Fred et il a moins de 16 ans.

Quel est le meilleur moyen d'écrire la déclaration ci-dessus?

a)

if (name = "fred" && age < 16 )

b)

if (name == "fred" && age < 16 )

c)

if (name = "fred" || age < 16 )

d)

if (name == "fred" || age < 16 )

16.

Which of these is a loop? / Lequel de ces est une boucle?

a)

if(x<10)

b)

while(x<10)

c)

var x=10;

d)

text(x,10;10)

17.
What type of variable is
var numApples = 2; 
a)
Int
b)
Float
c)
Boolean
d)
String
18.
What type of variable is
var typeOfApples="Fuji";
a)
Int
b)
Float
c)
Boolean
d)
String
19.
What type of variable is
var age = "5" 
a)
Int
b)
Float
c)
Boolean
d)
String
20.
What surrounds an if/else statement?
a)
Quotations
b)
Curly Brackets
c)
Parenthesis
d)
Square Brackets
21.
Which one of the following is the symbol for implementing the OR operator?
a)
**
b)
&&
c)
||
d)
!
22.
Which one of the following is the symbol for implementing the AND operator?
a)
&&
b)
**
c)
||
d)
++
23.
What best describes a variable?
a)
they allow the user to change language settings
b)
they allow the user to change the variable's data type
c)
they allow the user to save and call values
d)
they allow the user to declare a new data type
24.
Which of the following will correctly comment the text?
a)
// "the text"
b)
/"the text"/
c)
*/"the text"/*
d)
\\"the text
25.
A string;
a)
Expresses a true false statement
b)
can contain letters, numbers, spaces, and symbols.
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
26.
The conditional statement, in Javascript, begins with the word _______.
a)
Then
b)
Else
c)
If
d)
OK
27.
Indicates the beginning  and the end of a JavaScript section.
a)
<html> </html>
b)
<style> </style>
c)
<article> </article>
d)
<script> </script>
28.
A user-defined name for a memory location whose value can change over time.
a)
variable
b)
syntax
c)
operator
d)
token
29.
Which of the following formatting tags are HTML and DO NOT need to be inside of the <script> </script> tags?
a)
<div>
b)
<h1>
c)
<h3>
d)
all
30.
In JavaScript, you should include a semi-colon at the end of each statement.
a)
yes
b)
no
31.
JavaScript code is embedded in HTML documents between <script> and </script> tags.
a)
True
b)
False
32.
Programming and scripting languages are translated into this machine-readable form.
a)
Syntax
b)
Binary Code
c)
Compiler
d)
Operator
33.
What type of quotation marks does JavaScript require?
a)
Single quotes (aka apostrophes)
b)
Double quotes
c)
Either single quotes or double quotes
d)
Neither single quotes or double quotes
34.
What character do we use for multiplication?
a)
#
b)
x
c)
*
d)
/
35.
What character do we use for division?
a)
#
b)
x
c)
*
d)
/
36.
How do we count the number of characters in a string?
a)
.length
b)
.numberOfCharacters
c)
.textLength()
d)
String.characters()
37.
How do we declare a variable that can change?
a)
constant
b)
const
c)
letter
d)
let
38.
What punctuation do we use if we need to check 2 conditions in a single if/else statement and either of them needs to be true?
a)
||
b)
*
c)
&
d)
&&
39.
What punctuation do we use if we need to check 2 conditions in a single if/else statement and both of them need to be true?
a)
||
b)
*
c)
&
d)
&&
40.
A JavaScript file has an extension name of
a)
.jscp
b)
.js
c)
.css
d)
.Jp