What does the term deserialization mean? Select the best answer.
It is a process of creating Python objects based on sequences of bytes.
It is a process of assigning unique identifiers to every newly created Python object
It is another name for the data transmission process
It is a process of converting the structure of an object into a stream of bytes
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:
import json
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.
What is true about the unbind_all () method?
(Select two answers.)
It can be invoked from any widget
It can be invoked from the main window widget only
It is parameterless
It causes all the widgets to disappear
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.
Select the true statements related to PEP 8 naming conventions. (Select two answers.)
Class names should use the mixedCase naming style.
Exception names should follow the function naming conventions.
Modules should have short names entirely in lower-case.
You should never use the characters “l” (lower-case letter “el”) and “O” (upper-case letter “oh”) as single character variable names.
The correct answers are C and D. PEP 8 recommends that module names should be short and entirely lower-case; underscores may be used only when they improve readability. This keeps imports clean and predictable. PEP 8 also warns against using the single-character variable names l, O, or I because they can be visually confused with 1 and 0 in many fonts. Option A is incorrect because Python class names should normally use the CapWords convention, not mixedCase. Option B is incorrect because exception names are class names and should follow class naming conventions; if the exception represents an error, the name should usually end with Error.
Analyze the following function and choose the statement that best describes it.

It is an example of a decorator that accepts its own arguments.
It is an example of decorator stacking.
It is an example of a decorator that can trigger an infinite recursion.
The function is erroneous.
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" )
def some_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" .
Select the true statement about PEP 8 recommendations related to line breaks and binary operators.
It is recommended that you use line breaks before binary operators to improve code readability.
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.
It is recommended that you use line breaks after binary operators to improve code readability.
There is no specific PEP 8 recommendation related to using line breaks with binary operators.
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.
Which of the following examples using line breaks and different indentation methods are compliant with PEP 8 recommendations? (Select two answers.)
my_dict = {
"X": "180.A",
"Y": "206.P",
"Z": "12.C"
}
spam = my_function(arg_one,
arg_two,
arg_three,
arg_four)
foo = my_function
(arg_one, arg_two,
arg_three, arg_four
)
my_dict = { "A" : "1", "B" : "2", "C" : "1" }
The correct answers are A and B. Option A uses a clean multi-line dictionary layout, placing each key-value pair on its own line and aligning the closing brace clearly. This is readable and consistent with PEP 8’s preference for clear continuation formatting. Option B is also compliant because continuation lines are aligned with the opening delimiter of the function call, which is an accepted PEP 8 style. Option C is not compliant because the function call is split awkwardly, making the call structure unclear and damaging readability. Option D uses unnecessary spaces inside braces and around dictionary colons; PEP 8 discourages extraneous whitespace in expressions and dictionary displays.
What is ElementTree?
A Python built-in module that contains functions used for creating HTML files.
A Python library that contains an API used for parsing and manipulating JSON files.
A Python library that contains functions and tools used for manipulating text files in GUI Programming.
A Python built-in module that contains functions used for parsing and creating XML data.
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.
What is true about the unbind () method? (Select two answers.)
It is invoked from within the events object
It is invoked from within a widget's object
It needs a widget's object as an argument
It needs the event name as an argument
Option B is true because the unbind() method is invoked from within a widget’s object 1 .
Option D is true because the unbind() method needs the event name as an argument 1 .
The unbind() method in Tkinter is used to remove a binding between an event and a function. It can be invoked from within a widget's object when a binding is no longer needed. The method requires the event name as an argument to remove the binding for that specific event. For example:
button = tk.Button(root, text="Click me")
button.bind(" < Button-1 > ", callback_function) # bind left mouse click event to callback_function
button.unbind(" < Button-1 > ") # remove the binding for the left mouse click event
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)

