JavaScript MCQs with answers Page - 65

Here, you will find a collection of MCQ questions on JavaScript. Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

A

Admin • 833K Points
Coach

Q. Which of the following uses a lot of CPU cycles?

  • (A) GUI
  • (B) Statically generated graphics
  • (C) Dynamically generated graphics
  • (D) All of the mentioned

A

Admin • 833K Points
Coach

Q. Consider the following code snippet :
var scope = "global scope";
function checkscope() {
var scope = "local scope";
function f()
{
return scope;
}
return f;
What is the function of the above code snippet?

  • (A) Returns value null
  • (B) Returns exception
  • (C) Returns the value in scope
  • (D) None of the mentioned

A

Admin • 833K Points
Coach

Q. What is the fundamental rule of lexical scoping?

  • (A) Functions are declared in the scope
  • (B) Functions are executed using scope chain
  • (C) All of the mentioned
  • (D) None of the mentioned

A

Admin • 833K Points
Coach

Q. Consider the following code snippet :
var tensquared = (function(x) {return x*x;}(10));
Will the above code work ?

  • (A) Yes, perfectly
  • (B) Error
  • (C) Exception will be thrown
  • (D) Memory leak

A

Admin • 833K Points
Coach

Q. Consider the following code snippet :
var string2Num=parseInt("123xyz");
The result for the above code snippet would be :

  • (A) 123
  • (B) 123xyz
  • (C) Exception
  • (D) NaN

A

Admin • 833K Points
Coach

Q. If you have a function f and an object o, you can define a method named m of o with

  • (A) o.m=m.f;
  • (B) o.m=f;
  • (C) o=f.m;
  • (D) o=f;

A

Admin • 833K Points
Coach

Q. For the below mentioned code snippet:
var o = new Object();
The equivalent statement is:

  • (A) var o = Object();
  • (B) var o;
  • (C) var o= new Object;
  • (D) Object o=new Object();

A

Admin • 833K Points
Coach

Q. What is the difference between the two lines given below ?
!!(obj1 && obj2);
(obj1 && obj2);

  • (A) Both the lines result in a boolean value “True”
  • (B) Both the lines result in a boolean value “False”
  • (C) Both the lines checks just for the existence of the object alone
  • (D) The first line results in a real boolean value whereas the second line merely checks for the existence of the objects

A

Admin • 833K Points
Coach

Q. Consider the following code snippet :
var c = counter(), d = counter();
c.count()
d.count()
c.reset()
c.count()
d.count()
The state stored in d is :

  • (A) 1
  • (B) 0
  • (C) Null
  • (D) Undefined

A

Admin • 833K Points
Coach

Q. Consider the following code snippet :
var c = counter(), d = counter();
function constfuncs()
{
var funcs = [];
for(var i = 0; i < 10; i++)
funcs[i] = function() { return i; };
return funcs;
}
var funcs = constfuncs();
funcs[5]()
What does the last statement return ?

  • (A) 9
  • (B) 0
  • (C) 10
  • (D) None of the mentioned

Add MCQ in this Category

If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.

Share Your MCQ