[Q25-Q44] 実際にあるPCPP-32-101問題集でリアルPython Institute問題集PDFを提供しています [2024年07月]

Share

実際にあるPCPP-32-101問題集でリアルPython Institute問題集PDFを提供しています [2024年07月]

実際のJPNTest PCPP-32-101問題集PDFで100%合格率を保証します

質問 # 25
Select the true statements about the json.-dumps () function. (Select two answers.)

  • A. It returns a Python entity.
  • B. It takes Python data as its argument.
  • C. It returns a JSON string.
  • D. It takes a JSON string as its argument

正解:B、C

解説:
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.


質問 # 26
Which of the following values can be returnedby the messagebox. askquestion () method?

  • A. True and False
  • B. "yes" and "no"
  • C. "accept:" and "cancel''
  • D. l and o

正解:B

解説:
Explanation
The messagebox.askquestion() method in Python's tkinter library displays a message box with a specified question and two response buttons labeled "Yes" and "No". It returns a string indicating which button was selected - either "yes" or "no".
This function is used to ask questions to the user that have only two options: YES or NO. It can be used to ask the user if they want to continue or if they want to submit something 1.


質問 # 27
Analyze the following snippet and select the statement that best describes it.

  • A. The code is syntactically correct despite the fact that the names of the function parameters do not follow the naming convention
  • B. The code is syntactically incorrect - the function should be defined as def f1 (*args, **kwargs)
  • C. The code is missing a placeholder for unnamed parameters.
  • D. The *arg parameter holds a list of unnamed parameters

正解:D

解説:
Explanation
The provided code snippet defines a function f1 that accepts variable-length arguments using the *args and **kwargs syntax. The *args parameter allows for an arbitrary number of unnamed arguments to be passed to the function as a tuple, while the **kwargs parameter allows for an arbitrary number of named arguments to be passed to the function as a dictionary.
Therefore, the correct statement that best describes the code is:
The *args parameter holds a list of unnamed parameters, while the **kwargs parameter holds a dictionary of named parameters.


質問 # 28
What will happen if the mamwindow is too small to fit all its widgets?

  • A. Some widgets may be invisible
  • B. The widgets will be scaled down to fit the window's size.
  • C. The window will be expanded.
  • D. An exception will be raised.

正解:A

解説:
Explanation
If the main window is too small to fit all its widgets, some widgets may be invisible. So, the correct answer is Option A.
When a window is not large enough to display all of its content, some widgets may be partially or completely hidden. The window will not automatically expand to fit all of its content, and no exception will be raised. The widgets will not be automatically scaled down to fit the window's size.
If the main window is too small to fit all its widgets, some of the widgets may not be visible or may be partially visible. This is because the main window has a fixed size, and if there are more widgets than can fit within that size, some of them will be outside the visible area of the window.
To avoid this issue, you can use layout managers such as grid, pack, or place to dynamically adjust the size and position of the widgets as the window changes size. This will ensure that all the widgets remain visible and properly arranged regardless of the size of the main window.
References:
* https://www.tkdocs.com/tutorial/widgets.html#managers
* https://www.geeksforgeeks.org/python-tkinter-widgets/
* https://anzeljg.github.io/rin2/book2/2405/docs/tkinter/introduction.html


質問 # 29
What is true about type in the object-oriented programming sense?

  • A. It is a built-in method that allows enumeration of composite objects
  • B. It is the bottommost type that any object can inherit from.
  • C. It is an object used to instantiate a class
  • D. It is the topmost type that any class can inherit from

正解:D

解説:
Explanation
In Python, type is the built-in metaclass that serves as the base class for all new-style classes. All new-style classes in Python, including built-in types like int and str, are instances of the type metaclass and inherit from it.


質問 # 30
What will be the content of the co/ors.csv filewhen you run the following code?

A)

B)

C)

D)
An exception will be raised.

  • A. Option A
  • B. Option D
  • C. Option B
  • D. Option C

正解:C


質問 # 31
Analyze the following snippet and decide whether the code is correct and/or which method should be distinguished as a class method.

  • A. There is only one initializer, so there is no need for a class method.
  • B. The code is erroneous.
  • C. The getNumberofCrosswords () method should be decorated With @classmethod.
  • D. The gexNumberOfcrosswords () and issrived methods should be decorated with @classzoechod.

正解:C

