2023年10月30日更新されたPCPP-32-101トレーニング最新認定問題をゲットPython Institute PCPP合格目指せ [Q11-Q33]

Share

2023年10月30日更新されたPCPP-32-101トレーニング最新認定問題をゲットPython Institute PCPP合格目指せ

認定トレーニングPCPP-32-101試験問題集でテストエンジン


試験のコーディングセクションでは、受験者はPythonコードを使用して現実世界の問題を解決する必要があります。受験者は、Python構文、データ型、データ構造、制御フロー、関数、およびファイルの入出力の知識を証明することが期待されています。試験の選択式セクションでは、受験者のPythonのコンセプトと原則の理解度が評価されます。


PCPP1試験に合格すると、候補者はPythonプログラミングの能力と能力を証明するものとして、世界的に認知されている「Certified Professional in Python Programming 1(PCPP1)」の称号を受け取ります。この認定は、Pythonプログラミングの需要が世界的に高まっているため、候補者がより良いキャリアの機会や高い給与を確保するのに役立つ貴重な資産です。

 

質問 # 11
If w is a correctly created main application window, which method would you use to foe both of the main window's dimensions?

  • A. w. f ixshape ()
  • B. w. resizable ()
  • C. w. f ixdim ()
  • D. w.makewindow ()

正解:B

解説:
Explanation
w.resizable()
The resizable() method takes two Boolean arguments, width and height, that specify whether the main window can be resized in the corresponding directions. Passing False to both arguments makes the main window non-resizable, whereas passing True to both arguments (or omitting them) makes the window resizable.
Here is an example that sets the dimensions of the main window to 500x400 pixels and makes it non-resizable:
importtkinter as tk
root = tk.Tk()
root.geometry("500x400")
root.resizable(False, False)
root.mainloop()
References:
* Tkinter documentation: https://docs.python.org/3/library/tk.html
* Tkinter tutorial: https://www.python-course.eu/python_tkinter.php
The resizable () method of a tkinter window object allows you to specify whether the window can be resized by the user in the horizontal and vertical directions. You can pass two boolean arguments to this method, such as w.resizable (False, False), to prevent both dimensions from being changed. Alternatively, you can pass 0 or
1 as arguments, such as w.resizable (0, 0), to achieve the same effect1.
References:
1: https://stackoverflow.com/questions/36575890/how-to-set-a-tkinter-window-to-a-constant-size Other methods that can be used to control the window size are:
* w.geometry () : This method allows you to set the initial size and position of the window by passing a string argument in the format "widthxheight+x+y", such as w.geometry ("500x500+100+100")12.
* w.minsize () and w.maxsize (): These methods allow you to set the minimum and maximum size of the window in pixels, such as w.minsize (500, 500) and w.maxsize (1000, 1000)12.
* w.pack_propagate () and w.grid_propagate (): These methods allow you to enable or disable the propagation of the size of the widgets inside the window to the window itself. By default, these methods are set to True, which means that the window will adjust its size according to the widgets it contains.
You can set these methods to False or 0 to prevent this behavior, such as w.pack_propagate (0) or w.grid_propagate (0).
* w.place (): This method allows you to place the window at a specific position and size relative to its parent window or screen. You can use keyword arguments such as x, y, width, height, relx, rely, relwidth, and relheight to specify the coordinates and dimensions of the window in absolute or relative terms, such as w.place (x=0, y=0, relwidth=1, relheight=1).
References:
2: https://stackoverflow.com/questions/25690423/set-window-dimensions-in-tkinter-python-3 :
https://stackoverflow.com/questions/36575890/how-to-set-a-tkinter-window-to-a-constant-size/36576068#36576
https://www.skotechlearn.com/2020/06/tkinter-window-position-size-center-screen-in-python.html


質問 # 12
Select the true statement about the___name___attribute.

  • A. ___name is a special attribute, which is inherent for both classes and instances, and it contains a dictionary of object attributes.
  • B. __name___is a special attribute, which is inherent for classes and it contains information about the class to which a class instance belongs.
  • C. __name___is a special attribute, which is inherent for classes, and it contains the name of a class.
  • D. ___name___is a special attribute, which is inherent for both classes and instances, and it contains information about the class to which a class instance belongs.

正解:C

解説:
Explanation
The true statement about the __name__ attribute is D. name is a special attribute, which is inherent for classes, and it contains the name of a class. The __name__ attribute is a special attribute of classes that contains the name of the class as a string.
The __name__ attribute is a special attribute in Python that is available for all classes, and it contains the name of the class as a string. The __name__ attribute can be accessed from both the class and its instances using the dot notation.


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

  • A. It is raised when an address-related error caused by the getaddrinfo () and getnameinfo () functions occurs.
  • B. It is raised when a system function returns a system-related error.
  • 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.

正解:A

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


質問 # 14
Which of the following examples using line breaks and different indentation methods are compliant with PEP
8 recommendations? (Select two answers.)

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

正解:B、C

