NEW
Font size
Worksheetsjavascript Quiz 1
Total questions: 10
Worksheet time: 5mins
Which of the following will decrease the value of x?
x--;
x-1;
x=x;
x=-x;
What is printed to the screen if the user enters ‘5’ when the following program is run?
var userNum = readInt("Enter your favorite number: ");
var calculatedNum = (userNum * userNum) + userNum;
println(calculatedNum);
5
30
25
50
How many choices are possible when using a single if-else statement?
1
2
3
4
Why do programmers use variables?
Because they are lazy and don’t want to write out equations every time
It allows the programmer to reuse multiple lines of code
They are a way to document functions
To store values to easily reuse later and make code easier to read and understand
What type of variable is apple?
var apple = " Fuji "
string
Boolean
array
number
What kind of statement is an If statement?
comparison statement
anecdotal statement
conditional statement
looping statement
Which of these will increase the value of the variable X?
increment (x)
x++;
x=x;
x+1;
Inside which HTML element do we put the JavaScript?
<script>
<javaScript>
<js>
<scripting>
The output of this code
10
5
Null
undefined
