Server-Side Scripting MCQs: 12 Solved Web Questions

Trace 12 server-side scripting MCQs across the browser, HTTP request, server and response. Answers explain boundaries, runtimes and JavaScript output.

KnowledgeGate Team

Exam prep & CS education

Updated 29 Nov 20267 min read
Server-Side Scripting MCQs: 12 Solved Web Questions

Server-side scripting MCQs become easier when every action is placed on the browser or server side of the HTTP boundary. AJAX and cookies then connect to JavaScript coercion, Classic ASP, PHP and cloud-console requests. Before choosing an option, label it browser, request, server or response. Use the Server Side Scripting PYQ Questions hub for the wider bank and for questions without an individual solved-page link.

Put every web action on the correct side of the request

Browser fetch crosses the network to server validation, returns HTTP 200 JSON, and updates #profile-name to Asha.

Trace one profile lookup before attempting the MCQs:

stage

runs where

exact value

job

Browser code

Browser

fetch('/api/profile?id=42')

Starts the background exchange

Request

Network

GET /api/profile?id=42 with Cookie: session_id=s7f9

Carries the query and small session identifier

Server script

Server

Validate id=42, look up {id:42,name:'Asha',role:'student'}, return HTTP 200

Makes the trusted data decision and emits the response

Browser update

Browser

Parse {"id":42,"name":"Asha","role":"student"} and set #profile-name to Asha

Changes the displayed DOM text

AJAX is the background browser-to-server exchange, not a server-side language. The HTTP request and response carry data, while the cookie holds only session_id=s7f9, not Asha's profile.

The server validates id=42, retrieves the trusted record and returns JSON with HTTP 200. A Node.js service might use a Mongoose schema and model for that work. After the response arrives, browser JavaScript parses it and changes #profile-name to Asha.

Request and response trace across Browser, Network, and Server, showing GET /api/profile?id=42, HTTP 200 JSON, and the name Asha.

MCQs 1-3: AJAX, the DOM and cookies

Question 1

Question-bank source: TPSC Assistant Technical Officer 2026

Code
What is the purpose of AJAX in web development ?

A. Server-side validation
B. Asynchronous communication with server
C. Database management
D. Styling web pages

Answer: B, Asynchronous communication with server.

With fetch('/api/profile?id=42'), the browser requests a profile and updates #profile-name without a full reload. Server validation may occur at the other end, but it is not AJAX's purpose. Databases store data, while CSS styles pages.

Question 2

Code
What does DOM stand for in web development ? 

A. Data Object Model
B. Document Object Model
C. Dynamic Output Method
D. Digital Operation Management

Answer: B, Document Object Model.

Given <p id="profile-name">Loading</p>, JavaScript selects that node and changes its text to Asha. This structured page view is the Document Object Model. The other expansions do not name it. Revise the foundations in Web Technologies for Teaching Exams: HTML and HTTP.

Question 3

Question-bank source: TPSC Assistant Technical Officer 2026

Code
What is the primary purpose of a cookie in web applications ?

A. Store large amounts of data
B. Execute server-side scripts
C. Store small amounts of data on client side
D. Encrypt data transmission

Answer: C, Store small amounts of data on client side.

The browser stores session_id=s7f9 and sends it with an eligible request. It neither executes server code nor encrypts the connection. A large profile belongs on the server, while cookie security attributes and HTTPS still matter.

MCQs 4-5: JavaScript type reporting and coercion

For each output problem, write every operand's type or parsed value, then apply the operators in order. A value and the string returned by typeof are different things.

Question 4

Question-bank source: UP Police Computer Operator 2025

Code
In JavaScript, null is a primitive value, but typeof reports it as what?

A. null
B. object
C. number
D. string
E. undefined

Answer: B, object.

Trace const value = null; typeof value. The result is "object", a long-standing behaviour, not proof that null is usable as an object. Check the value: value === null is true, while value === undefined is false.

Question 5

Question-bank source: UP Police Computer Operator 2025

Code
JavaScript code:
console.log(parseInt("10.5") + parseInt("5.7") + "2");

What is the output?

A. 152
B. 17.7
C. 16.2
D. 152.7
E. NaN

Answer: A, 152.

Trace parseInt("10.5") = 10 and parseInt("5.7") = 5. Then 10 + 5 = 15. Because the final operand is "2", 15 + "2" concatenates to "152". Answers 17.7 and 16.2 wrongly preserve the decimals.

MCQs 6-7: Classic ASP defaults and PHP inspection

Identify the runtime first, then apply its syntax or diagnostic rule. A Classic ASP default is not a rule for ASP.NET or every Microsoft web stack.

Question 6

Question-bank source: BTSC Lab Assistant 2013

Code
Default scripting language in ASP

