Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

Lec 1

What is a socket?
✗ - A process controlled by the app developer.
✓ - A hollow part or piece for receiving and holding/transmitting some part or thing.
✓ - A device or point in a wall where you can connect electrical equipment to the power
supply.

In networking, what does a socket represent?


✓ - A process sends/receives messages to/from its socket.
✗ - A hollow part or piece for receiving and holding/transmitting some part or thing.
✗ - A process controlled by the app developer.
✗ - A device or point in a wall where you can connect electrical equipment to the power
supply.

What is the goal of socket programming?


✗ - To learn how to build processes controlled by the app developer.
✓ - To learn how to build client/server applications that communicate using sockets.
✗ - To learn how to build electrical equipment that can be connected to a power supply.
✗ - To learn how to build hollow parts or pieces for receiving and holding/transmitting some
part or thing.

What is a API?
✓ - A set of standard function calls that can be used to add Internet communication to
applications.
✗ - A device or point in a wall where you can connect electrical equipment to the power
supply.
✗ - A hollow part or piece for receiving and holding/transmitting some part or thing.
✗ - A process controlled by the app developer.

What is a reliable byte stream?


✗ - A device or point in a wall where you can connect electrical equipment to the power
supply.
✗ - A dedicated connection between the source and destination end nodes, and message
transfer is carried out without a transmission guarantee.
✗ - A process controlled by the app developer.
✓ - A byte stream in which the bytes that emerge from the communication channel at the
recipient are exactly the same, and in the same order, as they were when the sender inserted
them into the channel.
What is the purpose of a TCP socket?
✗ - To provide a device or point in a wall where you can connect electrical equipment to the
power supply.
✗ - To provide a process controlled by the app developer.
✓ - To provide reliable transfer of bytes from one process to another.
✗ - To provide a hollow part or piece for receiving and holding/transmitting some part or thing.

What is the purpose of a UDP socket?


✗ - To provide a hollow part or piece for receiving and holding/transmitting some part or thing.
✗ - To provide a process controlled by the app developer.
✓ - To provide simple IP communication using the User Datagram Protocol (UDP).
✗ - To provide a device or point in a wall where you can connect electrical equipment to the
power supply.

What is the purpose of the BSD Socket API?


✗ - To provide a hollow part or piece for receiving and holding/transmitting some part or thing.
✓ - To enable BSD compliant communication over TCP/IP.
✗ - To provide a process controlled by the app developer.
✗ - To provide a device or point in a wall where you can connect electrical equipment to the
power supply.

What is an input stream?


✗ - A sequence of characters that flow out of a process to an output source.
✗ - A device or point in a wall where you can connect electrical equipment to the power
supply.
✓ - A sequence of characters that flow into a process from an input source.
✗ - A process controlled by the app developer.

What is an output stream?


✗ - A process controlled by the app developer.
✓ - A sequence of characters that flow out of a process to an output source.
✗ - A device or point in a wall where you can connect electrical equipment to the power
supply.
✗ - A sequence of characters that flow into a process from an input source.

What is an stream?
✗ - A sequence of characters that flow out of a process to an output source.
✗ - A sequence of characters that flow into a process from an input source.
✓ - is a sequence of characters that flow into or out of a process
What is a socket?
✗ - A process controlled by the app developer.
✗ - A process socket.
✓ - A hollow part or piece for receiving and holding/transmitting some part or thing.
✗ - A device or point in a wall where you can connect electrical equipment to the power
supply.

What is a socket in networking?


✗ - A process socket.
✓ - A process sends/receives messages to/from its socket.
✗ - A device or point in a wall where you can connect electrical equipment to the power
supply.
✗ - A process controlled by the app developer.

What is the goal of socket programming?


✓ - To learn how to build client/server applications that communicate using sockets.
✗ - To learn how to control processes.
✗ - To learn how to build sockets.
✗ - To learn how to build electrical equipment.

What is a socket API?


