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

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

Trace one profile lookup before attempting the MCQs:
stage | runs where | exact value | job |
|---|---|---|---|
Browser code | Browser |
| Starts the background exchange |
Request | Network |
| Carries the query and small session identifier |
Server script | Server | Validate | Makes the trusted data decision and emits the response |
Browser update | Browser | Parse | 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.

MCQs 1-3: AJAX, the DOM and cookies
Question 1
Question-bank source: TPSC Assistant Technical Officer 2026
What is the purpose of AJAX in web development ?
A. Server-side validation
B. Asynchronous communication with server
C. Database management
D. Styling web pagesAnswer: 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
What does DOM stand for in web development ?
A. Data Object Model
B. Document Object Model
C. Dynamic Output Method
D. Digital Operation ManagementAnswer: 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
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 transmissionAnswer: 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
In JavaScript, null is a primitive value, but typeof reports it as what?
A. null
B. object
C. number
D. string
E. undefinedAnswer: 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
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. NaNAnswer: 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
Default scripting language in ASP
A. EcmaScript
B. VBScript
C. PERL
D. JavaScriptAnswer: 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
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
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 optionsAnswer: 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
JavaScript numbers are stored as _____
A. integers
B. double precision floating point
C. double
D. floating pointAnswer: 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
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-sessionsAnswer: 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
Client-side technology, such as _____ is used for validating user inputs.
A. JavaScript
B. ASP.NET
C. PHP
D. NoneAnswer: 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
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. HTMLAnswer: 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? |
| Label browser, network and server |
Cookie versus database | Small browser value or trusted server record? |
| Keep identifiers small and records server-side |
Value versus type | What does this operator return? |
| Write the exact returned value |
Parsing versus concatenation | What is each operand now? |
| Trace left to right |
Client validation versus server trust | Can the client check be bypassed? |
| Validate on both sides |
Keep this historical distinction in mind:
Classic ASP -> VBScript, notall 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.
Keep learning
Server-Side and Web Security: HTTP Sessions, Attacks, and Defences
Follow one illustrative login request from browser to proxy, application, and database, then map sessions, status codes, and common attacks to the controls that stop them.
Java Servlets MCQs: 12 Solved Request Handling Questions
Solve 12 Java Servlet MCQs with teacher-led explanations, an exact request trace, lifecycle checks, JSP translation, and shared-state pitfalls.
Java Servlets: Server-Side Request Handling with a Worked HTTP Trace
Follow one request from servlet mapping to doPost(), validate its inputs, calculate a score, and return JSON. Then test error paths and concurrent requests.
Office Mixed Concepts MCQs: 12 Solved Questions with Explanations
Solve 12 mixed MS Office questions by identifying the task, choosing the application and separating similar features, from OLE and mail merge to Access field types.





