2023年05月 Python Institute PCPP-32-101実際の問題とブレーン問題集
PCPP-32-101合格させる問題集でPython Institute24時間で試験合格できます
PCPP1試験の準備には、多くの勉強と練習が必要です。Python Instituteは、試験でテストされるすべてのトピックをカバーする包括的な学習ガイドを提供しています。さらに、練習試験や学習グループなど、多数のオンラインリソースがあり、個人が試験の準備をするのに役立ちます。
PCPP1認定試験は、Pythonプログラミングに精通したいプログラマーやソフトウェア開発者にとって、重要な資格です。また、Pythonプログラミングを扱うために必要な知識とスキルを持つ候補者を特定するための優れた手段でもあります。この試験は、選択式とインタラクティブなコーディング問題の組み合わせで構成され、オンラインで実施されます。試験に合格した候補者は、スキルや知識を潜在的な雇用主に示すために使用できるデジタルバッジを受け取ることができます。
質問 # 10
Analyze the following snippet and select the statement that best describes it.
- A. The *arg parameter holds a list of unnamed parameters
- B. The code is syntactically correct despite the fact that the names of the function parameters do not follow the naming convention
- C. The code is missing a placeholder for unnamed parameters.
- D. The code is syntactically incorrect - the function should be defined as def f1 (*args, **kwargs)
正解:A
解説:
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.
質問 # 11
What is true about the invocation of the cget () method?
- A. It can be used to set new values to widget attributes.
- B. It can be replaced with a dictionary-like access manner.
- C. It can be used to read widget attributes.
- D. It has the same effect as the config () method.
正解:C
解説:
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.
質問 # 12
Analyze the following snippet and choose the best statement that describes it.
- A. varl is the name of a global variable
- B. self. name is the name of a class variable.
- C. Excalibur is the value passed to an instance variable
- D. Weapon is the value passed to an instance variable
正解:C
解説:
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.
質問 # 13
What is a static method?
- A. A method decorated with the @method trait
- B. A method that requires no parameters referring to the class itself
- C. A method that works on the class itself
- D. A method that works on class objects that are instantiated
正解:B
解説:
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.
質問 # 14
Which of the following will set the button text's font to 12 point italics Anal? (Select two answers)
- A.

- B.

- C.

- D.

正解:A、C
解説:
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.
質問 # 15
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 between a trailing comma and a following closing parenthesis:

- B. No whitespace immediately before the opening parenthesis that starts the list of arguments of a function call:

- C. A whitespace immediately before a comma,semicolon, and colon:

- D. A whitespace immediately after the opening parenthesis that starts indexing or slicing:

