JavaScript Questions & Answers – JavaScript Subsets | JavaScript MCQs

(1) The Crockford’s subset does not include which function in JavaScript?
[A] eval()
[B] coeval()
[C] equal()
[D] equivalent()
Answer: eval()
(2) What does javascript use instead of == and !=?
[A] It uses bitwise checking
[B] It uses === and !== instead
[C] It uses equals() and notequals() instead
[D] It uses equalto()
Answer: It uses === and !== instead

DOWNLOAD CURRENT AFFAIRS PDF FROM APP

Article and Schedule Quiz Start Test!
(3) What is being imposed on each subset to ensure that it conforms to the subset?
[A] A parser to parse the code
[B] A parser that parses and adds to the subset
[C] A static verifier that parses code
[D] A predefined function to parse the code
Answer: A static verifier that parses code
(4) Why was “The Good Parts” designed as a language subset in JavaScript?
[A] To improve programmer flexibility
[B] To balance the workload of the programmer
[C] To create an in-built compiler and interpreter
[D] To improve programmer productivity
Answer: To improve programmer productivity
(5) Which is the subset that is a secure container designed for the purpose of safely running untrusted JavaScript?
[A] Sandbox
[B] The Good Parts
[C] Both Sandbox and Good Parts
[D] Web browser
Answer: Sandbox
(6) Why is this keyword not preferred in JavaScript?
[A] Highly memory consuming
[B] Functions should access the global objects
[C] Functions should not access the global objects
[D] Very inefficient to use
Answer: Functions should not access the global objects
(7) Which are the two functions that are not allowed in any secure subset?
[A] evaluate() and restrict()
[B] eval() and the Function() constructor
[C] debugger() and test()
[D] eval() and debugger()
Answer: debugger() and test()
(8) Which is the object that defines methods that allow complete control over page content?
[A] The client-side document object
[B] The server-side document object
[C] Both client-side and server-side document object
[D] Web document object
Answer: The client-side document object
(9) Which was one of the first security subsets proposed?
[A] FBJS
[B] Caja
[C] dojox.secure
[D] ADSafe
Answer: ADSafe
(10) Which is the subset that transforms web content into secure modules that can be safely hosted on a web page?
[A] Microsoft Web Sandbox
[B] ADsafe
[C] Caja
[D] dojox.secure
Answer: dojox.secure
(11) What will be the output of the following JavaScript code?
var set = new Set();  
set.add("one");  
set.add("two");    
for (let elements of set) 
{  
    document.writeln(elements+" ");  
}
[A] one
[B] two
[C] one two
[D] undefined
Answer: one two
(12) What will be the output of the following JavaScript code?
set.add("AngularJS");  
set.add("Bootstrap");    
set.delete("Bootstrap");  
document.writeln(set.size);
[A] 2
[B] 1
[C] 0
[D] Undefined
Answer: 1
(13) What will be the output of the following JavaScript code?
set.add("one");  
set.add("two");  
set.add("three");    
set.clear();  
document.writeln(set.size);
[A] one
[B] 1
[C] 2
[D] 0
Answer: 0
(14) What will be the output of the following JavaScript code?
set.add("one");  
set.add("two”);
var itr=set.values();  
document.writeln(itr.next().value);
[A] one
[B] two
[C] error
[D] undefined
Answer: one
(15) What will be the output of the following JavaScript code?
set.add("1");  
set.add("2");    
document.writeln(set.has("3"));
            
[A] 3
[B] true
[C] false
[D] 2
Answer: false

Take Mock Tests

Missiles Mock Test Start Test!
SSC MTS Mock Test Start Test
IBPS CLERK MOCK TEST Start Test
SSC MTS 2022 JULY 26 Shift 1 (ENGLISH) Start Test!
SSC GD Previous Year Paper 2021 Nov 17 Shift - I (Hindi) Start Test!
SSC CGL Tier - 1 PYP 2022 April 21 Shift- 1 (ENGLISH) Start Test!
MPSC PAPER I MOCK TEST 1 (ENGLISH) Start Test!
IB Security Assistant Mock test 1 (english) Start Test!
UP POLICE CONSTABLE MOCK TEST 1 Start Test!
DELHI POLICE CONSTABLE MOCK TEST 1 (HINDI) Start Test!