✓ - is a collection of socket calls that enable you to perform the following primary
communication functions between application programs: Set up and establish connections
to other users on the network. Send and receive data to and from other users. Close down
connections
✗ - A set of standard function calls that can be used to control processes.
✗ - A set of standard function calls that can be used to add Internet communication to
products.
✗ - A set of standard function calls that can be used to build sockets.

What is a unreliable datagram?


✓ - A dedicated connection is established between the source and destination end nodes,
and message transfer is carried out without a transmission guarantee
✗ - A byte stream in which the bytes are exactly the same, and in the same order, as they
were when sent.
✗ - A byte stream that is not the same as when sent.
What is an unreliable datagram?
✓ - A dedicated connection between source and destination end nodes without a
transmission guarantee.
✗ - A connection that is not between source and destination end nodes.
✗ - A connection that is not dedicated between source and destination end nodes.
✗ - A dedicated connection between source and destination end nodes with a transmission
guarantee.

What is a socket?
✗ - A door between an application process and the HTTP transport protocol.
✓ - door between application process and end end-transport protocol (UDP or TCP)
✗ - A door between an application process and the UDP transport protocol.
✗ - A door between an application process and the IP transport protocol.

What is the purpose of a client in socket programming with TCP?


✓ - To contact the server and establish a connection.
✗ - To read and print modified lines from the socket.
✗ - To convert lines to uppercase and send them back to the client.
✗ - To create a socket for incoming requests.

What types of sockets are supported by the Network Component?


✗ - BSD Socket, TCP Sockets, and HTTP Sockets.
✗ - BSD Socket, UDP Sockets, and HTTP Sockets.
✗ - TCP Sockets, UDP Sockets, and HTTP Sockets.
✓ - BSD Socket, TCP Sockets, and UDP Sockets.

What is a stream in socket programming?


✗ - A sequence of characters that flow between processes.
✓ - A sequence of characters that flow into or out of a process.
✗ - A sequence of characters that flow out of a process.
✗ - A sequence of characters that flow into a process.

What is a socket?
✗ - A device or point in a wall where you can connect electrical equipment to the power
supply.
✓ - A hollow part or piece for receiving and holding/transmitting some part or thing.
✗ - A process socket.
✗ - A process controlled by the app developer.
What is the purpose of a server socket?
✗ - To enable BSD compliant communication over TCP/IP.
✗ - To provide reliable transfer of bytes from one process to another.
✓ - To create a socket and listen for incoming connection requests from clients.
✗ - To establish a dedicated connection between the source and destination end nodes.
--------------------------------------------------------------------------------------------------------

Lec 2
What does the BSD server do?
✗ - Closes an existing socket and releases a socket descriptor
✗ - Establishes a connection between the endpoints on stream sockets
✗ - Retrieves the address of the peer to which a socket is connected
✓ - Creates a socket, attaches it to a port, and listens for incoming connection requests

Which function assigns a name (local address) to a socket?


✗ - gethostbyname
✗ - connect
✓ - bind
✗ - closesocket

What does the BSD client do?


✗ - Retrieves the address of the peer to which a socket is connected
✓ - Creates a socket, connects to a server, and sends data
✗ - Closes an existing socket and releases a socket descriptor
✗ - Establishes a connection between the endpoints on stream sockets

What is the purpose of the accept function?


✗ - Creates a communication socket
✓ - Accepts a connection request queued for a listening socket
✗ - Receives incoming data on a datagram socket
✗ - Sends outgoing data on a socket

What is the purpose of the recv function?


✗ - Receives incoming data on a datagram socket
✗ - Sends outgoing data on a datagram socket to destination address
✓ - Receives incoming data that has been queued for a socket
✗ - Sends outgoing data on a socket

What is the purpose of the send function?


✗ - Receives incoming data on a datagram socket
✓ - Sends outgoing data on a socket
✗ - Sends outgoing data on a datagram socket to destination address
✗ - Receives incoming data that has been queued for a socket

