Skip to main content

Array And Function MCQs with Explanations

Practice high-yield Programming & Software Development MCQs on Array And Function with worked academic solutions for FPSC, PPSC, NTS, NITB, PTS.

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

Verified Practice Questions

Interactive test mode with detailed academic worked solutions

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

Consider the code snippet given below var count = [ 1 ,, 3 ] ; What is the observation made?

Question 2 of 38
★ FPSC ★ PPSC

Consider the following code snippet var a1 = [,,,] ; var a2 = new Array ( 3 ) ; 0 in a1 0 in a2 The result would be

Question 3 of 38
★ FPSC ★ PPSC

The pop() method of the array does which of the following task ?

Question 4 of 38
★ FPSC ★ PPSC

What will happen if reverse() and join() methods are used simultaneously ?

Question 5 of 38
★ FPSC ★ PPSC

Consider the following code snippet : var a = [] ; a . unshift ( 1 ) ; a . unshift ( 22 ) ; a . shift () ; a . unshift ( 3 , [ 4 , 5 ]) ; a . shift () ; a . shift () ; a . shift () ; The final output for the shift() is

Question 6 of 38
★ FPSC ★ PPSC

The primary purpose of the array map() function is that it

Question 7 of 38
★ FPSC ★ PPSC

The method or operator used to identify the array is

Question 8 of 38
★ FPSC ★ PPSC

The function definitions in JavaScript begins with

Question 9 of 38
★ FPSC ★ PPSC

Consider the following code snippet function printprops ( o ) { for(var p in o ) console . log ( p + ": " + o [ p ] + "n" ) ; } What will the above code snippet result ?

Question 10 of 38
★ FPSC ★ PPSC

When does the function name become optional in JavaScript?

Question 11 of 38
★ FPSC ★ PPSC

What is the purpose of a return statement in a function?

Question 12 of 38
★ FPSC ★ PPSC

What will happen if a return statement does not have an associated expression?

Question 13 of 38
★ FPSC ★ PPSC

A function with no return value is called

Question 14 of 38
★ FPSC ★ PPSC

Consider the following code snippet function hypotenuse ( a, b ) { function square ( x ) { return x * x; } return Math . sqrt ( square ( a ) + square ( b )) ; } What does the above code result?

Question 15 of 38
★ FPSC ★ PPSC

Which of the following is the correct code for invoking a function without this keyword at all, and also too determine whether the strict mode is in effect?

Question 16 of 38
★ FPSC ★ PPSC

Which is an equivalent code to invoke a function m of class o that expects two arguments x and y?

Question 17 of 38
★ FPSC ★ PPSC

Consider the following code snippet : var grand_Total =eval (" 10*10+5 ") ; The output for the above statement would be :

Question 18 of 38
★ FPSC ★ PPSC

Consider the following code snippet : var tensquared = ( function ( x ) {return x * x; }( 10 )) ; Will the above code work ?

Question 19 of 38
★ FPSC ★ PPSC

Consider the following code snippet : var string2Num =parseInt (" 123xyz ") ; The result for the above code snippet would be :

Question 20 of 38
★ FPSC ★ PPSC

If you have a function f and an object o, you can define a method named m of o with

Question 21 of 38
★ FPSC ★ PPSC

For the below mentioned code snippet: var o = new Object () ; The equivalent statement is:

Question 22 of 38
★ FPSC ★ PPSC

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 :

Question 23 of 38
★ FPSC ★ PPSC

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 ?

Question 24 of 38
★ FPSC ★ PPSC

What kind of scoping does JavaScript use?

Question 25 of 38
★ FPSC ★ PPSC

What must be done in order to implement Lexical Scoping?

Question 26 of 38
★ FPSC ★ PPSC

What is a closure?

Question 27 of 38
★ FPSC ★ PPSC

Which of the following are examples of closures?

Question 28 of 38
★ FPSC ★ PPSC

Which of the following uses a lot of CPU cycles?

Question 29 of 38
★ FPSC ★ PPSC

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?

Question 30 of 38
★ FPSC ★ PPSC

What is the fundamental rule of lexical scoping?

Question 31 of 38
★ FPSC ★ PPSC

What is the opposite approach to the lexical scoping?

Question 32 of 38
★ FPSC ★ PPSC

What is the purpose of the dynamic scoping?

Question 33 of 38
★ FPSC ★ PPSC

Which of the algorithmic languages is lexical scoping standardized in?

Question 34 of 38
★ FPSC ★ PPSC

Consider the following code snippet : if ( !a [ i ]) continue ; What is the observation made ?

Question 35 of 38
★ FPSC ★ PPSC

Consider the following code snippet : var a = [ 1 , 2 , 3 , 4 , 5 ] ; a . slice ( 0 , 3 ) ; What is the possible output for the above code snippet ?

Question 36 of 38
★ FPSC ★ PPSC

The reduce and reduceRight methods follow a common operation called

Question 37 of 38
★ FPSC ★ PPSC

Do functions in JavaScript necessarily return a value ?

Question 38 of 38
★ FPSC ★ PPSC

What is the difference between the two lines given below ? !!( obj1 && obj2 ) ; ( obj1 && obj2 ) ;

✓ 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 →