wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Control Structures

Total questions: 21

Worksheet time: 15mins

Name
Class
Date
1.

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

a)

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

b)

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

c)

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

d)

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

2.

Repeat something 10 times

a)

repeat 10

b)

for (var i=0; i<10; i++)

c)

repeat { } until 10;

d)

while (i = 10)

3.

When we are done with a line what do we put at the end?

a)

a colon :

b)

a semi-colon ;

c)

a period .

d)

a quotation mark "

4.

When we surround a word with quotes "David" it's called ?

a)

a program

b)

a loop

c)

a string

d)

a command

5.

What is a variable

a)

Store values in containers so we can use them later.

b)

Store values in containers so we can use them never.

c)

Store values in containers so we can use them once.

d)

Store values in containers so we can't use them later.

6.

A short form writing the word variable is

a)

rav

b)

VAR

c)

var

d)

varia

7.

What is the symbol used for the INCREMENT operator in JS?

a)

+

b)

++

c)

=

d)

==

8.

Conditions return values of which data type?

a)

Integer

b)

boolean

c)

floating-point

d)

string

9.
How many times will the following code print "Welcome to Java"?
int count = 0;
while (count < 10) {
 System.out.println("Welcome to Java");
 count++;
}
a)
8
b)
9
c)
10
d)
0
10.

Loops in programming start counting from ?

a)

0

b)

1

c)

Any number

11.

If there are errors in your code, what could you do?

a)

STAY CALM ... Double check each line first ... ask person next to you ... then ask your teacher

b)

PANIC ... get really worked up and upset

c)

GET ALL STRESSED OUT and say I can't do this

d)

Throw the computer out of the window

12.

This loop can only be used when the programmer knows the number of times a code is to be repeated

a)

while

b)

for

c)

do while

d)

repeat until

13.

What symbol represents the and operator in JavaScript?

a)

AND

b)

and

c)

&

d)

&&

14.

What symbol represents the or operator in JavaScript?

a)

OR

b)

or

c)

||

d)

|

15.
Which of the following is the correct way to declare a variable?
a)
variable myName
b)
var myName
c)
MY_NAME
d)
VAR myName
16.
Which one of the following is NOT a logical operator?
a)
||
b)
&&
c)
$$
d)
!
17.
Arithmetic Operators
What is ++ ?
a)
Modulo
b)
increment
c)
Decrement
d)
Addition
18.
Comparision Operators
What is == ? 
a)
Equal to 
b)
Equal value and equal type
c)
Not equal
d)
Not equal value or not equal type
19.
Comparision Operators
What is === ? 
a)
Equal to
b)
Equal value and equal type
c)
Not equal
d)
Not equal value or not equal type
20.
The conditional statement, in Javascript, begins with the word _______.
a)
Then
b)
Else
c)
If
d)
OK
21.

In a loop that runs from 0 to 9. What goes in the blank space?

var i;

for ( i= 0 ; i < ___ ; i++ ) {

console.log (i);

}

a)

10

b)

9

c)

5

d)

4