Free PCPP-32-101 Exam Braindumps
Certified Professional in Python Programming 1 Questions 34–38 (page: 4)

Updated On: 1-Feb-2026

Select the true statements about the json.-dumps () function. (Select two answers.)

  1. It returns a JSON string.
  2. It returns a Python entity.
  3. It takes a JSON string as its argument
  4. It takes Python data as its argument.

Answer(s): A,D

Explanation:

The json.dumps() function is used to convert a Python object into a JSON string 1. It takes Python data as its argument, such as a dictionary or a list, and returns a JSON string.


Reference:

Official Python documentation on
json.dumps(): https://docs.python.org/3/library/json.html#json.dumps

A) It returns a JSON string.
This statement is true because the json.dumps () function takes a Python object as its argument and returns a JSON-formatted string that represents the object.
For example, json.dumps ([1, 2, 3]) returns `[1, 2, 3]'.
D) It takes Python data as its argument.
This statement is true because the json.dumps () function accepts any Python object that can be serialized into JSON, such as lists, dictionaries, strings, numbers, booleans, or None. For example, json.dumps ({"name": "Alice", "age": 25}) returns `{"name": "Alice", "age": 25}'.



What is ElementTree?

  1. A Python built-in module that contains functions used for creating HTML files.
  2. A Python library that contains an API used for parsing and manipulating JSON files.
  3. A Python library that contains functions and tools used for manipulating text files in GUI Programming.
  4. A Python built-in module that contains functions used for parsing and creating XML data.

Answer(s): D

Explanation:

ElementTree is a Python built-in module that provides a simple and efficient API for parsing and creating XML data. It allows you to access and manipulate XML data in a very straightforward way, making it easy to write XML processing applications.


Reference:

Official Python documentation on ElementTree: https://docs.python.org/3/library/xml.etree.elementtree.html

This statement is true because ElementTree is a module in the standard library of Python that provides an API for working with XML data. The module supports parsing XML from strings or files, creating XML trees from scratch or modifying existing ones, searching and iterating over XML elements, and writing XML data to strings or files.



In the JSON processing context, the term serialization:

  1. names a process in which Python data is turned into a JSON string.
  2. names a process in which a JSON string is turned into Python data.
  3. refers to nothing, because there is no such thing as JSON serialization.
  4. names a process in which a JSON string is remodeled and transformed into a new JSON string

Answer(s): A

Explanation:

In the JSON processing context, the term serialization: A. names a process in which Python data is turned into a JSON string.
Serialization refers to the process of converting a data object, such as a Python object, into a format that can be easily transferred over a network or stored in a file. In the case of JSON, serialization refers to converting Python data into a string representation using the JSON format. This string can be sent over a network or stored as a file, and later deserialized back into the original Python data object.


Reference:

Official Python documentation on json: https://docs.python.org/3/library/json.html#json- serialization



Select the true statements about the following invocation:



(Select two answers.)

  1. It addresses a service deployed at localhost (the host where the code is run).
  2. It addresses a service whose timeout is set to 3000 ms.
  3. It addresses a service located at the following address local.host.com.
  4. It addresses a service listening at port 3000.

Answer(s): A,D

Explanation:

A) It addresses a service deployed at localhost (the host where the code is run). This statement is true because localhost is a special hostname that refers to the local machine or the current host where the code is run. It is equivalent to using the IP address 127.0.0.1, which is the loopback address of the network interface. By using localhost as the hostname, the invocation addresses a service that is deployed on the same machine as the client.
D) It addresses a service listening at port 3000.
This statement is true because port 3000 is the part of the URL that follows the colon after the hostname. It specifies the port number where the service is listening for incoming requests. A port number is a 16-bit integer that identifies a specific process or application on a host. By using port 3000, the invocation addresses a service that is listening at that port. B. It addresses a service whose timeout is set to 3000 ms. This statement is false because timeout is not a part of the URL, but a parameter that can be passed to the requests.get () function in Python. Timeout specifies how long to wait for the server to send data before giving up. It is measured in seconds, not milliseconds. By using timeout=3, the invocation sets the timeout to 3 seconds, not 3000 ms.
C) It addresses a service located at the following address local.host.com. This statement is false because local.host.com is not the same as localhost. Local.host.com is a fully qualified domain name (FQDN) that consists of three parts: local, host, and com. It requires DNS resolution to map it to an IP address. Localhost, on the other hand, is a special hostname that does not require DNS resolution and always maps to 127.0.0.1. By using localhost as the hostname, the invocation does not address a service located at local.host.com.


Reference:

: https://docs.python.org/3/library/requests.html : https://en.wikipedia.org/wiki/Localhost :
https://en.wikipedia.org/wiki/Port_(computer_networking) :
https://en.wikipedia.org/wiki/Fully_qualified_domain_name



A socket object is usually created by which one of the following invocations?

  1. socket. socket (socket_domain, socket_type)
  2. socket = socket. socket (socket_number)
  3. socket = socket. socket (socket_domain, socket_type, server_address)
  4. socket = socket.socket(server address)

Answer(s): A

Explanation:

A socket object is usually created using the socket() constructor provided by the socket module in Python. The correct invocation is socket.socket(socket_domain, socket_type). This creates a new socket object with the specified socket domain and type.


Reference:

Official Python documentation on socket
programming: https://docs.python.org/3/library/socket.html



Viewing page 4 of 10
Viewing questions 16 - 20 out of 80 questions


Post your Comments and Discuss Python Institute PCPP-32-101 exam prep with other Community members:

AI Tutor AI Tutor 👋 I’m here to help!