Operators and Expressions JavaScript

Last Updated :
Discuss
Comments

Question 1

What is the value of x after the following code is executed?
let x = 5;
x = x++ + 5;

  • A

    11

  • B

    10

  • C

    15

  • D

    6

Question 2

What is the result of true + true in JavaScript?

  • A

    2

  • B

    true

  • C

    false

  • D

    "truetrue"

Question 3

What will be the value of a after the following code?
let a = 10;
a -= 3;
a -= -2;
console.log(a);

  • 5

  • 9

  • 7

  • 10

Question 4

What will be the value of n after the following code?
let n = '';
n ??= 'Hello';
console.log(n);

  • A

    undefined

  • B

    'Hello'

  • C

    null

  • D

    ""

Question 5

What is the result of "2" > "12" in JavaScript?

  • A

    true

  • B

    false

  • C

    Error

  • D

    undefined

Question 6

What is the result of NaN == NaN in JavaScript?

  • A

    true

  • B

    undefined

  • C

    Error

  • D

    false

Question 7

What is the result of 10 > "5" in JavaScript?

  • A

    true

  • B

    Error

  • C

    false

  • D

    undefined

Question 8

What is the value of str.length for the following string?
let str = "Hello, World!";

  • A

    12

  • B

    14

  • C

    13

  • D

    15

Question 9

What is the output of the following code?
let str = "JavaScript";
str[0] = "T";
console.log(str);

  • A

    TavaScript

  • B

    None of the above

  • C

    Error

  • D

    JavaScript

Question 10

Which of the following is a valid string interpolation syntax?

  • A

    'My age is ${age}'

  • B

    "My age is " + age"

  • C

    `My age is ${age}`

  • D

    Both B and C

There are 10 questions to complete.

Take a part in the ongoing discussion