Answer:
#include <stdio.h>
int fib(int n) {
if (n <= 0) {
return 0;
}
if (n <= 2) {
return 1;
}
return fib(n-1) + fib(n-2);
}
int main(void) {
for(int nr=0; nr<=20; nr++)
printf("Fibonacci %d is %d\n", nr, fib(nr) );
return 0;
}
Explanation:
The code is a literal translation of the definition using a recursive function.
The recursive function is not per se a very efficient one.
Answer:
Blocking Mode
Explanation:
Spanning Tree Protocol is used to allow path redundancy in the network without creating cycles/circles also called loops.
When two parts of the switched network are connected via two or more Layer 2 switches this result in a loop.
This affects the performance of the network as the result of broadcast packets flooding.
STP puts one port of the switch to forwarding mode and the rest of the ports within the same part of the network to the blocking mode to avoid broadcast packet flooding. STP puts all the ports that are allowing redundant paths to blocking mode and the one port that is left after this is placed in forward mode.
Spanning Tree Algorithm is used by STP to determine the optimal path of switch to the network.
Bridge Protocol Data Units are used to share the information about the optimal path determined by the spanning tree algorithm with other switches.
This information helps STP to eliminate the redundant paths.
So this is how STP allows only one active path to the destination while blocking all other paths to avoid switching loop.
Answer:
I can :) just comment lol
Answer and explanation : The TCP/IP means TRANSMISSION CONTROL PROTOCOL AND INTERNET PROTOCOL It governs all the communication which are performed over network it has a set of protocol. It defines how different types of conversation are performed without any fault through a network
THERE ARE 5 TYPES OF LAYER IN TCP/IP MODEL
- APPLICATION LAYER: It is present at upper level it is used for high level products for the network communication
- TRANSPORT LAYER: This layer is used for transfering the message from one end to other end
- NETWORK LAYER : Routers are present in network layer which are are responsible for data transmission
- DATALINK LAYER : it is used when there is any problem in physical layer for correcting this datalink are used
- PHYSICAL LAYER: Physical; layer are responsible for codding purpose which we used in communication process
Answer:
Answered below
Explanation:
//Program in Java
class MyInfo{
public static void main (String args []){
myFullName("John", "Doe");
myAgeMajorGPA(20, "Biology", 4.3);
}
public void myFullName(String initialName, String middleName){
System.out.println(initialName);
System.out.print(middleName);
}
public void myAgeMajorGPA(int age, String major, double GPA){
System.out.println(age);
System.out.println(GPA);
System.out.print(major);
}
}