What is the purpose of the socket function?


✗ - Receives incoming data on a datagram socket
✗ - Accepts a connection request queued for a listening socket
✓ - Creates a communication socket
✗ - Sends outgoing data on a socket

What is the purpose of the connect function?


✗ - Receives incoming data on a datagram socket
✓ - Establishes a connection between the client and server
✗ - Sends outgoing data on a socket
✗ - Closes an existing socket and releases a socket descriptor

What is the purpose of the closesocket function?


✓ - Closes an existing socket and releases a socket descriptor
✗ - Establishes a connection between the endpoints on stream sockets
✗ - Sends outgoing data on a socket
✗ - Receives incoming data on a datagram socket

What is the purpose of the bind function?


✗ - Establishes a connection between the endpoints on stream sockets
✗ - Retrieves the address of the peer to which a socket is connected
✗ - Closes an existing socket and releases a socket descriptor
✓ - Assigns a name (local address) to a socket

Which function is used to send outgoing data on a socket?


✗ - sendto
✗ - recvfrom
✗ - recv
✓ - send

What is the purpose of the BSD sockets configuration file?


✗ - To retrieve the address of the peer to which a socket is connected
✗ - To close an existing socket and release a socket descriptor
✓ - To specify settings such as the number of available BSD sockets, the timeout for receiving
data, Number of Streaming Server Sockets, and Hostname Resolver
✗ - To establish a connection between the endpoints on stream sockets

What does the bind function do?


✓ - Assigns a name (local address) to a socket
✗ - Retrieves the address of the peer to which a socket is connected
✗ - Establishes a connection between the endpoints on stream sockets
✗ - Closes an existing socket and releases a socket descriptor

What does the gethostbyname function do?


✓ - Retrieves host address corresponding to a host name from a host database.
✗ - Assigns a name (local address) to a socket
✗ - Establishes a connection between the endpoints on stream sockets
✗ - Closes an existing socket and releases a socket descriptor

What does the getsockname function do?


✗ - Closes an existing socket and releases a socket descriptor
✓ - Retrieves the local address of the socket.
✗ - Retrieves the address of the peer to which a socket is connected
✗ - Establishes a connection between the endpoints on stream sockets

What does the sendto function do?


✗ - Retrieves the local address of the socket.
✗ - Retrieves the local address of the socket.
✓ - Sends outgoing data on a datagram socket to destination address.
✗ - Establishes a connection between the endpoints on stream sockets
----------------------------------------------------------------------------------------------------------
Lec 3
NOTE → open lecture 3 to read java example mentioned in the following questions.

What protocol runs on top of the Internet Protocol (IP)?


✗ - UDP
✓ - TCP
✗ - HTTP
✗ - FTP

What is a TCP connection?


✗ - A protocol for transferring files
✗ - A protocol for sending emails
✗ - A connectionless and unreliable protocol
✓ - A connection-oriented and reliable full duplex protocol supporting a pair of byte streams,
one for each direction

How is a TCP connection established?


✓ - By performing a passive open and then an active open
✗ - By performing only an active open
✗ - By performing only a passive open
✗ - By performing an active open and then a passive open

What function is used to handle all protocol related data in the Net_Config_TCP.h
configuration file?
✗ - init()
✗ - net_initialize()
✓ - net_main()
✗ - net_main_thread()

What does the TCP protocol do with the data being sent?
✓ - Encapsulates it into a TCP packet and sends it to the remote peer
✗ - Converts it into HTTP requests
✗ - Sends it as is without encapsulation
✗ - Converts it into UDP packets

What happens if a TCP packet is not acknowledged within the timeout period?
✗ - The connection is closed
✗ - The packet is dropped
✗ - The packet is sent to a different destination
✓ - The same packet is resent

In the Java client (TCP) example, what is the purpose of the BufferedReader inFromUser?
✗ - To write output to the user
✗ - To read input from the server
✓ - To read input from the user
✗ - To write output to the server

