Font size
WorksheetsJAVASCRIPT PART 1
Total questions: 60
Worksheet time: 34mins
This saves a value, which can be then assigned when writing code
Parameter
Function
Variable
Which of these is a loop?
if(x<10)
while(x<10)
var x=10;
text(x,10;10)
Which command provides a random color?
Randomizer.color
Randomizer.nextColor()
RandColor;
nextColor.Randomizer()
Which of these will increase the value of the variable X?
increment (x)
x++;
x=x;
x+1;
Which of the following will decrease the value of x?
x--;
x-1;
x=x;
x=-x;
Greater than or equal to
> or =
> || =
>=
<=
His name is Fred and he is less than 16 years old
if (name = "fred" && age < 16 )
if (name === "fred" && age < 16 )
if (name = "fred" || age < 16 )
if (name === "fred" || age < 16 )
Repeat something 10 times
repeat 10
for (var i=0; i<10; i++)
repeat { } until 10;
while (i = 10)
When we are done with a line what do we put at the end?
a colon :
a semi-colon ;
a period .
a quotation mark "
When we surround a word with quotes "David" it's called ?
a program
a loop
a string
a command
A short form writing the word variable is
rav
VAR
var
varia
var typeOfApples="Fuji";
How can a developer show a pop-up message to the user?
alert
prompt
console.log
<p> tag
What attribute/value do we use to make a button execute JavaScript when clicked?
onclick="doSomething;"
on-click="doSomething;"
onclick="doSomething();"
onclick=doSomething();
Which of the following platform(s) can be used to run Javascript Code
Google Chrome
Firefox
Microsoft Edge
Safari
What is the value of:
”41” + 1
42
“42”
411
“411”
JavaScript functions can access variables defined in the same scope?
True
False
Variables defined inside of functions are accessible outside of the function?
True
False
In JavaScript strings must be defined using only double quotes (“).
True
False
Determine what x would be when assignment operators are used given that ×=6 y=12 z=18
x−=3
x%=4
4 and 5
3 and 2
3 and 7
1 and 2
Perform the operation on operands of different data types given that:
a = 4 , b = happy , c= people, d = 9 , e = memories
Solve : a - d
13
5
8
9
Perform the operation on operands of different data types given that a = 4 , b = happy , c= people, d = 9 , e = memories
Solve: b + c
happy people
people happy
happy memories
happy plus
Determine what result each expression yields if it is True or False. Given that x= 8 and y= 16.
(x!== 9 && y===16 ) || ( x>10 || y!=16)
False
True
Determine what result each expression yields if it is True or False. Given that x= 8 and y= 16.
( x === 8 || y > 5) && ( x! == 7 && y > "11")
True
False
Determine what result each expression yields if it is True or False. Given that x= 8 and y= 16.
( x > "4" || y<=10) || x === 8|| y>15)
True
False
Determine what result each expression yields if it is True or False. Given that x= 8 and y= 16.
( x > 3 && y ! == 7)&&( x>= 6 && y == 16)
True
False
Determine what result each expression yields if it is True or False. Given that x= 8 and y= 16.
!(x=8)
True
False
Determine what result each expression yields if it is True or False. Given that x= 7 and y= 9.
( x >2 && y ! == 9)&&( x>= 6 && y ==9)
True
False
Determine what result each expression yields if it is True or False. Given that x= 5 and y= 3.
( x==2 || y == 3 )||( x<6 && y<9)
True
False
What type of variable is quantites?
var quantities = [2, 4, 10, 1]
string
Boolean
array
number
What type of variable is apple?
var apple = " Fuji "
string
Boolean
array
number
What is first index value of an array?
2
-1
0
1
What will this code display?
8, 2, 1, 4, 7
82147
Myarray.length
5
What will this code display?
Hello Emma
Hello user
Hello+user
nothing
What will this code display?
570
569
568
attendees
Which of these is a method?
getElementById( )
style
document
color
Which line is missing to return the result of the multiplication 10 x 5 ?
result
number 1 * number 2 ;
let result = 10 x 5 ;
var result = number 1 * number 2 ;
Which of these methods removes the last element of an array?
pop( )
splice( );
push( )
split( )
What would this piece of code display?
text
John, Joe, Greg, Ruth
John
Joe
Greg
Ruth
4
What would this piece of code display?
10
20
30
40
1
2
3
4
10
20
30
40
50
11
22
33
44
