Free PCPP-32-101 Exam Braindumps
Certified Professional in Python Programming 1 Questions 29–33 (page: 3)

Updated On: 1-Feb-2026

What is true about the unbind_all () method?
(Select two answers.)

  1. It can be invoked from any widget
  2. It can be invoked from the main window widget only
  3. It is parameterless
  4. It causes all the widgets to disappear

Answer(s): A,C

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.


Reference:

Tkinter documentation: https://docs.python.org/3/library/tkinter.html#event-bindings Tkinter tutorial: https://www.python-course.eu/tkinter_events_binds.php



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

  1. w. f ixshape ()
  2. w. f ixdim ()
  3. w. resizable ()
  4. w.makewindow ()

Answer(s): C

Explanation:

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()

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 effect.

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).


Reference:

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#36576068 : https://www.skotechlearn.com/2020/06/tkinter-window-position-size- center-screen-in-python.html



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

  1. 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
  2. Connectionless communications are usually built on top of TCP
  3. Using walkie-talkies is an example of a connection-oriented communication
  4. A phone call is an example of a connection-oriented communication

Answer(s): A,D

Explanation:

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. 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 browser.
B) 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 not.
C) 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 not.
D) 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 over.


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:
import socket

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)
while True:
data = conn.recv(1024)
if not data:
break
conn.sendall(data)
Client-side code:
import socket

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.


Reference:

https://www.techtarget.com/searchnetworking/definition/client-server
https://www.javatpoint.com/connection-oriented-vs-connectionless-service
https://en.wikipedia.org/wiki/Walkie-talkie 4: https://en.wikipedia.org/wiki/Telephone_call



Select the true statements about sockets. (Select two answers)

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

Answer(s): A,D

Explanation:

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 nodes12.
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 firewall3.
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 transfer12.
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.


Reference:

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



Select the true statement about the socket. gaierror exception.

  1. It is raised when a timeout occurs on a socket.
  2. It is raised when a system function returns a system-related error.
  3. It is raised when an address-related error caused by the repr () function occurs.
  4. It is raised when an address-related error caused by the getaddrinfo () and getnameinfo () functions occurs.

Answer(s): D

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.


Reference:

Official Python documentation on
socket.gaierror: https://docs.python.org/3/library/socket.html#socket.gaierror



Viewing page 3 of 10
Viewing questions 11 - 15 out of 80 questions


Post your Comments and Discuss Python Institute PCPP-32-101 exam prep with other Community members:

AI Tutor AI Tutor 👋 I’m here to help!