In the Java client (TCP) example, what is the purpose of the DataOutputStream outToServer?
✗ - To receive data from the server
✗ - To read input from the user
✓ - To send data to the server
✗ - To write output to the user

In the Java server (TCP) example, what is the purpose of the ServerSocket welcomeSocket?
✗ - To create an input stream
✓ - To create a welcoming socket at a specific port
✗ - To create an output stream
✗ - To create a client socket

In the Java server (TCP) example, what is the purpose of the BufferedReader inFromClient?
✗ - To read input from the server
✓ - To read input from the client
✗ - To write output to the client
✗ - To write output to the server

What is TCP?
✗ - Transport Control Protocol
✗ - Transmission Control Port
✗ - Transport Control Port
✓ - Transmission Control Protocol

What protocol does TCP run on top of?


✗ - User Datagram Protocol (UDP)
✗ - Hypertext Transfer Protocol (HTTP)
✓ - Internet Protocol (IP)
✗ - File Transfer Protocol (FTP)

What type of protocol is TCP?


✗ - Reliable
✓ - Connection-oriented
✗ - Connectionless
✗ - Unreliable

How many byte streams does TCP support?


✗ - Three
✗ - One
✗ - Four
✓ - Two

What must be established before exchanging data in a TCP connection?


✓ - TCP connection
✗ - UDP connection
✗ - HTTP connection
✗ - FTP connection

What does TCP do if data does not reach the final destination due to errors or data
corruption?
✗ - Discards data
✗ - Compresses data
✗ - Encrypts data
✓ - Retransmits data
What is the process of opening a TCP connection called?
✗ - Active close
✓ - Passive open
✗ - Active open
✗ - Passive close

What function is used to open an active or passive TCP connection?


✗ - init()
✗ - net_initialize()
✗ - tcp_get_socket()
✓ - net_main()

What does the TCP protocol encapsulate the data into before sending it to the remote peer?
✗ - HTTP packet
✗ - UDP packet
✗ - FTP packet
✓ - TCP packet

What does TCP do if a packet is not acknowledged when the timeout expires?
✓ - Resends the same packet
✗ - Closes the socket
✗ - Drops the connection
✗ - Sends a different packet

How is a TCP connection established?


✗ - The server and client do not need to bind to a port, they can directly establish a
connection
✓ - The server must first bind to and listen at a port to open it up for connections, then the
client can initiate an active open
✗ - The client must first bind to and listen at a port to open it up for connections, then the
server can initiate an active open
✗ - The server and client simultaneously bind to and listen at a port to open it up for
connections

What is the purpose of the net_main() function in TCP connection?


✗ - To establish a TCP connection
✗ - To close a TCP connection
✓ - To handle all protocol related data and ensure proper operation
✗ - To send data over a TCP connection
What type of service does TCP provide?
✗ - A video streaming service
✗ - A packet service
✓ - A byte stream service
✗ - A file transfer service

What happens if a TCP packet is not acknowledged within the timeout period?
✓ - The same packet is resent
✗ - The packet is fragmented
✗ - The connection is closed
✗ - The packet is discarded

In Java, how do you create a TCP client?


✗ - Create an output stream attached to the socket
✗ - Create a server socket and wait for client contact
✓ - Create a client socket and connect to the server
✗ - Create an input stream attached to the socket

In Java, how do you create a TCP server?


✗ - Create an input stream attached to the socket
✗ - Create a client socket and connect to the server
✗ - Create an output stream attached to the socket
✓ - Create a welcoming socket at a specific port and wait for client contact

What is the purpose of the send_data() function in TCP connection?


✓ - To open an active TCP connection, send data, and close the TCP connection
✗ - To establish a TCP connection
✗ - To receive data over a TCP connection
✗ - To handle all protocol related data and ensure proper operation

