New Year Sale 2026! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Python Institute PCPP-32-101 Exam - Topic 9 Question 23 Discussion

Actual exam question for Python Institute's PCPP-32-101 exam
Question #: 23
Topic #: 9
[All PCPP-32-101 Questions]

Select the true statement about composition

Show Suggested Answer Hide Answer
Suggested Answer: A, D

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.

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

2. 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 not2.

3. 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 not3.

4. 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 over4.


1: https://www.techtarget.com/searchnetworking/definition/client-server2: https://www.javatpoint.com/connection-oriented-vs-connectionless-service3: https://en.wikipedia.org/wiki/Walkie-talkie4: https://en.wikipedia.org/wiki/Telephone_call

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

Contribute your Thoughts:

0/2000 characters
Lenora
3 months ago
Composition lets you build complex classes easily!
upvoted 0 times
...
Sharee
3 months ago
Wait, is it really true that composition can't mix with inheritance?
upvoted 0 times
...
Kizzy
4 months ago
Definitely agree, composition is key for reusability!
upvoted 0 times
...
Veronika
4 months ago
I thought composition could work with inheritance?
upvoted 0 times
...
Bulah
4 months ago
Composition is all about "has a" relationships.
upvoted 0 times
...
Trina
4 months ago
I thought composition and inheritance could be used together, so I'm skeptical about option D being true.
upvoted 0 times
...
Nana
4 months ago
I feel like I studied that composition promotes code reusability, but I can't quite recall how it relates to encapsulation in option C.
upvoted 0 times
...
Patti
5 months ago
I remember that composition is often described as a "has-a" relationship, which makes me lean towards option B.
upvoted 0 times
...
Kanisha
5 months ago
I think composition is about building classes with other classes, but I'm not sure if it modifies existing ones like option A says.
upvoted 0 times
...
Noelia
5 months ago
Composition and inheritance can be tricky to distinguish, but I'm pretty sure this is asking about the key differences between the two. I'll try to apply that knowledge here.
upvoted 0 times
...
Renato
5 months ago
Okay, I know composition is about using objects as components, so I'll focus on that in my answer.
upvoted 0 times
...
Jolanda
5 months ago
Hmm, I'm a bit unsure about the differences between composition and inheritance. Let me think this through carefully.
upvoted 0 times
...
Ashton
5 months ago
This question seems straightforward, I think I can handle it.
upvoted 0 times
...
Penney
5 months ago
I'm a bit confused - is composition really about modifying existing components, or is that more about inheritance? I'll have to double-check my notes.
upvoted 0 times
...
Frederica
5 months ago
Okay, let me think this through. I know the Tracking Custom Data field in Procedure Configuration can use functions, but what about the other options? I'll need to double-check the details on Remote Actions and Response Actions.
upvoted 0 times
...
Robt
5 months ago
Wait, I'm confused. Is the expiration date August 10th or October 8th? I need to double-check the format they're using here.
upvoted 0 times
...
Odette
10 months ago
Haha, option A sounds like something a superhero would do - adding new components and modifying existing ones to extend their capabilities!
upvoted 0 times
Nana
9 months ago
User 3: I agree, composition extends a class's capabilities by adding new components and modifying existing ones.
upvoted 0 times
...
Fabiola
9 months ago
User 2: Yeah, it does sound like something a superhero would do!
upvoted 0 times
...
Murray
9 months ago
User 1: I think option A is the true statement about composition.
upvoted 0 times
...
Geraldine
10 months ago
User 3: I agree, option A is the true statement about composition.
upvoted 0 times
...
Elliot
10 months ago
User 2: Yeah, it does sound like something a superhero would do.
upvoted 0 times
...
Audry
10 months ago
User 1: I think option A is correct, it sounds like a superhero power!
upvoted 0 times
...
...
Francoise
11 months ago
Option D is definitely wrong. Composition and inheritance can be used together in a complementary way to build more complex and robust class structures.
upvoted 0 times
Vivan
9 months ago
Option D is definitely wrong. Composition and inheritance can be used together in a complementary way to build more complex and robust class structures.
upvoted 0 times
...
Raul
9 months ago
C) Composition is a concept that promotes code reusability while inheritance promotes encapsulation.
upvoted 0 times
...
Simona
9 months ago
B) Composition allows a class to be projected as a container of different classes
upvoted 0 times
...
Domonique
9 months ago
A) Composition extends a class's capabilities by adding new components and modifying the existing ones.
upvoted 0 times
...
Cristal
9 months ago
C) Composition is a concept that promotes code reusability while inheritance promotes encapsulation.
upvoted 0 times
...
Rochell
10 months ago
B) Composition allows a class to be projected as a container of different classes
upvoted 0 times
...
Tiera
10 months ago
A) Composition extends a class's capabilities by adding new components and modifying the existing ones.
upvoted 0 times
...
...
Clemencia
11 months ago
I disagree with option C. Composition and inheritance are both important concepts in object-oriented programming, and they can be used together to promote code reusability and encapsulation.
upvoted 0 times
...
Corinne
11 months ago
I think option B is the correct answer. Composition allows a class to be composed of different components, making it more flexible and reusable.
upvoted 0 times
Danica
10 months ago
I think option D is correct. Composition is based on the has a relation, so it cannot be used together with inheritance.
upvoted 0 times
...
Alex
10 months ago
I agree with option C. Composition promotes code reusability while inheritance promotes encapsulation.
upvoted 0 times
...
Nickolas
10 months ago
I believe option A is true. Composition extends a class's capabilities by adding new components and modifying the existing ones.
upvoted 0 times
...
Yasuko
10 months ago
I think option B is the correct answer. Composition allows a class to be projected as a container of different classes.
upvoted 0 times
...
...
Carline
11 months ago
I agree with Olene, C makes more sense to me too.
upvoted 0 times
...
Olene
11 months ago
I disagree, I believe it's C because composition promotes code reusability.
upvoted 0 times
...
Melissa
11 months ago
I think the true statement about composition is A.
upvoted 0 times
...

Save Cancel