解説:
Explanation
The correct answers are B. Option B and D. Option D. Both options B and D are compliant with PEP 8 recommendations for line breaks and indentation. PEP 8 recommends using 4 spaces per indentation level and breaking lines before binary operators. In option B, the arguments to the print function are aligned with the opening delimiter, which is another acceptable way toformat long lines according to PEP 8. In option D, the second line is indented by 4 spaces to distinguish it from the next logical line.


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

  • A. It can be used to read widget attributes.
  • 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 has the same effect as the config () method.

正解:A

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


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

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

正解:A

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


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

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

正解:C、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.


質問 # 18
What is ElementTree?

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

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


質問 # 19
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 fetchalt method returns None when no rows are available
  • C. The execute method is provided by the Cursor class
  • D. The fetchone method returns None when no rows are available

正解:C、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.


質問 # 20
Select the true statement related to PEP 257.

  • A. String Iiterals that occur in places other than the first statement in a module, function, or class definition can act as documentation They are recognized by the Python bytecode compiler and are accessible as runtime object attributes
  • B. String literals that occur immediately after a simple assignment at the top level of a module are called complementary docstrings
  • C. String literals that occur immediately after another docstring are called attribute docstrings.
  • D. Attribute docstrings and Additional docstrings are two types of extra docstrings that can be extracted by software tools.

正解:D

解説:
Explanation
The true statement related to PEP 257 is Option B. According to PEP 257, string literals occurring elsewhere in Python code may also act as documentation. They are not recognized by the Python bytecode compiler and are not accessible as runtime object attributes (i.e. not assigned to doc), but two types of extra docstrings may be extracted by software tools: String literals occurring immediately after a simple assignment at the top level of a module, class, or init method are called "attribute docstrings". String literals occurring immediately after another docstring are called "additional docstrings"1.


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

  • A. It is raised when an address-related error caused by the getaddrinfo () and getnameinfo () functions occurs.
  • B. It is raised when a system function returns a system-related error.
  • 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.

正解:A

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


質問 # 22
If purple can be obtained from mixing red and blue, which color codes represent the two ingredients? Select two answers)

  • A. #FFFFFF
  • B. #000000
  • C. #FF0000
  • D. #0000FF

正解:C、D


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

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

正解:A、C

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


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

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

正解:A

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


質問 # 25
Which of the following will set the button text's font to 12 point italics Anal? (Select two answers)

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

正解:C、D

解説:
Explanation
Option B is correct because it sets the font option of the button to a tuple containing the font family ('Arial'), size (12), and style ('italic').
Option C is correct because it sets the font option of the button to a string containing the font family ('Arial'), size (12), and style ('italic') separated by spaces.


質問 # 26
Which of the following methods allow you to load a configuration using ConfigParser? (Select two answers.)

  • A. read_dict
  • B. read_str
  • C. read_conf
  • D. read

正解:B、D

解説:
Explanation
ConfigParser is a built-in library in Python that allows you to read and write configuration files. The read method is used to read the configuration file which can be in any of the supported file formats, such as INI, YAML, and JSON. The read_dict method is used to read the configuration from a Python dictionary. The read_conf and read_str options are not valid methods in the ConfigParser module.
Therefore, the correct options to load a configuration using ConfigParser are A. read and D. read_string.


質問 # 27
Analyze the following function and choose the statement that best describes it.

  • A. It is an example of a decorator that accepts its own arguments.
  • B. It is an example of a decorator that can trigger an infinite recursion.
  • C. It is an example of decorator stacking.
  • D. The function is erroneous.

正解:A

解説:
Explanation
In the given code snippet, the repeat function is a decorator that takes an argument num_times specifying the number of times the decorated function should be called. The repeat function returns an inner function wrapper_repeat that takes a function func as an argument and returns another inner function wrapper that calls func num_times times.
The provided code snippet represents an example of a decorator that accepts its own arguments.
The @decorator_function syntax is used to apply the decorator_function to the some_function function.
The decorator_function takes an argument arg1 and defines an inner function wrapper_function that takes the original function func as its argument. The wrapper_function then returns the result of calling func, along with the arg1 argument passed to the decorator_function.
Here is an example of how to use this decorator with some_function:
@decorator_function("argument 1")
defsome_function():
return"Hello world"
When some_function is called, it will first be passed as an argument to the decorator_function.
The decorator_function then adds the string "argument 1" to the result of calling some_function() and returns the resulting string. In this case, the final output would be "Hello world argument 1".


質問 # 28
What is a static method?

  • A. A method that works on the class itself
  • B. A method decorated with the @method trait
  • C. A method that requires no parameters referring to the class itself
  • D. A method that works on class objects that are instantiated

正解:C

解説:
Explanation
A static method is a method that belongs to a class rather than an instance of the class. It is defined using the @staticmethod decorator and does not take a self or cls parameter. Static methods are often used to define utility functions that do not depend on the state of an instance or the class itself.


質問 # 29
......

合格を確定するガイドでPCPP-32-101試験準備しよう:https://www.jpntest.com/shiken/PCPP-32-101-mondaishu

弊社を連絡する

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

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

サポート:現在連絡