Q. What will be the output of the following code snippet?

Code:
var a = true + true + true * 3;
print(a)
  • (A) 3
  • (B) 0
  • (C) Error
  • (D) 5
πŸ’¬ Discuss
βœ… Correct Answer: (D) 5

Q. Which of the following statement is not true regarding JavaScript

  • (A) Javascript is a loosely typed language
  • (B) Javascript is an object based language
  • (C) Javascript is event driven
  • (D) Javascript embedded in an HTML document is compiled and executed by the client browser
πŸ’¬ Discuss
βœ… Correct Answer: (D) Javascript embedded in an HTML document is compiled and executed by the client browser

Q. In Java Script, if you add a leading zero like "0127" the number system followed is

  • (A) Decimal
  • (B) Octal
  • (C) Binary
  • (D) Hexadecimal
πŸ’¬ Discuss
βœ… Correct Answer: (B) Octal

Q. In Java Script, ____ is an object of the target language data type that encloses an object of the source language

  • (A) a wrapper
  • (B) a link
  • (C) a cursor
  • (D) a form
πŸ’¬ Discuss
βœ… Correct Answer: (A) a wrapper

Q. In JavaScript which of the following is used to declare variable

  • (A) var
  • (B) dim
  • (C) function
  • (D) const
πŸ’¬ Discuss
βœ… Correct Answer: (A) var
Explanation:

The correct answer is both (A) var and (D) const.

But since only one option is usually expected, (A) var is the traditional and direct answer.

Explanation:

  • var is the original way to declare variables in JavaScript.
  • const (and let) were introduced later (in ES6) for better control.
  • dim is from VBScript, not JavaScript.
  • function is used to declare a function, not a variable.

Q. In Javascript each window object has sub-object, which called

  • (A) Features
  • (B) Properties
  • (C) Characteristics
  • (D) Qualifiers
πŸ’¬ Discuss
βœ… Correct Answer: (B) Properties

Q. Which one is standard way to show popup in Java Script?

  • (A) alert("mcqbuddy")
  • (B) window("mcqbuddy");
  • (C) alert("mcqbuddy");
  • (D) window.alert("mcqbuddy");
πŸ’¬ Discuss
βœ… Correct Answer: (D) window.alert("mcqbuddy");

Q. What is the output of following Javascript?

Code:
var a = 'mcq';
var b = 'buddy';
var c = a/b;
document.write(c);
  • (A) mcqbuddy
  • (B) mcq/buddy
  • (C) NaN
  • (D) None of the above
πŸ’¬ Discuss
βœ… Correct Answer: (C) NaN

Q. Find output of below code

Code:
var a = '10';
var b = a = 20;
document.write(a+b);
  • (A) 40
  • (B) 1020
  • (C) '10'20
  • (D) Error in Script
πŸ’¬ Discuss
βœ… Correct Answer: (A) 40

Q. What is divide by 0 in Javascript?

Code:
var a = 10;
var b = 0;
document.write(a/b);
  • (A) 0 is printed
  • (B) Infinity is printed
  • (C) Some Garbage Value
  • (D) Nothing is printed
πŸ’¬ Discuss
βœ… Correct Answer: (B) Infinity is printed