CN numerical problems

 IP addresses and Fragmentation

https://cexpertvision.com/2021/03/19/numerical-practice-datagram-fragments/


Data link layer

1Q. A link has a transmission speed of 106 bits/sec. It uses data packets of size 1000 bytes each. Assume that the acknowledgement has negligible transmission delay, and that its propagation delay is the same as the data propagation delay. Also assume that the processing delays at the nodes are negligible. The efficiency of the stop-and-wait protocol in this setup is exactly 25%. The value of the one-way propagation delay (in milliseconds) is ___ Ans 12


2Q. Consider the sliding window algorithm where sender window size is 9 and receiver window size is 7 and no out of order arrivals. What is the smallest value for maximum sequence number?


3Q. Suppose two hosts are connected by a point-to-point link and they are configured to use stop and waitStop-and-Waitprotocol for reliable data transfer. Identify in which one of the following scenarios, the utilization of the link is the lowest.

  1. Longer link length and lower transmission rate
  2. Longer link length and higher transmission rate
  3. Shorter link length and lower transmission rate
  4. Shorter link length and higher transmission rate

4Q. In a stop and wait ARQ, Bandwidth Delay product is 20,000 bits. Given the frame size is 1000 bits. What is the percentage of utilization of link if we have a protocol that can send 15 frames without waiting for acknowledgement? 75%


5Q. A sender uses the stop and wait ARQ protocol for reliable transmission of frames. Frames are of size 100 bytes and the transmission rate at the sender is 20 Kbps. Size of an acknowledgement is 10 bytes and the transmission rate at the receiver is 8 Kbps. The one way propagation delay is 10 msec.

Assuming no frame is lost, the sender throughput is ________ bytes/sec.

6Q. In the GO back N ARQ sender is sending the 20 packets to the destination with a window size of 4. Every sixth packet is lost and after a packet loss sender is sending one dummy packet outside the window for ensuring everything is correct [ dummy packet is an outside packet not the part of the window]. How many number of transmissions will be there?


Transport layer questions: 

1Q. Assume a TCP implementation over a 10Gbps link with one way dealy of 80ms if TCP receiver window size is 2MB and TCP send 1KB packet then how many RTT does it take until slow start phase open the congesion windows of 2MB. Assume no congestion and no loss of packet.

a) 11 RTT b) 10 RTT c) 12 RTT d) 13 RTT     solution


2Q. In TCP, MSS is 8B. If during the 6th RTT the network is congested and timeout occurs, by using the congestion algorithm, then the threshold value is _________(in Bytes). (assume initial congestion window size for the first transmission is 1 MSS)   solution

3Q.  Which layer connects the network support layers and user support layers ?  solution

  1. transport layer
  2. network layer
  3. data link layer
  4. session layer

4Q. Suppose two TCP connections are present over some bottleneck link of rate R bps. Both connections have a huge file to send (in the same direction over the bottleneck link). The transmissions of the files start at the same time. What transmission rate would TCP like to give to each of the connections? sol


5Q. Suppose Host A sends two TCP segments back to back to Host B over a TCP connection. The first segment has sequence number 90; the second has sequence number 110.

  1. How much data is in the first segment?
  1. Suppose that the first segment is lost but the second segment arrives at B. In the acknowledgment that Host B sends to Host A, what will be the acknowledgment number? sol

Multithreading Java Interview Questions

 1. What is the start() and run() method of Thread class?

When the start() method is called, a new thread is created and this newly created thread executes the task that is kept in the run() method. One can call the start() method only once.  

When the run() method is called, no new thread is created as in the case of the start() method. This method is executed by the current thread. One can call the run() method multiple times. 

2. What is Thread in java?

3. What are the 2 ways of implementing Thread in java?

4. What is the difference between class lock and Object lock?

Class lock: each and every class has a unique lock usually referred to as a class level lock. These locks are achieved using the keyword ‘static synchronized’ and can be used to make static data thread-safe. It is generally used when one wants to prevent multiple threads from entering a synchronized block.

Object lock: each and every object has a unique lock usually referred to as an object-level lock. These locks are achieved using the keyword ‘synchronized’ and can be used to protect non-static data. It is generally used when one wants to synchronize a non-static method or block so that only the thread will be able to execute the code block on a given instance of the class.  

5. What is Daemon Thread?
daemon threads are basically referred to as a service provider that provides services and support to user threads. There are basically two methods available in thread class for daemon thread: setDaemon() and isDaemon(). 

These threads are referred to as low priority threads, therefore are especially required for supporting background tasks like garbage collection, releasing memory of unused objects, etc. 

6. What are wait() and Sleep() methods?

it is a non-static method that causes the current thread to wait and go to sleep until some other threads call the notify () or notifyAll() method for the object’s monitor (lock). It simply releases the lock and is mostly used for inter-thread communication. It is defined in the object class, and should only be called from a synchronized context.

7. What is difference between notify() and notifyall()?

8. What is Runnable and Callable interface?

9. What are benefits of using Multithreading?

10. What is Thread pool?

11. What is the purpose of Join Method?

12. Explain deadlock?

13. How do Threads Communicate with each other?

14. How to stop thread in java?

15. Explain the different priorities of Threads?

16. What is the primary drawback of Syncronized Methods?

17. What are the different states of a Thread?

18. Is 2 threads can have same name? if yes, How can you identify the same threads?

19. What is the priority of main thread?

20. What is the default priority of a thread?

21. What is Synchronization?

22. Is it possible to make constructors  synchronized? No, 

