Practice high-yield Programming & Software Development MCQs on Sockets — 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
🎉 Set complete! All 40 questions answered.
Question 1 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following is a stateless protocol?
Correct Answer: Option C — HTTP
Detailed Academic Explanation:
HTTP is a stateless protocol. A stateless protocol does not require the server to retain information or status about each user for the duration of multiple requests.
💡Key Conceptual Anchor:Sockets
Question 2 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the value 2 of the WebSocket attribute Socket.readyState indicate?
Correct Answer: Option B — Handshake connection
Detailed Academic Explanation:
The readonly attribute readyState represents the state of the connection. It can have the following values: 1. A value of 0 indicates that the connection has not yet been established. 2. A value of 1 indicates that the connection is established and communication is possible. 3. A value of 2 indicates that the connection is going through the closing handshake. 4. A value of 3 indicates that the connection has been closed or could not be opened.
💡Key Conceptual Anchor:Sockets
Question 3 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
How many WebSocket events are available?
Correct Answer: Option C — 4
Detailed Academic Explanation:
There are fourWebSocket events namely : 1. open 2. close 3. message 4. error
💡Key Conceptual Anchor:Sockets
Question 4 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which method is used to close the WebSocket?
Correct Answer: Option B — Socket.close()
Detailed Academic Explanation:
The Socket.close() is used to close the WebSocket.
💡Key Conceptual Anchor:Sockets
Question 5 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
How does the client and the server communicate following the rules defined by the WebSocket protocol?
Correct Answer: Option A — Long-lived TCP Socket
Detailed Academic Explanation:
The client and server communicate over a long-lived TCP socket following rules defined by the WebSocket protocol.
💡Key Conceptual Anchor:Sockets
Question 6 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following are not a socket property?
Correct Answer: Option D — ready
Detailed Academic Explanation:
There is no Socket property called ready.
💡Key Conceptual Anchor:Sockets
Question 7 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
How can we check the subprotocol being used by the client?
Correct Answer: Option B — protocol property
Detailed Academic Explanation:
Once the connection is established, the client can determine which subprotocol is in use by checking the protocol property of the socket.
💡Key Conceptual Anchor:Sockets
Question 8 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
How will you transmit data using the connection?
Correct Answer: Option C — Socket.send(data)
Detailed Academic Explanation:
The Socket.send(data) method transmits data using the connection.
💡Key Conceptual Anchor:Sockets
Question 9 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following is not a WebSocket event?
Correct Answer: Option D — deny
Detailed Academic Explanation:
There is no WebSocket event named deny. The four WebSocket events are 1. open 2. close 3. essage 4. error
💡Key Conceptual Anchor:Sockets
Question 10 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does an History object contain?
Correct Answer: Option A — URL
Detailed Academic Explanation:
The history object contains the URLs visited by the user (within a browser window).
💡Key Conceptual Anchor:Sockets
Question 11 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The history object is a part of which object?
Correct Answer: Option B — Window
Detailed Academic Explanation:
The history object belongs to the Window object.
💡Key Conceptual Anchor:Sockets
Question 12 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
How many methods are there in the History object?
Correct Answer: Option A — 3
Detailed Academic Explanation:
There are three methods belongign to the History object namely : 1. back() 2. forward() 3. go()
💡Key Conceptual Anchor:Sockets
Question 13 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the method forward()?
Correct Answer: Option D — Loads the next URL in the history list
Detailed Academic Explanation:
The forward() method loads the next URL in the history list.
💡Key Conceptual Anchor:Sockets
Question 14 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
How will you update the URL displayed in the location bar?
Correct Answer: Option C — location.hash
Detailed Academic Explanation:
The property location.hash needs to be updated to display the updated URL in the location bar.
💡Key Conceptual Anchor:Sockets
Question 15 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
How do you add a particular state to the browsing history?
Correct Answer: Option A — pushState()
Detailed Academic Explanation:
The pushState() method adds a particular state to the browsing history.
💡Key Conceptual Anchor:Sockets
Question 16 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the pushState() method do?
Correct Answer: Option B — Adds new state
Detailed Academic Explanation:
When a web app enters a new state, it calls history.pushState() to add that state to the browsing history.
💡Key Conceptual Anchor:Sockets
Question 17 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following method is used to replace the current history state instead of adding a new state to the browsing history?
Correct Answer: Option A — replaceState()
Detailed Academic Explanation:
The replaceState() method is used to replace the current history state instead of adding a new state to the browsing history.
💡Key Conceptual Anchor:Sockets
Question 18 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
How many parameters does the replaceState() method take?
Correct Answer: Option B — 3
Detailed Academic Explanation:
window.history.replaceState(stateObj, title, url) : This is just like window.history.pushState, except that the current browser state is removed from the history, so you cannot hit “back” to return to it.
💡Key Conceptual Anchor:Sockets
Question 19 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the event window.onpopstate?
Correct Answer: Option C — When a state object is removed
Detailed Academic Explanation:
The window.onpopstate event is fired whenever a state object is removed from the browser history, which occurs on browser “back” or “forward”. State objects are persisted on the user’s hard disk between sessions, which is a nice feature. The object passed into a call to pushState or replaceState is provided as the state property on the event object in the “popstate” event.
💡Key Conceptual Anchor:Sockets
Question 20 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
R is an extension of which of the following language?
Correct Answer: Option C — S
Detailed Academic Explanation:
R is an extension of and successor to the S language, which was itself a statistical language created in 1976 by John Chambers while at Bell Labs.
💡Key Conceptual Anchor:Sockets
Question 21 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following is/are statistical languages?
Correct Answer: Option D — Both R and S
Detailed Academic Explanation:
Both R and S are statistical languages.
💡Key Conceptual Anchor:Sockets
Question 22 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following is a successor to the S language?
Correct Answer: Option B — R
Detailed Academic Explanation:
R is an extension of and successor to the S language, which was itself a statistical language.
💡Key Conceptual Anchor:Sockets
Question 23 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What are the purposes R can be used for?
Correct Answer: Option D — All of the mentioned
Detailed Academic Explanation:
Generally, R can be used to suck in data, parse it, process it, and then visualize it for reporting purposes.
💡Key Conceptual Anchor:Sockets
Question 24 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What type of language is generally used to collect the data?
Correct Answer: Option A — Glue language
Detailed Academic Explanation:
A glue language is generally used to collect the data, that is written out as a comma-separated file, and read it into R.
💡Key Conceptual Anchor:Sockets
Question 25 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What are the processes that take place within R?
Correct Answer: Option D — All of the mentioned
Detailed Academic Explanation:
Within R, processing the data, splitting it, averaging it, aggregating it, overlaying two or more data sets, and then from with R, a chart that depicts the data out is done.
💡Key Conceptual Anchor:Sockets
Question 26 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which platform is R imported to after charting as a PDF?
Correct Answer: Option A — Adobe Illustrator
Detailed Academic Explanation:
From R, the chart is imported into the Adobe Illustrator, or any other such program, where it can clean up things like font consistency and make sure axis labels with long names are visible.
💡Key Conceptual Anchor:Sockets
Question 27 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of a glue language?
Correct Answer: Option D — Both Format and Collectc
Detailed Academic Explanation:
A glue language is generally used to collect and format the data.
💡Key Conceptual Anchor:Sockets
Question 28 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Why do we use Adobe Illustrator along with R?
Correct Answer: Option C — Tighten and format the chart
Detailed Academic Explanation:
The Adobe Illustrator is used along with R to tighten and format the chart.
💡Key Conceptual Anchor:Sockets
Question 29 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the R language do?
Correct Answer: Option B — Ingest and process the chart
Detailed Academic Explanation:
The R language is generally used to collect data that has been collected by the glue language and then ingest and process and chart.
💡Key Conceptual Anchor:Sockets
Question 30 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What kind of data can be run in R?
Correct Answer: Option D — All kinds
Detailed Academic Explanation:
All kinds of data can be run in R.
💡Key Conceptual Anchor:Sockets
Question 31 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following is/are the features of R?
Correct Answer: Option D — All of the mentioned
Detailed Academic Explanation:
As a language, R is small, self-contained, extensible, and just fun to use.
💡Key Conceptual Anchor:Sockets
Question 32 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the advantage for Linux users using R?
Correct Answer: Option A — They get a command sequence to install the particular Linux flavor
Detailed Academic Explanation:
Instead of a compiled installer, Linux users get the command sequence to install for their particular Linux flavor.
💡Key Conceptual Anchor:Sockets
Question 33 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following is the base install for R?
Correct Answer: Option B — Base
Detailed Academic Explanation:
The PC installer comes in three flavors: Base is the base install, Contrib comes with compiled third-party packages, and Rtools comes with tools to build your own R packages.
💡Key Conceptual Anchor:Sockets
Question 34 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following comes with compiled third-party packages?
Correct Answer: Option A — Contrib
Detailed Academic Explanation:
The PC installer comes in three flavors: Base is the base install, Contrib comes with compiled third-party packages, and Rtools comes with tools to build your own R packages.
💡Key Conceptual Anchor:Sockets
Question 35 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following comes with tools to build your own R packages?
Correct Answer: Option C — Rtools
Detailed Academic Explanation:
The PC installer comes in three flavors: Base is the base install, Contrib comes with compiled third-party packages, and Rtools comes with tools to build your own R packages.
💡Key Conceptual Anchor:Sockets
Question 36 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The code of the R language has an extension?
Correct Answer: Option B — .R
Detailed Academic Explanation:
The code of the R language has an extension .R.
💡Key Conceptual Anchor:Sockets
Question 37 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following is used to run ad hoc R commands?
Correct Answer: Option A — R Console
Detailed Academic Explanation:
The R Console is a command-line environment for running ad hoc R commands.
💡Key Conceptual Anchor:Sockets
Question 38 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which is the keyword used to open the Help window?
Correct Answer: Option C — ?
Detailed Academic Explanation:
At any time, you can type ?(keyword) to open the help window for a particular subject.
💡Key Conceptual Anchor:Sockets
Question 39 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
For a more extensive search, which keyword needs to be used?
Correct Answer: Option A — ??
Detailed Academic Explanation:
For a more extensive search, just type ?? (keyword).
💡Key Conceptual Anchor:Sockets
Question 40 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the usage of the keyword ?? in R?
Correct Answer: Option B — Extensive search
Detailed Academic Explanation:
?? (keyword) is generally used for a more extensive search when compared to the keyword ?.
💡Key Conceptual Anchor:Sockets
✓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.