Basic And Variables — Part 2 MCQs with Explanations
Practice high-yield Programming & Software Development MCQs on Basic And Variables — Part 2 with worked academic solutions for FPSC, PPSC, NTS, NITB, PTS.
Questions
39
Difficulty Level
Exam-Level
Target Exams
FPSC, PPSC, NTS...
Estimated Time
47 mins
Exam-Level FPSC PPSC NTS NITB PTS
Verified for Commission Syllabus • Oct 14, 2026
39
Verified Practice Questions
Interactive test mode with detailed academic worked solutions
Live Progress|0/39 answered
✓0 correct
✗0 wrong
0% score
🎉 Set complete! All 39 questions answered.
Question 1 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Among the keywords below, which one is not a statement?
Correct Answer: Option D — use strict
Detailed Academic Explanation:
use strict is a directive introduced in ECMAScript5. Directives are not statements because it does not include any language keywords. Also, it can appear only at the start of a script or at the start of a function body, before any real statemenst have appeared.
💡Key Conceptual Anchor:Basic And Variables
Question 2 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The unordered collection of properties, each of which has a name and a value is called
Correct Answer: Option B — Object
Detailed Academic Explanation:
An object is an unordered collection of properties, each of which has a name and a value. Property names are strings, so we can say that objects map strings to values.
💡Key Conceptual Anchor:Basic And Variables
Question 3 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The object has three object attributes namely
Correct Answer: Option C — Prototype, class, object’s extensible flag
Detailed Academic Explanation:
Every object has three associated object attributes : 1. An object’s prototype is a reference to another object from which properties are inherited. 2. An object’s class is a string that caegorizes the type of an object. 3. An object’s extensible flag specifies whether new properties may be added to the object.
💡Key Conceptual Anchor:Basic And Variables
Question 4 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Consider the following code snippet : var book = { " main title ": " JavaScript " , ' sub-title ': " The Definitive Guide " , " for ": " all audiences " , author : { firstname : " David " , surname : " Flanagan " } } ; In the above snippet, firstname and surname are
Correct Answer: Option C — property names
Detailed Academic Explanation:
firstname and surname are the property names. The value of that particular property is itself an object. That is why these property names are unquoted.
💡Key Conceptual Anchor:Basic And Variables
Question 5 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
A linkage of series of prototype objects is called as :
Correct Answer: Option B — prototype chain
Detailed Academic Explanation:
Consider an example, Date.prototype inherits properties from Object.prototype, so a Date object created by new Date() inherits properties from both Date.prototype and Object.prototype. This linked series of prototype objects is known as prototype chain.
💡Key Conceptual Anchor:Basic And Variables
Question 6 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Consider the below given syntax book [ datatype ] = assignment_value; In the above syntax, the datatype within the square brackets must be
Correct Answer: Option B — A String
Detailed Academic Explanation:
When using square bracket notation, the expression inside the square brackets must evaluate to a sting or a value that can be converted to a string.
💡Key Conceptual Anchor:Basic And Variables
Question 7 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
To determine whether one object is the prototype of (or is part of the prototype chain of) another object, one should use the
Correct Answer: Option A — isPrototypeOf() method
Detailed Academic Explanation:
To determine whether one object is the prototype of (or is part of the prototype chain of) another object, one should use the isPrototype() method. To find out if p is the prototype of o write p.isPrototypeOf(o).
💡Key Conceptual Anchor:Basic And Variables
Question 8 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Consider the following code snippet function f () {} ; The above prototype represents a
Correct Answer: Option B — A custom constructor
Detailed Academic Explanation:
The above code snippet defines a custom constructor.
💡Key Conceptual Anchor:Basic And Variables
Question 9 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The purpose of extensible attribute is to
Correct Answer: Option C — “lock down” objects into a known state and prevent outside tampering
Detailed Academic Explanation:
The purpose of the extensible attribute is to be able to “lock down” objects into a known state and prevent outside tampering.
💡Key Conceptual Anchor:Basic And Variables
Question 10 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Identify the process done in the below code snippet o = { x : 1 , y :{ z :[false,null, "" ]}} ; s = JSON . stringify ( o ) ; p = JSON . parse ( s ) ;
Correct Answer: Option B — Object Serialization
Detailed Academic Explanation:
Object serialization is the process of converting an object’s state to a string from which it can later be restored.
💡Key Conceptual Anchor:Basic And Variables
Question 11 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
A JavaScript program developed on a Unix Machine
Correct Answer: Option C — will work perfectly well on a Windows Machine
Detailed Academic Explanation:
will work perfectly well on a Windows Machine is the correct answer to “A JavaScript program developed on a Unix Machine”. This question is standard in competitive examination syllabi for Basic And Variables.
💡Key Conceptual Anchor:Basic And Variables
Question 12 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
JavaScript Code can be called by using
Correct Answer: Option D — Function/Method
Detailed Academic Explanation:
Function/Method is the correct answer to “JavaScript Code can be called by using”. This question is standard in competitive examination syllabi for Basic And Variables.
💡Key Conceptual Anchor:Basic And Variables
Question 13 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
A proper scripting language is a
Correct Answer: Option A — High level programming language
Detailed Academic Explanation:
High level programming language is the correct answer to “A proper scripting language is a”. This question is standard in competitive examination syllabi for Basic And Variables.
💡Key Conceptual Anchor:Basic And Variables
Question 14 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Consider the following snippet code var string1 = ” 123 ”; var intvalue = 123 ; alert ( string1 + intvalue ) ; The result would be
Correct Answer: Option C — 123123
Detailed Academic Explanation:
123123 is the correct answer to “Consider the following snippet code var string1 = ” 123 ”; var intvalue = 123 ; alert ( string1 + intvalue ) ; The result would be”. This question is standard in competitive examination syllabi for Basic And Variables.
💡Key Conceptual Anchor:Basic And Variables
Question 15 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Consider the following statements var count = 0 ; while ( count < 10 ) { console . log ( count ) ; count ++ ; } In the above code snippet, what happens?
Correct Answer: Option B — The value of count from 0 to 9 is displayed in the console
Detailed Academic Explanation:
The value of count from 0 to 9 is displayed in the console is the correct answer to “Consider the following statements var count = 0 ; while ( count < 10 ) { console . log ( count ) ; count ++ ; } In the above code snippet, what happens”. This question is standard in competitive examination syllabi for Basic And Variables.
💡Key Conceptual Anchor:Basic And Variables
Question 16 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The enumeration order becomes implementation dependent and non-interoperable if :
Correct Answer: Option A — If the object inherits enumerable properties
Detailed Academic Explanation:
If the object inherits enumerable properties is the correct answer to “The enumeration order becomes implementation dependent and non-interoperable if :”. This question is standard in competitive examination syllabi for Basic And Variables.
💡Key Conceptual Anchor:Basic And Variables
Question 17 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The basic purpose of the toLocaleString() is to
Correct Answer: Option D — return a localized string representation of the object
Detailed Academic Explanation:
return a localized string representation of the object is the correct answer to “The basic purpose of the toLocaleString() is to”. This question is standard in competitive examination syllabi for Basic And Variables.
💡Key Conceptual Anchor:Basic And Variables
Question 18 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Javascript is _________ language.
Correct Answer: Option D — Scripting
Detailed Academic Explanation:
Scripting is the correct answer to “Javascript is _________ language.”. This question is standard in competitive examination syllabi for Basic And Variables.
💡Key Conceptual Anchor:Basic And Variables
Question 19 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
JavaScript is ______ Side Scripting Language.
Correct Answer: Option B — Browser
Detailed Academic Explanation:
Browser is the correct answer to “JavaScript is ______ Side Scripting Language.”. This question is standard in competitive examination syllabi for Basic And Variables.
💡Key Conceptual Anchor:Basic And Variables
Question 20 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
JavaScript is designed for following purpose
Correct Answer: Option C — To add interactivity to HTML Pages.
Detailed Academic Explanation:
To add interactivity to HTML Pages. is the correct answer to “JavaScript is designed for following purpose”. This question is standard in competitive examination syllabi for Basic And Variables.
💡Key Conceptual Anchor:Basic And Variables
Question 21 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
JavaScript Code is written inside file having extension __________.
Correct Answer: Option D — .js
Detailed Academic Explanation:
.js is the correct answer to “JavaScript Code is written inside file having extension __________.”. This question is standard in competitive examination syllabi for Basic And Variables.
💡Key Conceptual Anchor:Basic And Variables
Question 22 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Local Browser used for validations on the Web Pages uses __________.
Correct Answer: Option B — JS
Detailed Academic Explanation:
JS is the correct answer to “Local Browser used for validations on the Web Pages uses __________.”. This question is standard in competitive examination syllabi for Basic And Variables.
💡Key Conceptual Anchor:Basic And Variables
Question 23 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
We can embed JS code inside HTML directly ?
Correct Answer: Option A — True
Detailed Academic Explanation:
True is the correct answer to “We can embed JS code inside HTML directly”. This question is standard in competitive examination syllabi for Basic And Variables.
💡Key Conceptual Anchor:Basic And Variables
Question 24 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
JS code included inside head section is loaded before loading page.
Correct Answer: Option A — True
Detailed Academic Explanation:
True is the correct answer to “JS code included inside head section is loaded before loading page.”. This question is standard in competitive examination syllabi for Basic And Variables.
💡Key Conceptual Anchor:Basic And Variables
Question 25 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
It is good to include JS code inside footer section in order to speed up the Page loading time of Webpage.
Correct Answer: Option A — True
Detailed Academic Explanation:
True is the correct answer to “It is good to include JS code inside footer section in order to speed up the Page loading time of Webpage.”. This question is standard in competitive examination syllabi for Basic And Variables.
💡Key Conceptual Anchor:Basic And Variables
Question 26 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which attribute is used to specifies that the script is executed when the page has finished parsing (only for external scripts)
Correct Answer: Option C — defer
Detailed Academic Explanation:
defer is the correct answer to “Which attribute is used to specifies that the script is executed when the page has finished parsing (only for external scripts)”. This question is standard in competitive examination syllabi for Basic And Variables.
💡Key Conceptual Anchor:Basic And Variables
Question 27 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which was the first browser to support JavaScript ?
Correct Answer: Option B — Netscape
Detailed Academic Explanation:
Netscape is the correct answer to “Which was the first browser to support JavaScript”. This question is standard in competitive examination syllabi for Basic And Variables.
💡Key Conceptual Anchor:Basic And Variables
Question 28 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
JavaScript is invented by ________.
Correct Answer: Option C — Brendan Eich
Detailed Academic Explanation:
Brendan Eich is the correct answer to “JavaScript is invented by ________.”. This question is standard in competitive examination syllabi for Basic And Variables.
💡Key Conceptual Anchor:Basic And Variables
Question 29 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
JavaScript was invented at _______ Lab.
Correct Answer: Option D — Netscape
Detailed Academic Explanation:
Netscape is the correct answer to “JavaScript was invented at _______ Lab.”. This question is standard in competitive examination syllabi for Basic And Variables.
💡Key Conceptual Anchor:Basic And Variables
Question 30 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Variable can hold ________ value at a time.
Correct Answer: Option B — Single
Detailed Academic Explanation:
Single is the correct answer to “Variable can hold ________ value at a time.”. This question is standard in competitive examination syllabi for Basic And Variables.
💡Key Conceptual Anchor:Basic And Variables
Question 31 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Integer Variable is declared using following syntax in JavaScript.
Correct Answer: Option C — var num
Detailed Academic Explanation:
var num is the correct answer to “Integer Variable is declared using following syntax in JavaScript.”. This question is standard in competitive examination syllabi for Basic And Variables.
💡Key Conceptual Anchor:Basic And Variables
Question 32 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
We can declare ___________ at a time. Select most appropriate option.
Correct Answer: Option A — One or more Variables
Detailed Academic Explanation:
One or more Variables is the correct answer to “We can declare ___________ at a time. Select most appropriate option.”. This question is standard in competitive examination syllabi for Basic And Variables.
💡Key Conceptual Anchor:Basic And Variables
Question 33 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Spaces,Punctuation marks are called as __________ Symbols in JavaScript.
Correct Answer: Option D — Special
Detailed Academic Explanation:
Special is the correct answer to “Spaces,Punctuation marks are called as __________ Symbols in JavaScript.”. This question is standard in competitive examination syllabi for Basic And Variables.
💡Key Conceptual Anchor:Basic And Variables
Question 34 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Java Script Variable should be Case ___________.
Correct Answer: Option B — Sensitive
Detailed Academic Explanation:
Sensitive is the correct answer to “Java Script Variable should be Case ___________.”. This question is standard in competitive examination syllabi for Basic And Variables.
💡Key Conceptual Anchor:Basic And Variables
Question 35 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Initialization of variable can be done by writing _____ operator in between variable name and operand value.
Correct Answer: Option B — =
Detailed Academic Explanation:
= is the correct answer to “Initialization of variable can be done by writing _____ operator in between variable name and operand value.”. This question is standard in competitive examination syllabi for Basic And Variables.
💡Key Conceptual Anchor:Basic And Variables
Question 36 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Multiple Declarations of variables are separated by ___________ symbol.
Correct Answer: Option A — Comma
Detailed Academic Explanation:
Comma is the correct answer to “Multiple Declarations of variables are separated by ___________ symbol.”. This question is standard in competitive examination syllabi for Basic And Variables.
💡Key Conceptual Anchor:Basic And Variables
Question 37 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Underscore can be used as first letter while declaring variable in JavaScript.
Correct Answer: Option A — True
Detailed Academic Explanation:
True is the correct answer to “Underscore can be used as first letter while declaring variable in JavaScript.”. This question is standard in competitive examination syllabi for Basic And Variables.
💡Key Conceptual Anchor:Basic And Variables
Question 38 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Variable declared inside JavaScript Function will be called as ____________.
Correct Answer: Option A — Local Variables
Detailed Academic Explanation:
Local Variables is the correct answer to “Variable declared inside JavaScript Function will be called as ____________.”. This question is standard in competitive examination syllabi for Basic And Variables.
💡Key Conceptual Anchor:Basic And Variables
Question 39 of 39
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Local Variables are destroyed after execution of function.
Correct Answer: Option A — True
Detailed Academic Explanation:
True is the correct answer to “Local Variables are destroyed after execution of function.”. This question is standard in competitive examination syllabi for Basic And Variables.
💡Key Conceptual Anchor:Basic And Variables
✓Link copied to clipboard
Continue Your Practice
Advance Html — Part 1
Master the next curriculum module with 40 exam-standard MCQs.
💡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.