解説:
Explanation
The correct answer is B. The getNumberofCrosswords() method should be decorated with @classmethod. In the given code snippet, the getNumberofCrosswords method is intended to be a class method that returns the value of the numberofcrosswords class variable. However, the method is not decorated with the @classmethod decorator and does not take a cls parameter representing the class itself. To make getNumberofCrosswords a proper class method, it should be decorated with @classmethod and take a cls parameter as its first argument.
The getNumberofCrosswords() method should be decorated with @classmethod.
This is because the getNumberofCrosswords() method is intended to access the class-level variable numberofcrosswords, but it is defined as an instance method, which requires an instance of the class to be created before it can be called. To make it work as a class-level method, you can define it as a class method by adding the @classmethod decorator to the function.
Here's an example of how to define getNumberofCrosswords() as a class method:
classCrossword:
numberofcrosswords =0
def __init__(self, author, title):
self.author = author
self.title = title
Crossword.numberofcrosswords +=1
@classmethod
defgetNumberofCrosswords(cls):
returncls.numberofcrosswords
In this example, getNumberofCrosswords() is defined as a class method using the @classmethod decorator, and the cls parameter is used to access the class-level variable numberofcrosswords.


質問 # 32
Select the true statements about the sqirte3 module. (Select two answers.)

  • A. The sqhte3 module does not support transactions.
  • B. The fetchall method returns an empty list when no rows are available
  • C. The special name memory is used to create a database in RAM.
  • D. The sqlite3 module provides an interface compliant with the DB-API 2.0.

正解:C、D

解説:
Explanation
The sqlite3 module in python provides an interface compliant to the DB-API 2.0. Thus, it follows a standard performance metric that allows for consistency in database programming with python.
The special name 'memory' is used to create a database in RAM using the sqlite3 module. Thus, when you use it as the name of the database file while opening a connection, it creates a temporary database that exists only in memory.


質問 # 33
What isa___traceback___?
(Select two answers )

  • A. An attribute owned by every exception object
  • B. An attribute that holds interesting information that is particularly useful when the programmer wants to store exception details in other objects
  • C. An attribute that is added to every object when the traceback module is imported
  • D. A special method delivered by the traceback module to retrieve a full list of strings describing thetraceback

正解:A、B

解説:
Explanation
The correct answers are A. An attribute owned by every exception object and D. An attribute that holds interesting information that is particularly useful when the programmer wants to store exception details in other objects. A traceback is an attribute of an exception object that contains a stack trace representing the call stack at the point where the exception was raised. The traceback attribute holds information about the sequence of function calls that led to the exception, which can be useful for debugging and error reporting.


質問 # 34
What is ElementTree?

  • A. A Python built-in module that contains functions used for parsing and creating XML data.
  • B. A Python library that contains functions and tools used for manipulating text files in GUI Programming.
  • C. A Python library that contains an API used for parsing and manipulating JSON files.
  • D. A Python built-in module that contains functions used for creating HTML files.

正解:A

解説:
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.


質問 # 35
Select the true statements related to PEP 8 programming recommendations for code writing. (Select two answers:)

  • A. You should make object type comparisons using the ismstanceQ method (e.g. if isinstance (obj, int) :) instead of comparing types directly (eg if type(obj) is type(i)).
  • B. You should write code in a way that favors the CPython implementation over PyPy, Cython. and Jython.
  • C. You should use the not ... is operator (e.g. if not spam is None:), rather than the is not operator (e.g.if spam is notNone:), to increase readability.
  • D. You should not write string literals that rely on significant trailing whitespaces as they may be visually indistinguishable, and certain editors may trim them

正解:A、D

解説:
Explanation
The two true statements related to PEP 8 programming recommendations for code writing are Option B and Option D.
Option B is true because PEP 8 recommends making object type comparisons using the isinstance() method instead of comparing types directly 1.
Option D is true because PEP 8 recommends not writing string literals that rely on significant trailing whitespaces as they may be visually indistinguishable, and certain editors may trim them 1.


質問 # 36
What is true about the invocation of the cget () method?

  • A. It has the same effect as the config () method.
  • B. It can be used to set new values to widget attributes.
  • C. It can be replaced with a dictionary-like access manner.
  • D. It can be used to read widget attributes.

正解:D

解説:
Explanation
The cget() method in Python is used to read the configuration options of a widget in Tkinter. It retrieves the value of a specified configuration option for a Tkinter widget. Hence, option A is the correct answer.


質問 # 37
Select the true statements about sockets. (Select two answers)

  • A. A socket can be used to establish a communication endpoint for processes running on the same or different machines.
  • B. A socket is a connection point that enables a two-way communication between programs running in a network.
  • C. A socket is always the secure means by which computers on a network can safely communicate, without the risk of exposure to an attack
  • D. A socket is a connection point that enables a one-way communication only between remote processes

正解:A、B

