JavaScript MCQs II

by Techarge
0 comment

Wonderful JavaScript MCQs Series for Beginner .Practice these MCQs to enhance and test the knowledge of JavaScript. This JavaScript Quiz is based on Operators.

1. Which of the following statement is true about BitWise OR?

  1. It performs a Boolean AND operation on each bit of its integer arguments
  2. It is a unary operator and operates by reversing all the bits in the operand.
  3. Both A and B
  4. It performs a Boolean OR operation on each bit of its integer arguments.

4) It performs a Boolean OR operation on each bit of its integer arguments.


2.Which one of the following options are not valid in JavaScript?

  1. “My name is “Harry” “
  2. “My name is Harry”
  3. My name is Harry’
  4. “My name is ‘Harry’ “

1)”My name is “Harry” “


3.Code A: var x = 10; y = –x + 1;
alert(y);
Code B: var x = 10;
y = x– + 1;
alert(y);
What is the output for code A and B?

  1. 10,11
  2. 11,11
  3. 11,10
  4. 10,10

1)10,11


4. Which operator is known as the equality operator, which checks whether its two operators are “equal”?

  1. =
  2. ==
  3. ===
  4. &&

2)==


5.isNan function returns ______ if the argument is not a number; otherwise it is ______.

  1. True, True
  2. False, False
  3. True, False
  4. False, True

3)True, False


6. Which operator is known as the strict equality operator, which checks whether its two operators are identical or not?

  1. =
  2. ==
  3. ===
  4. &&

3)===


7.What is the value of C here?

var a = 100; var b = “10”; var c = a + b;

  1. 10010
  2. 10100
  3. 110
  4. None

1)10010


8. Which operator will return false if two value are equal?

  1. !
  2. !=
  3. !==
  4. All of the above

View Answer

2)!=


9.Which operator checks if the value of the left operand is greater than the value of the right operand?

  1. Equal
  2. Greater than
  3. Less than
  4. Greater than or Equal to

2)Greater than


10.Multiple variables can be created and initialized in a single JavaScript statement.

  1. True
  2. False

1)True


11.Which statement will return the value false?

  1. var result = 30 >= 30;
  2. var result = (20 === “20”) && (50 < 30);
  3. var result = 20 < 50;

2)var result = (20 === “20”) && (50


12. Logical AND : If both the operands are non-zero, then the condition becomes true.

  1. Yes
  2. No
  3. Can be yes or no
  4. Can not say

1)Yes


13. A __________ will be visible only within a function where it is defined.

  1. global variables
  2. local variable
  3. Both A and B
  4. None of the above

2)local variable


14. What will be the output if we compare “ten” and 10 with less then comparison operator(“ten”<10)?

  1. True
  2. False
  3. undefined
  4. error

2)False


15.  If an operator is NaN or converts to NaN, what wil comparison operator always returns ?

  1. True
  2. False
  3. Undefined
  4. NAN

2)False


You may also like