Option A
Option B
Option C
Option D
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 to format 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.
Select the true statements about sockets. (Select two answers)
A socket is a connection point that enables a two-way communication between programs running in a network.
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 socket is a connection point that enables a one-way communication only between remote processes
A socket can be used to establish a communication endpoint for processes running on the same or different machines.
A. 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 nodes 1 2 .
B. 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 firewall 3 .
C. 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 transfer 1 2 .
D. 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 sockets 1 2 .
The following JSON string:
{ 1 }
is erroneous
is an object
is an array
is an integer
The correct answer is A because { 1 } is not valid JSON syntax. In JSON, curly braces represent an object, but an object must contain name-value pairs. Property names must be strings enclosed in double quotation marks, followed by a colon and a value, such as {"id": 1}. The expression { 1 } contains a numeric value inside braces without a property name or colon, so it cannot be parsed as a JSON object. It is also not an array, because JSON arrays use square brackets, such as [1]. It is not an integer either, because the braces change the syntax. Therefore, this JSON string is erroneous.
Which of the following statements related to :memory: are true?
(Select two answers.)
:memory: is a special name for loading a database from a file to the RAM.
You can use :memory: to delete a specific database that resides in the RAM.
You can use :memory: to establish a database connection.
:memory: is a special name for creating a temporary database in the RAM.
The correct answers are C and D. In Python’s sqlite3 module, the string ':memory:' is passed to sqlite3.connect() to create an in-memory SQLite database. This establishes a valid database connection, but the database exists only in RAM and normally disappears when the connection is closed. It is useful for testing, temporary storage, fast operations, and examples where no persistent database file is required. Option A is wrong because :memory: does not load an existing file-based database into memory. Option B is also incorrect because it is not a deletion command or database management operation. It is simply a special database name recognized by SQLite to create a temporary in-memory database.
Which methods can be invoked in order to draw a triangle?
(Select two answers.)
create_shape()
create_line()
create_triangle_shape()
create_polygon()
The correct answers are B and D. In Tkinter’s Canvas widget, there is no built-in method named create_shape() or create_triangle_shape(). A triangle can be drawn either with create_line() by connecting three line segments between three coordinate points, or with create_polygon() by providing three vertices. create_polygon() is the more direct method because a triangle is a polygon with three sides, and Tkinter can render it as a filled or outlined shape. create_line() is also valid when the programmer manually draws the three sides and closes the shape. Therefore, the valid Canvas methods for producing a triangle are create_line() and create_polygon().
Select the true statements about the following invocation:

(Select two answers.)
It addresses a service deployed at localhost (the host where the code is run).
It addresses a service whose timeout is set to 3000 ms.
It addresses a service located at the following address local.host.com.
It addresses a service listening at port 3000.
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.
If w is a correctly created main application window, which method would you use to foe both of the main window's dimensions?
w. f ixshape ()
w. f ixdim ()
w. resizable ()
w.makewindow ()
C. 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:
import tkinter as tk
root = tk. Tk ()
root. geometry ( "500x400" )
root. resizable (False, False)
root. mainloop ()
Select the true statement about composition
Composition extends a class's capabilities by adding new components and modifying the existing ones.
Composition allows a class to be projected as a container of different classes
Composition is a concept that promotes code reusability while inheritance promotes encapsulation.
Composition is based on the has a relation: so it cannot be used together with inheritance.
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 class 1 .
B. 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.
What will happen if the mam window is too small to fit all its widgets?
Some widgets may be invisible
The window will be expanded.
An exception will be raised.
The widgets will be scaled down to fit the window's size.
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.
In the JSON processing context, the term serialization:
names a process in which Python data is turned into a JSON string.
names a process in which a JSON string is turned into Python data.
refers to nothing, because there is no such thing as JSON serialization.
names a process in which a JSON string is remodeled and transformed into a new JSON string
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.
Which of the following types cannot be pickled?
integers, floating-point numbers, complex numbers
function and class definitions
None, booleans
strings, bytes, bytearrays
The correct answer is B because Python’s pickle module can serialize many built-in data types, including integers, floating-point numbers, complex numbers, strings, bytes, bytearrays, booleans, and None. However, it does not serialize the actual implementation or definition body of functions and classes. Top-level functions and classes may sometimes be pickled by reference using their fully qualified names, but their code definitions are not stored inside the pickle byte stream. This distinction matters: pickle records enough information to locate an object again during unpickling, but it does not preserve source code, nested definitions, lambda functions, or dynamically created definitions in a portable way. Therefore, “function and class definitions” is the option that cannot truly be pickled as definitions.
Select the true statements about the sqlite3 module. (Select two answers.)
The fetchalt method returns None when no rows are available
The execute method allows you to perform several queries at once
The execute method is provided by the Cursor class
The fetchone method returns None when no rows are available
C. 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.
D. 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.
Copyright © 2014-2026 Certensure. All Rights Reserved