正解:A、B
解説:
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.
質問 # 16
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. A special method delivered by the traceback module to retrieve a full list of strings describing thetraceback
- D. An attribute that is added to every object when the traceback module is imported
正解: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.
質問 # 17
Select the true statements about the sqlite3 module. (Select two answers.)
- A. The fetchalt method returns None when no rows are available
- B. The execute method is provided by the Cursor class
- C. The fetchone method returns None when no rows are available
- D. The execute method allows you to perform several queries at once
正解:B、C
解説:
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.
質問 # 18
Select the true statement about composition
- A. Composition is a concept that promotes code reusability while inheritance promotes encapsulation.
- B. Composition is based on the has a relation: so it cannot be used together with inheritance.
- C. Composition extends a class's capabilities by adding new components and modifying the existing ones.
- D. Composition allows a class to be projected as a container of different classes
正解:D
解説:
Explanation
Composition is an object-oriented design concept that models a has-a relationship. In composition, a class known as composite contains an object of another class known as component. In other words, a composite class has a component of another class1.
Composition allows a class to be projected as a container of different classes.
Composition is a concept in Python that allows for building complex objects out of simpler objects, by aggregating one or more objects of another class as attributes. The objects that are aggregated are generally considered to be parts of the whole object, and the containing object is often viewed as a container for the smaller objects.
In composition, objects are combined in a way that allows for greater flexibility and modifiability than what inheritance can offer. With composition, it is possible to create new objects by combining existing objects, by using a container object to host other objects. By contrast, with inheritance, new objects extend the behavior of their parent classes, and are limited by that inheritance hierarchy.
References:
* Official Python documentation on
Composition: https://docs.python.org/3/tutorial/classes.html#composition
* GeeksforGeeks article on Composition vs
Inheritance: https://www.geeksforgeeks.org/composition-vs-inheritance-python/
* Real Python article on Composition and
Inheritance: https://realpython.com/inheritance-composition-python/
質問 # 19
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. The function is erroneous.
- C. It is an example of decorator stacking.
- D. It is an example of a decorator that can trigger an infinite recursion.
正解: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".
質問 # 20
What is true about the unbind_all () method?
(Select two answers.)
- A. It causes all the widgets to disappear
- B. It is parameterless
- C. It can be invoked from the main window widget only
- D. It can be invoked from any widget
正解:B、D
解説:
Explanation
The unbind_all() method in Tkinter is used to remove all event bindings from a widget. It is a method of the widget object and can be called on any widget in the Tkinter application. Therefore, option A is the correct answer.
Option B is incorrect because the method can be called on any widget, not just the main window widget.
Option C is correct as unbind_all() does not take any parameters.
Option D is incorrect because the method only removes event bindings and does not cause the widgets to disappear.
So, the correct answers are A and C.
References:
* Tkinter documentation: https://docs.python.org/3/library/tkinter.html#event-bindings
* Tkinter tutorial: https://www.python-course.eu/tkinter_events_binds.php
質問 # 21
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 D
- B. Option A
- C. Option C
- D. Option B
正解:D
質問 # 22
What is the result of the following code?
What is the result of the following code?
- A. Loading data...
- B. Debugging mode has been enabled Loading data...
- C. Nothing will be displayed
- D. Debugging mode has been enabled
正解:A
解説:
Explanation
This statement is true because the code uses the logging module to create a logger object and set its level to logging.INFO. The logging module provides a way of reporting events that occur during the execution of a program. The logging level determines which events are reported and which are ignored. The logging module defines five levels of severity: DEBUG, INFO, WARNING, ERROR, and CRITICAL. The lower the level, the more events are reported.
The code then uses the logger object to log two messages: one with the level logging.DEBUG and one with the level logging.INFO. The logger object only reports the messages that have a level equal or higher than its own level. Therefore, the message with the level logging.DEBUG is ignored, while the message with the level logging.INFO is reported. The default format for reporting messages is "level name: message". Therefore, the output of the code is:
INFO: Loading data...
質問 # 23
Look at the following examples of comments and docstrings in PythonSelect the ones that are useful and compliant with PEP 8 recommendations (Select the two best answers.) A)
- A.

- B.

- C.

- D.

正解:B、C
解説:
Explanation
According to PEP 8 recommendations, the two best options are Option B and Option D.
Option B follows PEP 8's suggestion that all lines should be limited to 79 characters and for longer blocks of text like docstrings or comments, the length should be limited to 72 characters1. Option D follows PEP 8's conventions for writing good documentation strings (a.k.a. "docstrings") which are immortalized in PEP
257. It suggests writing docstrings for all public modules, functions, classes, and methods2.
質問 # 24
Select the true statement related to PEP 257.
- A. String literals that occur immediately after another docstring are called attribute docstrings.
- B. Attribute docstrings and Additional docstrings are two types of extra docstrings that can be extracted by software tools.
- C. 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
- D. String literals that occur immediately after a simple assignment at the top level of a module are called complementary docstrings
正解:B
解説:
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.
質問 # 25
Select the true statement about PEP 8 recommendations related to line breaks and binary operators.
- A. It is recommended that you use line breaks after binary operators to improve code readability.
- B. 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.
- C. There is no specific PEP 8 recommendation related to using line breaks with binary operators.
- D. It is recommended that you use line breaks before binary operators to improve code readability.
正解:D
解説:
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/
質問 # 26
What is ElementTree?
- A. A Python built-in module that contains functions used for creating HTML files.
- B. A Python library that contains an API used for parsing and manipulating JSON files.
- C. A Python built-in module that contains functions used for parsing and creating XML data.
- D. A Python library that contains functions and tools used for manipulating text files in GUI Programming.
正解:C
解説:
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.
質問 # 27
Select the true statements about the json.-dumps () function. (Select two answers.)
- A. It returns a JSON string.
- B. It takes Python data as its argument.
- C. It returns a Python entity.
- D. It takes a JSON string as its argument
正解:A、B
解説:
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.
質問 # 28
......
PCPP1認定は、個人がPythonプログラミングの熟練度を証明するための優れた方法です。これは、Pythonコミュニティ内で高く評価されている世界的に認知された資格です。この認定は、プロフェッショナルなPythonプログラマーになるために必要な基礎知識を個人に提供し、Pythonプログラミングの分野でキャリアを進めるための優れた方法です。
最新問題をダウンロードPCPP-32-101問題集で2023年最新のPCPP-32-101試験問題集:https://jp.fast2test.com/PCPP-32-101-premium-file.html