Font size
WorksheetsTrial Test
Total questions: 31
Worksheet time: 18mins
Select the correct program to output "Hello" to the console.
console.log("Hello");
consolelog("Hello")
log.console("Hello");
console.logHello;
Output "Hello" to the console.
(a)
Change "Leave this text." to a comment.
*Execute the program and it will output "Make the first line a comment.
Leave this text.
console.log("Make the first line a comment.");
//Leave this text.
console.log("Make the first line a comment.");
Leave this text.
//console.log("Make the first line a comment.");
//Leave this text.
log.console("Make the first line a comment.");
Select the correct program that will let the computer calculate "5+7" and output the calculation results to the console.
console.log("5 + 7");
console.log(5" + "7);
console.log("5" + "7");
console.log(5 + 7);
Select the correct symbol for multiplication used in the program.
-
/
*
+
Let the computer calculate "3*5" and output "The answer is 15." to the console.
(a)
Select the correct declaration for the variable number.
number let;
number;
let = number;
let number;
Create your program as follows
(1) Declare the variable num.
(2) Assign 5 to num
(3) Output the value of num to the console
(a)
Create your program as follows
(1) Declare the variable num and assign 7.
(2) If variable num is equal to 7, output "Correct".
let num = 7;
if (num == 7){console.log("Correct");}
let num == 7;
if (num = 7){console.log("Correct");}
num let = 7;
if (num == 7){console.log("Correct");}
let num = 7;
if (num == 7){("Correct")console.log;}
select the output result of the following program.
let num = 10;
console.log(num == 10);
10
false
true
100
If the value of the variable score is greater than or equal to 60, "Pass", otherwise "Fail"
*Enter only the conditional expression.
let score = 70;
if(..................................){console.log("Pass");}
else{console.log("Fail");}
score >= 60
score == 60
60 >= score
score <= 60
Select a program with the conditional expression "the value of the variable num is less than 20".
num >= 20
num <= 20
num == 20
num < 20
Create your program as follows.
(1) Declare the variable num and assign 100 to it.
(2) If variable num is equal to 100, output "correct".
(3) If not, "miss" is output.
let num = 100;
if (num == 100){console.log("correct");}
else {console.log("miss");}
let num;
if (num == 100){console.log("correct");}
else {console.log("miss");}
let num = 100;
if (num = 100){console.log("correct");}
else {console.log("miss");}
let num = 100;
if {console.log("correct");}
(num == 100) else {console.log("miss");}
select the output result of the following program.
let score = 92; if (score == 100){console.log("Perfect score");} else if (score >= 80){console.log("So close");} else if (score >= 60){console.log("Pass");}
So close
Perfect score
Pass
No output
Create a program as follows.
(1) If variable num is less than or equal to 3, output "A".
(2) If not, and if num is greater than or equal to 6, output "B".
(3) If not, output "C".
let num = 4;
if (.............................){console.log("A");}
else if (..................................){console.log("B");}
{console.log("C");}
let num = 4;
if (num <= 3){console.log("A");}
else if (num >= 6){console.log("B");}
else{console.log("C");}
let num = 4;
if (num >= 6 ){console.log("A");}
else if (num <= 3){console.log("B");}
else{console.log("C");}
let num = 4;
if (num <= 3){console.log("A");}
else if (num >= 6){console.log("C");}
else{console.log("B");}
let num = 4;
if (num <= 6){console.log("A");}
else if (num >= 3){console.log("B");}
else{console.log("C");}
Select the program that means "A or B"
A < B
A == B
A || B
A && B
select the output result of running the program less than or equal to
let num = 9; if (num <= 3 || num >= 7) {console.log("A");} else{console.log("B");}
9
No output
B
A
Select the correct program to add 1 to variable i.
i+
i++1
i++
1+1
Select the correct answer for the program that repeats the specified processing 10 times.
for (let i=0; i++; i<10) {
Specified process
}
for (let i=0; i<10; i++) {
Specified process
}
for { Specified process } (
let i=0; i<10; i++
)
for (i<10; let i=0; i++) {
Specified process
}
select the output result of running the program less than or equal to
for (let i = 0; i < 2; i++) { console.log("Hello"); };
Hello
Hello
Hello
No output
Hello
Hello
Hello
Create your program less than or equal to
(1) Output "Good morning" 10 times to the console.
*Variable name is i and assign 0 at the beginning.
Use the increment operator.
for (let i=0 ; i < 10 ; i++) {
console.log("Good morning");
}
for console.log("Good morning") (let i=0 ; i < 10 ; i++) {
;
}
for (let i++ ;i=0 ; i < 10 ) {
console.log("Good morning");
}
for (let i=0 ; i < 10 ; i+) {
console.log("Good morning");
}
Complete your program less than or equal to
(1) If variable a is greater than or equal to 2 and b is greater than or equal to 3, output "Condition met.
*Only the conditional expression should be entered.
let a = 4;
let b = 3;
if (.......................................) {
console.log("Condition met");
}
(a >= 2 && b >=3)
(a >= 2 || b >=3)
(a >= 2 == b >=3)
(a <= 2 && b <=3)
Complete your program less than or equal to
(1) Output "Hello" three times to the console.
*Variable name is i and assign 0 at the beginning.
Use the increment operator.
.................... (.................................) {
console.log("Hello");
}
If (let i=0 ; i < 3 ; i++) {
console.log("Hello");
}
for (i=0 ; i < 3 ; i) {
console.log("Hello");
}
for (let i=0 ; i < 3 ; i++) {
console.log("Hello");
}
for (let i=0 ; i < 2 ; i++) {
console.log("Hello");
}
Select the correct function to round off.
round(1.8)
Math.roundoff(1.8)
Math.round(1.8)
round.Math(1.8)
Select the output result of running the following program.
console.log(Math.max(10,50,100));
160
100
10
50
Select the correct program to output random numerical values.
console.log(Math.max());
console.log(Math.min());
console.log(random());
console.log(Math.random());
Select the output results of the following program.
console.log(Math.floor(12.8));
No output
11
12
13
Select a program that returns a random integer as follows.
(1) Use the function Math.random to return a random numerical value.
(2) Multiply the randomly returned numerical value by 10.
(3) Use the function Math.floor to return an integer.
*The program is one line.
console.log(Math.random (Math.floor(() * 10));
(Math.floor(Math.random() * 10));
console.log(Math.floor(Math.random() * 10));
console.log(Math.floor(Math.random() );
Select the correct program to create a function whose function name is sum and argument name is num.
(num)function sum{
processing
}
function (num) sum {
processing
}
function sum(num) {
processing
}
(num)sum function {
processing
}
Add a program that returns the value of the variable result to the described program.
function calc(num) {
let result = num * 7;
......................................
}
console.log(calc(10));
function result
calc(10)
result return ;
return result;
Add a program that calls the function calc.
Enter 7 as an argument.
function calc(num) {
let result = num * 5;
return result;
}
console.log( (a) );
