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

Share

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

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


PCPP1試験では、データ型、制御構造、関数、モジュール、ファイル処理、オブジェクト指向のプログラミングコンセプトなど、幅広いトピックをカバーしています。この試験では、候補者が効率的で読みやすいコードを作成する能力と、Pythonプログラミングにおけるベストプラクティスに関する知識も評価しています。この試験は、40の複数選択の質問で構成されており、75分間の期間があります。

 

質問 # 25
Which one of the following methods allows you to debug an XML tree in the xml.etree ELementTree module?

  • A. debug
  • B. parse
  • C. dump
  • D. log

正解:C

解説:
Explanation
The dump() method in the xml.etree.ElementTree module allows you to output a debug representation of an XML tree to a file or standard output. This method is useful for analyzing the structure of the tree and tracking down errors.


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

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

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


質問 # 27
Select the true statement about PEP 8 recommendations related to line breaks and binary operators.

  • A. There is no specific PEP 8 recommendation related to using line breaks with binary operators.
  • B. It is recommended that you use line breaks before binary operators to improve code readability.
  • C. It is recommended that you use line breaks after binary operators to improve code readability.
  • D. It is permissible to use line breaks before or after a binary operator as long as the convention is consistent locally However, for new code it is recommended that break lines should be used only after binary operators.

正解:B

解説:
Explanation
According to PEP 8, Python's official style guide, line breaks before binary operators produce more readable code, especially in code blocks with long expressions. This is stated in several sources (1,2,6,8) and is a widely accepted convention.
References:
* https://www.python.org/dev/peps/pep-0008/#should-a-line-break-before-or-after-a-binary-operator
* https://stackoverflow.com/questions/30614124/are-long-lines-broken-up-before-or-after-binary-operators-
* https://www.quora.com/What-is-PEP-8-Python
* https://www.techbeamers.com/python-tutorial-pep-8/
* https://www.section.io/engineering-education/python-coding-conventions-guidelines-for-python-programm
* https://towardsdatascience.com/a-step-in-pep8-style-guide-improving-the-readability-of-the-code-8114fd4
* https://www.codementor.io/@rishikeshdhokare/python-coding-style-best-practices-that-every-python-prog
* https://www.dataschool.io/python-pep8-tips-and-tricks/


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

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

正解:B、C

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


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

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

正解:D

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


質問 # 30
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.

正解:A、B

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


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

  • A. String literals that occur immediately after a simple assignment at the top level of a module are called complementary docstrings
  • B. String literals that occur immediately after another docstring are called attribute docstrings.
  • C. Attribute docstrings and Additional docstrings are two types of extra docstrings that can be extracted by software tools.
  • D. 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

正解:C

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


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

  • A. You should not write string literals that rely on significant trailing whitespaces as they may be visually indistinguishable, and certain editors may trim them
  • B. 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.
  • C. You should write code in a way that favors the CPython implementation over PyPy, Cython. and Jython.
  • D. 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)).

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


質問 # 33
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 the name of a class.
  • C. ___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.
  • D. __name___is a special attribute, which is inherent for classes and it contains information about the class to which a class instance belongs.

正解:B

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


質問 # 34
Analyze the following snippet and choose the best statement that describes it.

  • A. Weapon is the value passed to an instance variable
  • B. Excalibur is the value passed to an instance variable
  • C. varl is the name of a global variable
  • D. self. name is the name of a class variable.

正解:B

解説:
Explanation
The correct answer is C. Excalibur is the value passed to an instance variable. In the given code snippet, self.name is an instance variable of the Sword class. When an instance of the Sword class is created with varl = Sword('Excalibur'), the value 'Excalibur' is passed as an argument to the __init__ method and assigned to the name instance variable of the varl object.
The code defines a class called Sword with an __init__ method that takes one parameter name. When a new instance of the Sword class is created with varl = Sword('Excalibur'), the value of the 'Excalibur' string is passed as an argument to the __init__ method, and assigned to the self.name instance variable of the varl object.


質問 # 35
Which of the following constants will be used if you do riot define the quoting argument in the writer method provided by the csv module?

  • A. csv.QUOTE_NONNUMERIC
  • B. svQUOTE_ALL
  • C. csv.QUOTE_NONE
  • D. csv.QUOTE_MINIMAL

正解:D

解説:
Explanation
If you do not define the quoting argument in the writer method provided by the csv module, the default quoting behavior is set to QUOTE_MINIMAL. This means that fields containing special characters such as the delimiter or newline character will be quoted, while fields that do not contain special characters will not be quoted.


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

  • A. It is raised when a timeout occurs on a socket.
  • 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 getaddrinfo () and getnameinfo () functions occurs.
  • D. It is raised when an address-related error caused by the repr () function occurs.

正解:C

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


質問 # 37
What does the term deserialization mean? Select the best answer.

  • A. It is a process of assigning unique identifiers to every newly created Python object
  • B. It is another name for the data transmission process
  • C. It is a process of converting the structure of an object into a stream of bytes
  • D. It is a process of creating Python objects based on sequences of bytes.

正解:D

解説:
Explanation
answer A. Deserialization is the process of converting data that has been serialized or encoded in a specific format, back into its original form as an object or a data structure in memory. In Python, this typically involves creating Python objects based on sequences of bytes that have been serialized using a protocol such as JSON, Pickle, or YAML.
For example, if you have a Python object my_obj and you want to serialize it to a JSON string, you might do something like this:
importjson
serialized_obj = json.dumps(my_obj)
To deserialize the JSON string back into a Python object, you would use the json.loads() method:
deserialized_obj = json.loads(serialized_obj)
This would convert the JSON string back into its original Python object form.


質問 # 38
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.


質問 # 39
Analyze the code and choose the best statement that describes it.

  • A. ___ne___() is not a built-in special method
  • B. The code is erroneous
  • C. The code is responsible for the support of the negation operator e.g. a = - a.
  • D. The code is responsible for the support of the inequality operator i.e. i =

正解:D

解説:
Explanation
The correct answer is D. The code is responsible for the support of the inequality operator i.e. i != j. In the given code snippet, the __ne__ method is a special method that overrides the behavior of the inequality operator != for instances of the MyClass class. When the inequality operator is used to compare two instances of MyClass, the __ne__ method is called to determine whether the two instances are unequal.


質問 # 40
A socket object is usually created by which one of the following invocations?

  • A. socket = socket.socket(server address)
  • B. socket = socket. socket (socket_domain, socket_type, server_address)
  • C. socket = socket. socket (socket_number)
  • D. socket. socket (socket_domain, socket_type)

正解:D

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


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

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

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


質問 # 42
The following snippet represents one of the OOP pillars Which one is that?

  • A. Serialization
  • B. Inheritance
  • C. Polymorphism
  • D. Encapsulation

正解:D

解説:
Explanation
The given code snippet demonstrates the concept of encapsulation in object-oriented programming.
Encapsulation refers to the practice of keeping the internal state and behavior of an object hidden from the outside world and providing a public interface for interacting with the object. In the given code snippet, the __init__ and get_balance methods provide a public interface for interacting with instances of the BankAccount class, while the __balance attribute is kept hidden from the outside world by using a double underscore prefix.


質問 # 43
......

合格を確定するガイドでPCPP-32-101試験準備しよう:https://www.passtest.jp/Python-Institute/PCPP-32-101-shiken.html

Python Institute PCPP PCPP-32-101無料最新のリアル試験問題と回答:https://drive.google.com/open?id=1b0I6PgIH-9GAQ2zZDJhyImsgZdkna0tf