Font size
WorksheetsJavaScript Level 1
Total questions: 20
Worksheet time: 33mins
How do I generate a random number from 0 to less than 1?
How do I add comments in my codes?
Use double forward slash, like this:
// say something
Use /* and */ to enclose some lines of text as comments
Use #, hash symbol, like this:
# say something
Use <!-- and --> to enclose some lines of text as comments
Which of the following will ask for input when you run the program?
What will be printed in the console?
Error. This code cannot run.
29 February
11 February
2+9+February
Which of the following is/are valid JavaScript variable name(s)?
num1
1num
my_name
my name
I want to use a String variable to store some text value in my program. Which one is correct?
let some text = can i ask a question?;
def some_text = "can i ask a question?";
let some_text = "can i ask a question?";
def some_text = can i ask a question?;
I want to use a number variable to store some numerical value in my program. Which one is correct?
let 1num = 100;
def 1num = "100";
let num1 = 100;
let num1 = "100";
Which function should I use to convert String value to number?
int()
parseInt()
ParseInt()
parseint()
What is printed in the console when you run this program?
Error. This code has syntax error.
you can proceed to book for a vaccination slot now.
please wait for further notification.
Nothing is printed in the console.
Which function do I use for a pop-up window to show some text messages?
alert()
print()
prompt()
console.log()
What is printed in the console when you run this program?
Error. This code has syntax error.
you can proceed to book for a vaccination slot now.
please wait for further notification.
Nothing is printed in the console.
When prompted, the input value is entered as 19.
What is the output printed in the console?
Error. The code has syntax error.
39
1920
2019
Which Math operator should I use when I want to check if a number is odd or even?
%
+
*
/
Which Math operator should I use when I want to check if a number is a multiple of 5?
%
+
*
/
Look at the codes. Which of the following is/are correct?
Numbers 0 to 8 are printed.
Numbers 1 to 8 are printed.
Error. This code has syntax error.
This showed an example of a "for loop".
Refer to this code, and what is printed in the console?
Numbers from 0 to 99
Numbers from 1 to 100
Numbers from 0 to 100
Numbers from 1 to 99
Read the codes. Then what is the name of the loop used in this program?
For Loop
While Loop
Do-while Loop
Forever Loop
Read the codes. Line 6: What is the purpose of using a "break" statement?
To break the codes into multiple lines.
To terminate the loop.
This is an example of "forever" loop.
To take a break from doing homework.
Read the codes. What is printed in the Console? There maybe more than 1 correct answer.
I got here
Numbers 99 to 91 are printed in the Console.
Numbers 100 to 91 are printed in the Console.
Nothing is printed.
Read the codes. What will be displayed in the pop-up window?
what? and why?
you are 5 years old
you are older than 5 years old
Nothing is shown