What is the maximum number of bytes in the TCP segment's data field?
✓ - Maximum Segment Size
✗ - Receive Window Size
✗ - Retry Timeout
✗ - Number of Retries
Lec 5
What does a socket provide?
✗ - A method for sending emails
✗ - A protocol for web browsing
✓ - An abstraction for interprocess communication
✗ - A way to transfer files

What are the functions of a socket?


✗ - Establish a connection with a server
✗ - Terminate a connection gracefully
✗ - Transfer data between applications
✓ - Define an 'end-point' for communication, Initiate and accept a connection, Send and
receive data, Terminate a connection gracefully

What is a stream socket?


✗ - A socket that waits for requests from a client
✗ - A socket that uses UDP instead of TCP/IP
✗ - A socket that provides unreliable, best-effort networking service
✓ - A socket that provides reliable, connected networking service

What is a datagram socket?


✗ - A socket that waits for requests from a client
✗ - A socket that uses TCP instead of UDP
✗ - A socket that establishes a connection over which data is transferred
✓ - A socket that provides unreliable, best-effort networking service

What is the purpose of addressing in client-server communication?


✓ - To specify the destination of the data being sent
✗ - To encrypt the data being sent
✗ - To compress the data being sent
✗ - To establish a connection between the client and server

What is the purpose of the UDP checksum?


✗ - To compress the data being sent
✓ - To check for data corruption
✗ - To establish a connection between the sender and receiver
✗ - To encrypt the data being sent

What is the difference between UDP and TCP?


✗ - UDP uses TCP/IP, while TCP uses UDP
✗ - UDP waits for requests from a client, while TCP establishes a connection
✗ - UDP provides reliable, connected networking service, while TCP provides unreliable,
best-effort networking service
✓ - UDP provides unreliable, best-effort networking service, while TCP provides reliable,
connected networking service

What is the purpose of the select() function?


✗ - To compress the data being sent
✗ - To encrypt the data being sent
✓ - To identify sockets that are 'ready for use'
✗ - To establish a connection between the client and server

What does the recv() function do?


✗ - Sends data to a socket
✗ - Establishes a connection with a server
✓ - Receives data from a socket
✗ - Terminates a connection gracefully

What does the send() function do?


✗ - Defines an 'end-point' for communication
✗ - Terminates a connection gracefully
✓ - Sends data to a socket
✗ - Receives data from a socket

What is a socket?
✓ - The services provided (often by the operating system) that provide the interface between
application and protocol software
✗ - A type of network function
✗ - A type of network API
✗ - A type of network protocol

What do network APIs provide?


✓ - A way for network platforms to communicate with applications
✗ - A way for network protocols to communicate with each other
✗ - A way for applications to communicate with each other
✗ - A way for applications to communicate with network protocols
What is a stream socket?
✗ - A socket that provides reliable, connected networking service
✗ - A socket used for streaming audio and video
✗ - A socket that uses TCP/IP for communication
✓ - The socket on the server process waits for requests from a client. To do this, the server
first establishes (binds) an address that clients can use to find the server. When the address
is established, the server waits for clients to request a service

What is a datagram socket?


✗ - A socket that uses UDP for communication
✗ - A socket used for file transfer applications
✓ - Connectionless sockets do not establish a connection over which data is transferred.
Instead, the server application specifies its name where a client can send requests.
Connectionless sockets use User Datagram Protocol (UDP) instead of TCP/IP
✗ - A socket that provides unreliable, best-effort networking service

What is the purpose of addressing in sockets?


✗ - To determine the type of socket being used
✗ - To establish a connection between two sockets
✓ - To provide a way for applications to identify and communicate with each other
✗ - To control the flow of data between sockets

What is the purpose of the UDP protocol?


✗ - To provide a way for applications to communicate with network protocols
✗ - To establish a connectionless networking service
✓ - To provide transport layer addressing in the form of UDP ports and an optional checksum
capability
✗ - To establish a reliable, connected networking service

You might also like