Computer

Array And Function MCQs

Practice Array And Function MCQs for competitive exams.

Array And Function MCQs

Practice questions from this topic.

Which of the algorithmic languages is lexical scoping standardized in?

  1. A. Ada
  2. B. Pascal
  3. C. Modula2
  4. D. All of the mentioned
Report Error

What is the purpose of the dynamic scoping?

  1. A. Variables can be declared outside the scope
  2. B. Variables must be declared outside the scope
  3. C. Variables cannot be declared outside the scope
  4. D. None of the mentioned
Report Error

What is the opposite approach to the lexical scoping?

  1. A. Literal scoping
  2. B. Static scoping
  3. C. Dynamic scoping
  4. D. Generic scoping
Report Error

What is the fundamental rule of lexical scoping?

  1. A. Functions are declared in the scope
  2. B. Functions are executed using scope chain
  3. C. All of the mentioned
  4. D. None of the mentioned
Report Error

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?

  1. A. Returns value null
  2. B. Returns exception
  3. C. Returns the value in scope
  4. D. None of the mentioned
Report Error

Which of the following uses a lot of CPU cycles?

  1. A. GUI
  2. B. Statically generated graphics
  3. C. Dynamically generated graphics
  4. D. All of the mentioned
Report Error

Which of the following are examples of closures?

  1. A. Objects
  2. B. Variables
  3. C. Functions
  4. D. All of the mentioned
Report Error

What is a closure?

  1. A. Function objects
  2. B. Scope where function’s variables are resolved
  3. C. Both Function objects and Scope where function’s variables are resolved
  4. D. None of the mentioned
Report Error

What must be done in order to implement Lexical Scoping?

  1. A. Get the object
  2. B. Dereference the current scope chain
  3. C. Reference the current scope chain
  4. D. None of the mentioned
Report Error

What kind of scoping does JavaScript use?

  1. A. Literal
  2. B. Lexical
  3. C. Segmental
  4. D. Sequential
Report Error

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 ?

  1. A. 9
  2. B. 0
  3. C. 10
  4. D. None of the mentioned
Report Error

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 :

  1. A. 1
  2. B. 0
  3. C. Null
  4. D. Undefined
Report Error