Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

CN Quiz

Total questions: 20

Worksheet time: 14mins

Name
Class
Date
1.

What is the purpose of a socket in networking?

a)

 To connect two computers physically

b)

To enable communication between processes over a network

c)

To provide power to a device

d)

To store data temporarily

2.

Which type of socket provides reliable, connection-oriented communication?

a)

Stream socket (SOCK_STREAM)

b)

Datagram socket (SOCK_DGRAM)

c)

BOTH Stream socket

and Datagram socket

d)

Broadcast socket

3.

Which function is used to create a socket in C?

a)

socket()

b)

bind()

c)

listen()

d)

accept()

4.

What does the bind() function do?

a)

Associates a socket with an IP address and port number

b)

Establishes a connection to a remote server

c)

Puts a socket in passive mode

d)

Reads data from a socket

5.

What does the socket() function in C return?

a)
  • A file descriptor (socket descriptor)

b)

int

c)
  • An IP address and a A port number

d)

Bool

6.

Which function extracts the first connection request from the queue of pending connections?

a)

connect()

b)

accept()

c)

send()

d)

recv()

7.

What is the primary difference between TCP and UDP sockets?

a)

TCP sockets are connectionless, while UDP sockets are reliable

b)

TCP sockets provide reliable, ordered communication, while UDP sockets are connectionless and unreliable.

c)

 UDP sockets are used for web browsing, while TCP sockets are used for video streaming.

d)

TCP sockets use port numbers, while UDP sockets use IP addresses.

8.

What is the purpose of the connect() function in socket programming?

a)

To create a socket

b)

To bind a socket to an address

c)

To establish a connection to a remote server

d)

To listen for incoming connections

9.

Which one of the following socket API functions converts an unconnected active TCP socket into a passive socket?

a)

Connect

b)

Bind

c)

Listen

d)

Accept

10.

Which of the following transport layer protocol is used to support electronic mail ?

a)

SMTP

b)

IP

c)

TCP

d)

UDP

11.

Identify the correct order in which a server process must invoke the function calls accept,bind,listen and recv according to UNIX socket API

a)

listen,accept,bind,recv

b)

Bind,listen,accept,recv

c)

Bind,accept,listen,recv

d)

accept,listen,bind,recv

12.

Consider socket API on a Linux Machine that supports connected UDP sockets. A connected UDP socket is a UDP socket on which Connect function has already been called . Which of the following statement is/are CORRECT ?

I)  A connected UDP socket can be used to communicate with multiple peers Simultaneously .

II) A process can successfully call connect function again for an already connected UDP socket.

a)

I only

b)

II only

c)

Both I and II

d)

Neither I nor II

13.

For the purpose of providing Digital Certificate, ____ is used for establishing an encrypted link between a web server and a browser

a)

Standard service layer

b)

Secure socket layer

c)

Secure service line

d)

Secure service layer

14.

Socket address is:

a)

IPv4 address translated to IPv6 address

b)

Combination of IP address and port address

c)

Combination of MAC address and domain address

d)

Application layer address

15.

Consider the following statements about socket API functions.

I. Bind() converts an unconnected active TCP socket into a passive socket.

II. Listen() waits for incoming connections.

III. Accept() is used to associate a socket with a port on the local machine.

Which of the above statements are incorrect?

a)

I

b)

I and II

c)

II and III

d)

I and III

16.

What is the return type of the socket() function in C?

a)

int

b)

void

c)

Bool

d)

Structure

17.

Which address family is typically used for Internet addresses (IPv4 protocols)?

a)
  • PF_INET

b)
  • PF_UNIX

c)
  • PF_LOCAL

d)

AF_INET

18.

Which parameter specifies the address of the destination in the sendto() function?

a)

sockid

b)

msg

c)

foreignAddr

d)

addrlen

19.

Match the following

a)

I – C, II – A, III - B

b)

I – A, II – C, III - B

c)

I – A, II – B, III - C

20.

Imagine a user sitting at an Ethernet-connected PC. He has a browser open. He types "www.google.com" in the address bar and hits enter.

Now tell me what the first packet to appear on the Ethernet is.

4 lines