Search Header Logo

Javascript basics 6

Authored by Inna .

Professional Development

Professional Development

Javascript basics 6
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

29 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

What will be the result of the following code? console.log(3 + '5');

8
35
53
15

2.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

How can you check if a variable x is of type "string"?

typeof(x) === 'string'
x.type === 'string'
x instanceof String
x.typeOf(String)

3.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

What is the purpose of the === operator in JS?

It performs type coercion.
It assigns a value to a variable.
It checks for equality without type conversion.
It concatenates two strings.

4.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Which of the following is not a valid way to declare a variable in JS?

let x = 5;
const y = 10;
var z = 15;
variable w = 20;

5.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

What will the following code snippet print to the console?const numbers = [1, 2, 3, 4, 5]; numbers.forEach(function(num) { console.log(num * 2); });

1 2 3 4 5
2 4 6 8 10
1 4 9 16 25
2 3 4 5 6

6.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

What is the output of the following code snippet? let a = 10; if (a > 5) { console.log('Hello'); } else { console.log('World'); }

Hello
World
Hello World
No output

7.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

How do you write an if statement that checks if a number x is positive?

if (x >= 0) { }
if (x > 0) { }
if (x < 0) { }
if (x == 0) { }

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Microsoft

Continue with Microsoft

or continue with

Facebook

Facebook

Apple

Apple

Others

Others

Already have an account?