Answer:
Syntax errors: Errors in the grammar or syntax of the programming language.
Runtime errors: Errors that occur during the execution of a program, such as division by
zero or accessing an array out of bounds.
Logical errors: Errors in the logic of the program that cause incorrect results.
List out the Taxonomy of Medium Access Protocol.
Answer:
Random access protocols:
ALOHA
CSMA
CSMA/CD
CSMA/CA
Token passing protocols:
Token ring
Token bus
Polling protocols:
Polling
Write a python code for identify host name
Answer:
import socket
def get_host_name():
hostname = socket.gethostname()
return hostname
if __name__ == "__main__":
print(get_host_name())
Compare and contrast CSMA/CD and CSMA/CA
Answer:
Compare and contrast CSMA/CD and CSMA/CA:
CSMA/CD (Carrier Sense Multiple Access with Collision Detection): Used in Ethernet
networks. If a collision occurs, all devices stop transmitting for a random time before
retrying.
CSMA/CA (Carrier Sense Multiple Access with Collision Avoidance): Used in
wireless networks. Devices listen for the channel to be idle before transmitting. If a
collision is detected, they use a backoff algorithm to avoid retransmitting immediately.
Show how the address 47:20:1B:2E:08:EE is sent out on line.
Answer:
01000111 00100000 00011011 00101110 00001000 11101110
, Define Token Passing.
Answer:
Token passing is a medium access control (MAC) protocol used in some local area networks.
It involves passing a special token (a control frame) around the network in a circular fashion.
Only the device holding the token is allowed to transmit data. This ensures that only one
device transmits at a time, preventing collisions.
Create a python code for to download webpage using TCP socket
Answer:
Algorithms:
1. Create the TCP/IP Socket
2. Connect as client to selected Server on the specified port
3. Send HTTP request and Receive HTTP response
4. Close connection - 2 marks
Graphical Representation of download webpage
Python code:
import socket
clientSocket = socket.socket()
clientSocket.connect(("hindustanuniv.ac.in", 80))
clientSocket.sendall(b"GET /