Commerce

Classes And Modules MCQs

Practice Classes And Modules MCQs for competitive exams.

Classes And Modules MCQs

Practice questions from this topic.

Which looping statement allows XML tags to appear in JavaScript programs and adds API for operating on XML data?

  1. A. for loop
  2. B. while loop
  3. C. for/each loop
  4. D. all of the mentioned
Report Error

Consider the following code snippet [ x,y ]=[ y,x ] ; What is the result of the above code snippet?

  1. A. Throws exception
  2. B. Swap the value of the two variables
  3. C. Flashes an error
  4. D. Creates a new reference object
Report Error

Consider the following code snippet let x = x + 1 ; console . log ( x ) ; What will be the result for the above code snippet?

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

Consider the following code snippet console . log ( p ) If p is not defined, what would be the result or type of error?

  1. A. Zero
  2. B. Null
  3. C. ReferenceError
  4. D. ValueNotFoundError
Report Error

Consider the following code snippet function oddsums ( n ) { let total = 0 , result = [] ; for( let x = 1 ; x <= n; x ++ ) { let odd = 2 * x - 1 ; total += odd; result . push ( total ) ; } return result; } What would be the output if oddsums ( 5 ) ; is executed afted the above code snippet ?

  1. A. Returns [1,4,9,16,25]
  2. B. Returns [1,2,3,4,5]
  3. C. Returns [3,6,9,12,15]
  4. D. Returns [1,3,5,7,9]
Report Error

The main difference between the variables declared with var and with let is

  1. A. var is confined to a particular function but let is not
  2. B. let is confined to a particular function but var is not
  3. C. var defines values based on conditions but let does not
  4. D. none of the mentioned
Report Error

The let keyword can be used

  1. A. in a for or for/in loop, as a substitute for var
  2. B. as a block statement, to define new variables
  3. C. to define variables that are scoped to a single expression
  4. D. all of the mentioned
Report Error

Consider the following code snippet const pi = 3.14 ; var pi = 4 ; console . log ( pi ) ; What will be the output for the above code snippet?

  1. A. This will flash an error
  2. B. Prints 4
  3. C. Prints 3.14
  4. D. Ambiguity
Report Error

Which is the subset that transforms web content into secure modules that can be safely hosted on a web page?

  1. A. Microsoft Web Sandbox
  2. B. ADsafe
  3. C. Caja
  4. D. dojox.secure
Report Error

Which was one of the first security subsets proposed?

  1. A. FBJS
  2. B. Caja
  3. C. dojox.secure
  4. D. ADSafe
Report Error

Which is the object that defines methods that allow complete control over page content?

  1. A. The client-side document object
  2. B. The server-side document object
  3. C. Both client-side and server-side document object
  4. D. None of the mentioned
Report Error

Which are the two functions that are not allowed in any secure subset?

  1. A. evaluate() and restrict()
  2. B. eval() and the Function() constructor
  3. C. debugger() and test()
  4. D. eval() and debugger()
Report Error