Posts

Showing posts from November, 2024

100 Networking Questions

Basic Python Programming Write a Python program to reverse a string. (I have also added code for reverse a list) #Reverse a string a="Hello" try:     print(a[::-1])     #Reverse a list     b=[1,'a',"Suchi"]     print(b[::-1])     print(b[2])     c=b[2]     print(c[::-1]) except Exception as e:     print("Error Found"+e) Reasoning: [::-1]  is Python slicing syntax: :  refers to the entire sequence. -1  specifies the step (reverse direction). This avoids using loops, making the program concise and efficient. 2. Implement a function to check if a number is prime. num=23 if num<2:     print("Not Prime") for i in range(2,int(num**0.5)+1):     if num%i==0:         print("Not Prime") print(num," is Prime ") Reasoning: A prime number is only divisible by  1  and itself. Checking divisors up to the square root of  n  reduces time complexity...

-: Networking interview questions :-

1. Here's how the  Wireshark capture  would look during the first-time  ping  from Host A (10.1.1.1) to Host B (10.1.1.2). Since it's the first ping, there will be no pre-existing ARP entries, so you'll see both ARP and ICMP traffic. Packet Breakdown in Wireshark Each step corresponds to a captured packet with its main headers (Ethernet, ARP, IP, ICMP). Below is the packet-by-packet flow: 1. ARP Request Description : Host A (10.1.1.1) broadcasts: "Who has 10.1.1.254? Tell 10.1.1.1." Wireshark Protocol : ARP Packet Details : Ethernet Header : Destination MAC: FF:FF:FF:FF:FF (Broadcast) Source MAC: AA:AA:AA:AA:AA EtherType: 0x0806 (ARP) ARP Header : Operation: 1 (Request) Sender MAC: AA:AA:AA:AA:AA Sender IP: 10.1.1.1 Target MAC: 00:00:00:00:00:00 (unknown) Target IP: 10.1.1.254 2. ARP Reply Description : Router R1 (10.1.1.254) responds: "I am 10.1.1.254, my MAC is R1:1." Wireshark Protocol : ARP Packet Details : Ethernet Header : Destination MAC: AA:AA:AA...