Answer:
Encapsulation
Explanation:
There are seven layers in the OSI network model. These layers are, application, presentation, session, transport, network, data-link and physical layer.
Each layer of the OSI model has a PDU or protocol data unit. These PDUs are form by encapsulation.
The application, presentation and session data. When it moves to the transport layer, it is encapsulated within the transport header. This new pdu is called segment.
This process continues in network and data-link to give packet and frame PDUs respectively.
Answer:
I am writing a Python program:
def Eratosthenes(n):
primeNo = [True for i in range(n+1)] # this is a boolean array
p = 2 # the first prime number is initialized as 2
while (p * p <= n): # enumerates all multiples of p
if (primeNo[p] == True):
for i in range(p * p, n+1, p): #update multiples
primeNo[i] = False
p = p + 1
for p in range(2, n): #display all the prime numbers
if primeNo[p]:
print(p),
def main(): #to take value of n from user and display prime numbers #less than or equal to n by calling Eratosthenes method
n= int(input("Enter an integer n: "))
print("The prime numbers less than or equal to",n, "are: ")
Eratosthenes(n)
main()
Explanation:
The program contains a Boolean type array primeNo that is initialized by True which means that any value i in prime array will be true if i is a prime otherwise it will be false. The while loop keeps enumerating all multiples of p starting from 2, and striking them off from the original array list and for loops keep updating the multiples. This process will continue till the p is greater than n. The last for loop displays all the prime numbers less than or equal to n which is input by user. main() function prompts user to enter the value of integer n and then calls Eratosthenes() function to print all the prime numbers less than or equal to a given integer n.
Answer:
I am writing the Python program:
lyrics = ["I wanna be your endgame", "I wanna be your first string",
"I wanna be your A-Team", "I wanna be your endgame, endgame"]
lines_of_sanity = 6
counter = 0
while counter <= lines_of_sanity+1:
for line in lyrics:
print(line)
counter = counter + 1
print("MAKE IT STOP")
Explanation:
- The lyrics is a list which has the following lines of song.
I wanna be your endgame
I wanna be your first string
I wanna be your A-Team
I wanna be your endgame, endgame
- The value of lines_of_sanity is 6.
- counter variable is initialized to 0.
- The while loop starts which keeps executing until the value of counter becomes greater than 6 which is the value of lines_of_sanity
- The for loop inside the while loop moves through each line of lyrics list and prints that line. The counter variable increments to 1 at each iteration.
- Lets see what the while and for loops print at each iteration:
1st iteration: counter = 0, following line is displayed:
- I wanna be your endgame
- Value of counter increments by 1.
- counter = 1
2nd iteration: counter = 1, following line is displayed:
- I wanna be your first string
- Value of counter increments by 1.
- counter = 2
3rd iteration: counter = 2, following line is displayed:
- I wanna be your A-Team
- Value of counter increments by 1.
- counter = 3
4th iteration: counter = 3, following line is displayed:
- I wanna be your endgame, endgame
- Value of counter increments by 1.
- counter = 4
5th iteration: counter = 4, following line is displayed:
- I wanna be your endgame
- Value of counter increments by 1.
- counter = 5
6th iteration: counter = 5, following line is displayed:
- I wanna be your first string
- Value of counter increments by 1.
- counter = 6
7th iteration: counter = 6, following line is displayed:
- I wanna be your A-Team
- Value of counter increments by 1.
- counter = 7
- The program should keep going to finish out the current verse. So following line is displayed:
- I wanna be your endgame, endgame
- The loop breaks as the value of counter = 7 is greater than lines_of_sanity i.e. 6
- So at last the print("MAKE IT STOP") statement is execute which displays the following line:
- MAKE IT STOP
- The program along with the output is attached.
Answer:
1/5 is a rational number.
Explanation:
Natural numbers are the numbers you use to count with (1, 2, 3, etc.). Nobody uses fractions while counting whole objects unless they think they're funny and want to stall, so 1/5 wouldn't be a rational number.
Whole numbers are the exact same as natural numbers, but with the addition of the number 0 (think about it, no one starts from zero when counting).
Integers include whole numbers as well as their opposites (for example, the opposite of 4 is –4).
As a basic rule of thumb, if the number includes a fraction or a decimal point of any kind, it would be a rational number.