Skip to main content

Classes And Modules — Part 2 MCQs with Explanations

Practice high-yield Programming & Software Development MCQs on Classes And Modules — Part 2 with worked academic solutions for FPSC, PPSC, NTS, NITB, PTS.

Questions
28
Difficulty Level
Exam-Level
Target Exams
FPSC, PPSC, NTS...
Estimated Time
34 mins
Exam-Level FPSC PPSC NTS NITB PTS
Verified for Commission Syllabus • Oct 14, 2026
28

Verified Practice Questions

Interactive test mode with detailed academic worked solutions

Live Progress | 0/28 answered
✓ 0 correct ✗ 0 wrong 0% score
Question 1 of 28
★ FPSC ★ PPSC

Why was “The Good Parts” designed as a language subset in JavaScript?

Question 2 of 28
★ FPSC ★ PPSC

Which is the subset that is a secure container designed for the purpose of safely running untrusted JavaScript?

Question 3 of 28
★ FPSC ★ PPSC

Why is the this keyword forbidden in JavaScript?

Question 4 of 28
★ FPSC ★ PPSC

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

Question 5 of 28
★ FPSC ★ PPSC

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

Question 6 of 28
★ FPSC ★ PPSC

Which was one of the first security subsets proposed?

Question 7 of 28
★ FPSC ★ PPSC

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

Question 8 of 28
★ FPSC ★ PPSC

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?

Question 9 of 28
★ FPSC ★ PPSC

The let keyword can be used

Question 10 of 28
★ FPSC ★ PPSC

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

Question 11 of 28
★ FPSC ★ PPSC

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 ?

Question 12 of 28
★ FPSC ★ PPSC

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

Question 13 of 28
★ FPSC ★ PPSC

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

Question 14 of 28
★ FPSC ★ PPSC

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

Question 15 of 28
★ FPSC ★ PPSC

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

Question 16 of 28
★ FPSC ★ PPSC

Which exception does the Iterators throw from their next() method when there are no more values to iterate, that work on finite collections ?

Question 17 of 28
★ FPSC ★ PPSC

Which method of the iterable object returns an iterator object for the collection?

Question 18 of 28
★ FPSC ★ PPSC

Consider the following code snippet let succ = function ( x ) x + 1 , yes = function () true , no = function () false ; What convenience does the above code snippet provide?

Question 19 of 28
★ FPSC ★ PPSC

Consider the following code snippet data . sort (function( a,b ) ,b - a ) ; What does the above code do?

Question 20 of 28
★ FPSC ★ PPSC

What is the code to be used to trim whitespaces ?

Question 21 of 28
★ FPSC ★ PPSC

What will be the reaction when a catch clause has no conditionals ?

Question 22 of 28
★ FPSC ★ PPSC

When will the finally block be called?

Question 23 of 28
★ FPSC ★ PPSC

What is the return type of typeof for standard JavaScript objects?

Question 24 of 28
★ FPSC ★ PPSC

Which of the following is the descendant operator?

Question 25 of 28
★ FPSC ★ PPSC

Which of the following is an example to perform the most common XML manipulations using the XML objects invocation?

Question 26 of 28
★ FPSC ★ PPSC

What is the code required to delete all “weight” tags?

Question 27 of 28
★ FPSC ★ PPSC

The snippet that filters the filtered set is

Question 28 of 28
★ FPSC ★ PPSC

Which method to use while working with XML fragments, instead of XML()?

✓ Link copied to clipboard
Continue Your Practice

Advance Html — Part 1

Master the next curriculum module with 40 exam-standard MCQs.

Next Practice Set →

💡 Examiner's Advisory for Programming & Software Development

In competitive commission exams (FPSC, PPSC, KPPSC, SPSC, CSS, PMS), questions are frequently phrased with distractor options designed to catch rote learners. Whenever you answer an MCQ, read the Detailed Academic Explanation and Conceptual Anchor to understand why the remaining options are incorrect.

More Modules in Programming & Software Development

View All →
📚

Study Guides

Topic summaries and syllabus breakdown

Explore Guides →
🎯

Complete Library

Search through 78,000+ verified MCQs

Browse Library →
📱

Mobile App

Offline mock tests and instant bookmarks

Get Mobile App →