PCAP-31-03 practice question 20 of 25

Which one of the platform module functions should be used to determine the underlying platform name?

Full set: 147 questions
Answer options
A: platform.uname ()
B: platform.platform () Correct answer
C: platform.python_version()
D: platform.processor()
Correct Answer:
B. platform.platform ()
Explanation

platform.platform() returns a single descriptive string identifying the underlying platform (OS name, release, version, etc.). It is the dedicated helper for obtaining the platform name.

Why Incorrect

A. platform.uname() returns a named-tuple with several fields, not just the platform name.
C. platform.pythonversion() reports only the Python interpreter version.
D. platform.processor() returns the processor/CPU name only.

References

1. Python 3 Standard Library, “platform — Access to underlying platform-identifying data”, sec. 37.1.1, docs.python.org/3/library/platform.html#platform.platform

2. Python 3 Std. Lib., same section, Example code (paragraph 2).

Scroll to Top