JavaScript Questions & Answers – Modules in JavaScript | JavaScript MCQs

Sports GK Questions and Answers 2024 (Latest Updated)

Awards & Honours GK Questions 2024 (Latest Updated)

Questions
1 The functions provide() and require() of Dojo toolkit and Google’s Closure library are used for ___________
A declaring and loading modules
B declaring functions
C declaring modules
D loading modules

Answer: declaring and loading modules
2 The maximum number of global symbols a module can define is ____________
A 2
B 3
C 1
D 4

Answer: 1
Advertisement
Article and Schedule Quiz Start Test!
DOWNLOAD CURRENT AFFAIRS PDF FROM APP
3 To define each of the set classes as a property of the sets object (namespace) for the module, the statement is
A sets = sets.AbstractEnumerableSet.extend();
B sets.SingletonSet = sets.AbstractEnumerableSet.extend(…);
C sets.SingletonSet = sets.extend(…);
D sets = sets.extend(…);

Answer: sets.SingletonSet = sets.AbstractEnumerableSet.extend(…);
4 What will be the efficiency quotient of the following JavaScript statements?
var Set = sets.Set;
var s = new Set(1,2,3);
A The programmer imports at once the frequently used values into the global namespace
B There is no efficiency quotient, the programmer tries to make it inefficient
C The programmer needs to import the Sets everytime he wants to use it
D the programmer imports the set everytime the statement is encountered

Answer: The programmer imports at once the frequently used values into the global namespace
5 The scope of a function is also called as ________
A Predefined function
B Module function
C Public function
D Private function

Answer: Module function
6 Modules that have more than one item in their API can ________
A Assign itself to a global variable
B Invoke another module of the same kind
C Return a namespace object
D Invoke another module of the same kind

Answer: Return a namespace object
7 The provides() function and the exportsobject are used to _________
A Register the module’s API and Store their API
B Call the modules api
C Store the module’s API
D Register the modules api

Answer: Register the module’s API and Store their API
8 What could be achieved by running the JavaScript code snippet below?
var sets = com.davidflanagan.collections.sets;
A Importing a single module
B Importing a module partially
C Importing a namespace
D Importing the entire module

Answer: Importing the entire module
9 The properties() method is a ________
A Enumerable method
B Non-enumerable method
C Operational method
D calling method

Answer: Non-enumerable method
10 What can be done in order to avoid the creation of global variables in JavaScript?
A To use a method that defines all the variables
B To use an object that has the reference to all the variables
C To use an object as its namespace
D To use global functions

Answer: To use an object as its namespace
11 What will be the output of the following JavaScript code? Modules in JavaScript
A 0.0123
B 12300
C Error
D Undefined

Answer: 12300
12 What will be the output of the following JavaScript code?

Modules in JavaScript

A 3
B true
C false
D error

Answer: true
13 What will be the output of the following JavaScript code?

Modules in JavaScript

A 3
B true
C false
D error

Answer: false
14 What will be the output of the following JavaScript code?

Modules in JavaScript

A True
B False
C Error
D Undefined

Answer: False
15 What will be the output of the following JavaScript code?

Modules in JavaScript

A true
B false
C error
D undefined

Answer: false

Random GK Questions

Assam Direct Recruitment Test Series

Teacher Eligibility Test

Assam Direct Recruitment Test Series