解説:
Explanation
A socket is a connection point that enables a two-way communication between programs running in a network.
This statement is true because a socket is a software structure that serves as an endpoint for sending and receiving data across a network. A socket is defined by an application programming interface (API) for the networking architecture, such as TCP/IP. A socket can be used to establish a communication channel between two programs running on the same or different network nodes12.
A socket is always the secure means by which computers on a network can safely communicate, without the risk of exposure to an attack.
This statement is false because a socket by itself does not provide any security or encryption for the data transmitted over the network. A socket can be vulnerable to various types of attacks, such as eavesdropping, spoofing, hijacking, or denial-of-service. To ensure secure communication, a socket can use additional protocols or mechanisms, such as SSL/TLS, SSH, VPN, or firewall3.
A socket is a connection point that enables a one-way communication only between remote processes.
This statement is false because a socket can enable both one-way and two-way communication between processes running on the same or different network nodes. A socket can be used for connection-oriented or connectionless communication, depending on the type of protocol used. For example, TCP is a connection-oriented protocol that provides reliable and bidirectional data transfer, while UDP is a connectionless protocol that provides unreliable and unidirectional data transfer12.
A socket can be used to establish a communication endpoint for processes running on the same or different machines.
This statement is true because a socket can be used for inter-process communication (IPC) within a single machine or across different machines on a network. A socket can use different types of addresses to identify the processes involved in the communication, such as IP address and port number for network sockets, or file name or path for Unix domain sockets12.
References:
1: https://en.wikipedia.org/wiki/Network_socket 2:
https://www.geeksforgeeks.org/socket-in-computer-network/ 3:
https://www.tutorialspoint.com/what-is-a-network-socket-computer-networks


質問 # 38
Select the true statements about the connection-oriented and connectionless types of communication. (Select two answers.)

  • A. In the context of TCP/IP networks, the communication side that initiates a connection is called the client, whereas the side that answers the client is called the server
  • B. Using walkie-talkies is an example of a connection-oriented communication
  • C. Connectionless communications are usually built on top of TCP
  • D. A phone call is an example of a connection-oriented communication

正解:A、D

解説:
Explanation
In the context of TCP/IP networks, the communication side that initiates a connection is called the client, whereas the side that answers the client is called the server.
This statement is true because TCP/IP networks use a client-server model to establish connection-oriented communications. The client is the device or application that requests a service or resource from another device or application, which is called the server. The server responds to the client's request and provides the service or resource.For example, when you browse a website using a web browser, the browser acts as a client and sends a request to the web server that hosts the website. The web server acts as a server and sends back the requested web page to the browser1.
Connectionless communications are usually built on top of TCP.
This statement is false because TCP (Transmission Control Protocol) is a connection-oriented protocol that requires establishing and terminating a connection before and after sending data. Connectionless communications are usually built on top of UDP (User Datagram Protocol), which is a connectionless protocol that does not require any connection setup or teardown. UDP simply sends data packets to the destination without checking if they are received or not2.
Using walkie-talkies is an example of a connection-oriented communication.
This statement is false because using walkie-talkies is an example of a connectionless communication.
Walkie-talkies do not establish a dedicated channel or connection between the sender and receiver before transmitting data. They simply broadcast data over a shared frequency without ensuring that the receiver is ready or available to receive it. The sender does not know if the receiver has received the data or not3.
A phone call is an example of a connection-oriented communication.
This statement is true because a phone call is an example of a connection-oriented communication. A phone call requires setting up a circuit or connection between the caller and callee before exchanging voice data. The caller and callee can hear each other's voice and know if they are connected or not. The phone call also requires terminating the connection when the conversation is over4.
References:
1: https://www.techtarget.com/searchnetworking/definition/client-server 2:
https://www.javatpoint.com/connection-oriented-vs-connectionless-service 3:
https://en.wikipedia.org/wiki/Walkie-talkie 4: https://en.wikipedia.org/wiki/Telephone_call A is true because in the context of TCP/IP networks, the communication side that initiates a connection is called the client, and the side that answers the client is called the server. This is the basis for establishing a connection-oriented communication.
D is true because a phone call is an example of a connection-oriented communication. Like TCP/IP, a phone call establishes a connection between two devices (in this case, two phones) before communication can occur.
A is true because in the context of TCP/IP networks, the communication side that initiates a connection is called the client, and the side that answers the client is called the server. This is the basis for establishing a connection-oriented communication.
D is true because a phone call is an example of a connection-oriented communication. Like TCP/IP, a phone call establishes a connection between two devices (in this case, two phones) before communication can occur.
B is false because connectionless communications are usually built on top of UDP, not TCP. UDP is a connectionless protocol that does not establish a connection before sending data.
C is false because using walkie-talkies is an example of a connectionless communication. Walkie-talkies do not establish a connection before communication begins, and messages are simply broadcasted to all devices within range.
Here is a sample code in Python using the socket module to create a TCP server and client to demonstrate the connection-oriented communication:
Server-side code:
importsocket
HOST ='127.0.0.1'
PORT =8080
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.bind((HOST, PORT))
s.listen()
conn, addr = s.accept()
with conn:
print('Connected by', addr)
whileTrue:
data = conn.recv(1024)
ifnotdata:
break
conn.sendall(data)
Client-side code:
importsocket
HOST ='127.0.0.1'
PORT =8080
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.connect((HOST, PORT))
s.sendall(b'Hello, world')
data = s.recv(1024)
print('Received',repr(data))
The server listens for incoming connections on port 8080, and when a connection is established, it prints the address of the client that has connected. The server then continuously receives data from the client and sends it back to the client until the connection is closed.
The client establishes a connection with the server and sends the message "Hello, world" encoded as bytes. It then waits for a response from the server and prints the data it receives.


