Skip to main content

Basic And Variables — Part 1 MCQs with Explanations

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

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

Verified Practice Questions

Interactive test mode with detailed academic worked solutions

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

The development environment offers which standard construct for data validation

Question 2 of 40
★ FPSC ★ PPSC

The main purpose of a “Live Wire” in NetScape is to

Question 3 of 40
★ FPSC ★ PPSC

The script tag must be placed in

Question 4 of 40
★ FPSC ★ PPSC

JavaScript is ideal to

Question 5 of 40
★ FPSC ★ PPSC

Which attribute is used to specify that the script is executed when the page has finished parsing ( only for external scripts )

Question 6 of 40
★ FPSC ★ PPSC

JavaScript can be written

Question 7 of 40
★ FPSC ★ PPSC

Which of the following Attribute is used to include External JS code inside your HTML Document

Question 8 of 40
★ FPSC ★ PPSC

The type of a variable that is volatile is

Question 9 of 40
★ FPSC ★ PPSC

A hexadecimal literal begins with

Question 10 of 40
★ FPSC ★ PPSC

The generalised syntax for a real number representation is

Question 11 of 40
★ FPSC ★ PPSC

When there is an indefinite or an infinity value during an arithmetic value computation, javascript

Question 12 of 40
★ FPSC ★ PPSC

Which of the following is not considered as an error in JavaScript?

Question 13 of 40
★ FPSC ★ PPSC

The escape sequence ‘f’ stands for

Question 14 of 40
★ FPSC ★ PPSC

The snippet that has to be used to check if “a” is not equal to “null” is

Question 15 of 40
★ FPSC ★ PPSC

The statement a===b refers to

Question 16 of 40
★ FPSC ★ PPSC

Assume that we have to convert “false” that is a non-string to string. The command that we use is (without invoking the “new” operator)

Question 17 of 40
★ FPSC ★ PPSC

A function definition expression can be called

Question 18 of 40
★ FPSC ★ PPSC

The property of a primary expression is

Question 19 of 40
★ FPSC ★ PPSC

Consider the following statements var text = "testing: 1, 2, 3" ; // Sample text var pattern = /d+/ g // Matches all instances of one or more digits In order to check if the pattern matches with the string “text”, the statement is

Question 20 of 40
★ FPSC ★ PPSC

The JavaScript’s syntax calling ( or executing ) a function or method is called

Question 21 of 40
★ FPSC ★ PPSC

What kind of an expression is “new Point(2,3)”?

Question 22 of 40
★ FPSC ★ PPSC

Which of the operator is used to test if a particular property exists or not?

Question 23 of 40
★ FPSC ★ PPSC

Among the following, which one is a ternary operator?

Question 24 of 40
★ FPSC ★ PPSC

“An expression that can legally appear on the left side of an assignment expression.” is a well known explanation for variables, properties of objects, and elements of arrays. They are called

Question 25 of 40
★ FPSC ★ PPSC

JavaScript is a _______________ language

Question 26 of 40
★ FPSC ★ PPSC

The output for the following code snippet would most appropriately be var a = 5 , b = 1 var obj = { a : 10 } with( obj ) { alert ( b ) }

Question 27 of 40
★ FPSC ★ PPSC

A conditional expression is also called a

Question 28 of 40
★ FPSC ★ PPSC

Which is a more efficient code snippet ? Code 1 : for(var num = 10 ;num >= 1 ;num -- ) { document . writeln ( num ) ; } Code 2 : var num = 10 ; while( num >= 1 ) { document . writeln ( num ) ; num ++ ; }

Question 29 of 40
★ FPSC ★ PPSC

A statement block is a

Question 30 of 40
★ FPSC ★ PPSC

When an empty statement is encountered, a JavaScript interpreter

Question 31 of 40
★ FPSC ★ PPSC

The “var” and “function” are

Question 32 of 40
★ FPSC ★ PPSC

Consider the following statements switch( expression ) { statements } In the above switch syntax, the expression is compared with the case labels using which of the following operator(s) ?

Question 33 of 40
★ FPSC ★ PPSC

Consider the following code snippet function printArray ( a ) { var len = a . length, i = 0 ; if ( len == 0 ) console . log (" Empty Array ") ; else { do { console . log ( a [ i ]) ; } while ( ++ i < len ) ; } } What does the above code result?

Question 34 of 40
★ FPSC ★ PPSC

What are the three important manipulations done in a for loop on a loop variable?

Question 35 of 40
★ FPSC ★ PPSC

Consider the following code snippet function tail ( o ) { for (; o . next; o = o . next ) ; return o; } Will the above code snippet work? If not, what will be the error?

Question 36 of 40
★ FPSC ★ PPSC

One of the special feature of an interpreter in reference with the for loop is that

Question 37 of 40
★ FPSC ★ PPSC

What will happen if the body of a for/in loop deletes a property that has not yet been enumerated?

Question 38 of 40
★ FPSC ★ PPSC

What will be the step of the interpreter in a jump statement when an exception is thrown?

Question 39 of 40
★ FPSC ★ PPSC

Consider the following code snippet while ( a != 0 ) { if (spam>a == 1 ) continue; else a ++ ; } What will be the role of the continue keyword in the above code snippet?

Question 40 of 40
★ FPSC ★ PPSC

Consider the following code snippet function f ( o ) { if ( o === undefined ) debugger; } What could be the task of the statement debugger?

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