23. Can we use Synchronized Keyword with variables? no

24. Explain Volatile Variables in java? main memory

25. What is Inter-Thread Communication?

26. What is Context switching?

27. When should we use interrupt a Thread?

28. What is Race-Condition?


NLP - Acadamic Learning Topics

 Natural Learning Processing

Videos Playlist

Part-1

➡️NLP phases:  Link🔗 

Lexical analysis, Syntactic analysis, Semantic analysis, Discourse Integration, Pragmatic Analysis.

➡️Noisy channel model: Wikipedia🔗 : Framework used in spell checkers


➡️Concepts of Parts of Speech and Formal Grammar of Natural Grammar of English: Web Link

Part-2

➡️N-gram model: PPTYT video

➡️Language Models: YT video

➡️Neural Networks: PPT

Part-3

➡️POS tagging: YT Video (rule based, Transformation based, Probablistic based)

➡️Hidden Markov Model: YT video (N-gram: 2 Steps)


Part - 4 

➡️Parsing in NLP: PPT 

➡️Tree Bank: PPT

➡️CKY parsing: YT Video (Also probablistic CKY)


Part - 5 

➡️Vector Semantics: Web

➡️CBOW: GFG

➡️Skip-gram: Web

➡️Wordsense and WordNet: ChatGPT













Best Resources to learn Generative Ai

 

GENERATIVE AI RESOURCES

  1. Generative AI learning path by Google Cloud. A series of 10 courses on generative AI products and technologies, from the fundamentals of Large Language Models to how to create and deploy generative AI solutions on Google Cloud [Link].
  2. Generative AI short courses by DeepLearning.AI - Five short courses on generative AI including LangChain for LLM Application Development, How Diffusion Models Work and more. [Link].
  3. LLM Bootcamp: A series of free lectures by The full Stack on building and deploying LLM apps [Link].
  4. Building AI Products with OpenAI - a free course by CoRise in collaboration with OpenAI [Link].
  5. Free Course by Activeloop on LangChain & Vector Databases in Production [Link].
  6. Pinecone learning center - Lots of free guides as well as complete handbooks on LangChain, vector embeddings etc. by Pinecone [Link].
  7. Build AI Apps with ChatGPT, Dall-E and GPT-4  - a free course on Scrimba [Link].
  8. Gartner Experts Answer the Top Generative AI Questions for Your Enterprise - a report by Gartner [Link]
  9. GPT best practices: A guide by OpenAI that shares strategies and tactics for getting better results from GPTs [Link].
  10. OpenAI cookbook by OpenAI - Examples and guides for using the OpenAI API [Link].
  11. Prompt injection explained, with video, slides, and a transcript from a webinar organized by LangChain [Link].
  12. A detailed guide to Prompt Engineering by DAIR.AI [Link]
  13. What Are Transformer Models and How Do They Work. A tutorial by Cohere AI [Link]
  14. Learn Prompting: an open source course on prompt engineering[Link]

RSA Algorithm

 RSA Algorithm

RSA (Rivest–Shamir–Adleman) is a widely used public-key cryptosystem, meaning it utilizes a pair of mathematically linked keys for encryption and decryption. Here's a deeper look into RSA:

Core Concept:

  • RSA leverages the mathematical difficulty of factoring large prime numbers.
  • It's computationally easy to multiply large prime numbers together, but extremely hard to reverse the process and find the original primes.

Key Generation:

  1. Prime Numbers: Two large, distinct prime numbers (p and q) are chosen as the foundation.
  2. Modulus (n): The product of p and q (n = p * q) becomes the public key's modulus.
  3. Euler's Totient (φ(n)): A mathematical function (Euler's totient) is applied to n, resulting in φ(n).
  4. Public Exponent (e): A public exponent (e) is chosen such that 1 < e < φ(n) and has no common factors with φ(n).
  5. Private Exponent (d): Using a mathematical equation (modular multiplicative inverse), a private exponent (d) is derived that satisfies the equation (e * d) ≡ 1 (mod φ(n)).

Key Distribution:

  • The public key (e, n) is freely distributed. Anyone can encrypt messages using this key.
  • The private key (d, n) is kept confidential. It's used for decryption.

Encryption Process:

  1. Plaintext Conversion: The message (plaintext) is converted into numerical blocks smaller than the modulus (n).
  2. Encryption: Each plaintext block (M) is raised to the power of the public exponent (e) and then modulo n. This creates the ciphertext block (C) using the formula: C = M^e (mod n).

Decryption Process:

  1. Ciphertext Received: The receiver gets the ciphertext block (C).
  2. Decryption: The private exponent (d) is used to decrypt the message. The original block (M) is recovered using the formula: M = C^d (mod n).

Security and Applications:

  • The security of RSA relies on the difficulty of factoring large n. As key sizes increase, so does the difficulty of breaking the encryption.
  • RSA is commonly used for:
    • Secure communication (HTTPS, digital signatures)
    • Secure key exchange for other encryption algorithms
    • Digital signing of documents to ensure authenticity

Limitations:

  • RSA is computationally slower than symmetric algorithms like AES.
  • It's not ideal for encrypting large amounts of data directly. It's often used to encrypt smaller chunks like keys for symmetric encryption.

Overall, RSA remains a cornerstone of public-key cryptography, providing secure communication and digital signatures for various applications.

Popular Post

MindMaps

Featured post

Question 1: Reverse Words in a String III

  def reverseWords(s: str) -> str: words = s.split() return ' '.join(word[::-1] for word in words)