質問 # 39
Select the true statement about the socket. gaierror exception.

  • A. It is raised when a system function returns a system-related error.
  • B. It is raised when an address-related error caused by the getaddrinfo () and getnameinfo () functions occurs.
  • C. It is raised when an address-related error caused by the repr () function occurs.
  • D. It is raised when a timeout occurs on a socket.

正解:B

解説:
Explanation
The socket.gaierror exception is raised when an address-related error caused by the getaddrinfo() and getnameinfo() functions occurs. These functions are used to translate hostnames to IP addresses and vice versa, and the gaierror exception is raised if they fail to perform this translation.


質問 # 40
Select the true statements about the sqlite3 module. (Select two answers.)

  • A. The execute method allows you to perform several queries at once
  • B. The execute method is provided by the Cursor class
  • C. The fetchalt method returns None when no rows are available
  • D. The fetchone method returns None when no rows are available

正解:B、D

解説:
Explanation
The execute method is provided by the Cursor class
This statement is true because the execute method is one of the methods of the Cursor class in the sqlite3 module. The Cursor class represents an object that can execute SQL statements and fetch results from a database connection. The execute method takes an SQL query as an argument and executes it against the database. For example, cur = conn.cursor (); cur.execute ("SELECT * FROM table") creates and executes a cursor object that selects all rows from a table.
The fetchone method returns None when no rows are available
This statement is true because the fetchone method is another method of the Cursor class in the sqlite3 module.
The fetchone method fetches the next row of a query result set and returns it as a single tuple or None if no more rows are available. For example, row = cur.fetchone () fetches and returns one row from the cursor object or None if there are no more rows.


質問 # 41
Select the true statement about the socket. gaierror exception.

  • A. It is raised when a system function returns a system-related error.
  • B. It is raised when an address-related error caused by the getaddrinfo () and getnameinfo () functions occurs.
  • C. It is raised when an address-related error caused by the repr () function occurs.
  • D. It is raised when a timeout occurs on a socket.

正解:B

解説:
Explanation
The socket.gaierror exception is raised when an address-related error caused by the getaddrinfo() and getnameinfo() functions occurs. These functions are used to translate hostnames to IP addresses and vice versa, and the gaierror exception is raised if they fail to perform this translation.


質問 # 42
Look at the following code snippets and decide which ones follow PEP 8 recommendations for whitespacesin expressions and statements(Select two answers.)

  • A. No whitespace immediately before the opening parenthesis that starts the list of arguments of a function call:
  • B. A whitespace immediately after the opening parenthesis that starts indexing or slicing:
  • C. A whitespace immediately before a comma,semicolon, and colon:
  • D. No whitespace between a trailing comma and a following closing parenthesis:

正解:A、D

解説:
Explanation
Option A is true because PEP 8 recommends avoiding extraneous whitespace immediately inside parentheses, brackets or braces 1.
Option C is true because PEP 8 recommends avoiding extraneous whitespace between a trailing comma and a following close parenthesis 1.


質問 # 43
......

検証済みPCPP-32-101問題集と解答で最新PCPP-32-101をダウンロード:https://www.jpntest.com/shiken/PCPP-32-101-mondaishu

無料Python Institute PCPP-32-101試験問題と解答があります:https://drive.google.com/open?id=1ijp0_KGDRXLa83lziQ7vth6srhTc6rfo

弊社を連絡する

我々は12時間以内ですべてのお問い合わせを答えます。

オンラインサポート時間:( UTC+9 ) 9:00-24:00
月曜日から土曜日まで

サポート:現在連絡