A. EcmaScript
B. VBScript
C. PERL
D. JavaScript

Answer: B, VBScript.

This question uses historical Classic ASP. Its default was VBScript when no other language was declared. In <% Response.Write("Hi") %>, the server executes the block. Do not extend this answer to ASP.NET.

Question 7

Question-bank source: UP Police Computer Operator 2023

Code
Which statement correctly describes the functionality of the var_dump() function in PHP?

A. It assigns default values to one or more variables during execution.
B. It dumps information about one or more variables, including their type and value.
C. It formats and logs error messages for debugging purposes.
D. It creates a new variable and sets its data type automatically
E. It initializes arrays and objects for further processing.

Answer: B, it reports a variable's type and value.

$userId = 42; var_dump($userId); exposes int(42). $active = true; var_dump($active); exposes bool(true). The function inspects type and value; it does not initialise variables, assign defaults or write a formatted error log.

MCQs 8-9: JavaScript numeric checks and storage

Numeric checks can apply a function after coercion. Ordinary JavaScript Number values have a defined representation.

Question 8

Code
In JavaScript, what does the global isNaN() function do?

A. Return true if numeric coercion produces NaN
B. Return false if numeric coercion produces NaN
C. Return true if the argument is already a number
D. None of the given options

Answer: A, Return true if numeric coercion produces NaN.

Global isNaN("hello") is true because Number("hello") is NaN, while isNaN("42") is false because the string coerces to 42. The stricter Number.isNaN("hello") is false because it does not coerce its argument.

Question 9

Code
JavaScript numbers are stored as _____

A. integers
B. double precision floating point
C. double
D. floating point

Answer: B, double precision floating point.

Ordinary JavaScript Number values use IEEE 754 double-precision binary floating point. The expression 0.1 + 0.2 produces 0.30000000000000004 because those decimal fractions are not represented exactly in binary. BigInt is a separate arbitrary-precision integer type.

MCQs 10-12: state, validation and background server queries

Cookies carry state, JavaScript can reject input before a request, and AJAX can fetch server data without a full reload.

Question 10

Code
Cookies were designed as a response to which problem in the original design of HTML and HTTP?

A. Lack of privacy and confidentiality in viewing web-pages
B. Inequality if information between clients and servers
C. The open and distributed nature of the Internet
D. Persistence of state between web-sessions

Answer: D, Persistence of state between web-sessions.

Two HTTP requests are otherwise independent. A login response sets session_id=s7f9; a later request returns it in the Cookie header. The server associates it with stored session state. This creates continuity, not confidentiality.

Question 11

Code
Client-side technology, such as _____ is used for validating user inputs.

A. JavaScript
B. ASP.NET
C. PHP
D. None

Answer: A, JavaScript.

For age=15 and the rule age >= 18, JavaScript can reject the form before a request. PHP and ASP.NET run on the server in this contrast. The server must check again because client validation can be bypassed.

Question 12

Code
Cloud service providers typically provide web based management consoles that provide users insight on the state of cloud services. Which technology is used in client side browser code that queries back end systems for data from cloud services?

A. XHTML
B. AJAX
C. PHP
D. HTML

Answer: B, AJAX.

The console requests /api/services/3/status and receives {"state":"running","cpu":62}. AJAX fetches the data and updates a status card without full navigation. HTML and XHTML structure documents, while PHP could implement the server side.

Boundary traps in server-side scripting

trap

diagnostic question

worked value

replacement habit

AJAX versus server language

Who initiates the request?

/api/profile?id=42

Label browser, network and server

Cookie versus database

Small browser value or trusted server record?

session_id=s7f9

Keep identifiers small and records server-side

Value versus type

What does this operator return?

typeof null = "object"

Write the exact returned value

Parsing versus concatenation

What is each operand now?

10 + 5 + "2" = "152"

Trace left to right

Client validation versus server trust

Can the client check be bypassed?

age=15

Validate on both sides

Keep this historical distinction in mind:

Classic ASP -> VBScript, not all Microsoft web code -> VBScript.

Use a 30-second routine: circle the runtime, label the execution location, write one input, trace one output, then compare options.

Server-side scripting MCQs: short version and next step

  • AJAX exchanges data in the background.

  • The DOM represents the document in the browser.

  • Cookies hold small client-side values used across requests.

  • Server code validates trusted state.

  • JavaScript output questions require type and coercion traces.

  • Runtime tools such as PHP var_dump() must stay scoped to their platform.

Redo Questions 1, 3, 5, 7, 10 and 12 in 12 minutes, two minutes each. Tag each miss as boundary, state, coercion, runtime or validation, then replay its worked values.

For the complete MongoDB, Express, React and Node route, continue with MERN Stack. For a narrower backend sequence, use NodeJs + ExpressJs + MongoDB.