Home / MCQ Bank / Computer
Computer Dynamic Programming In Data Structures

What will be the output when the following code is executed? #include<stdio.h> int fibo(int n) { int i; int fibo_terms[100]; fibo_terms[0]=0; fibo_terms[1]=1; for(i=2;i<=n;i++) fibo_terms[i] = fibo_terms[i-2] + fibo_terms[i-1]; return fibo_terms[n]; } int main() { int r = fibo(8); printf("%d",r); return 0; }

Select the best option to verify your answer:
Show Correct Answer
Correct Answer: Option D • 21

Related Computer Questions

Which method is used to listen for incoming connection requests in a TCP server using the TcpListener class in C#? The special database that always exists after setting up MySQL in a computer is ______ Which header file should be included if a function has to be defined such that it can accept variable number of arguments? Which of the following lines should be inserted to complete the following recursive implementation used to find the length of a linked list? #include<stdio.h> #include<stdlib.h> struct Node { int val; struct Node *next; }*head; int recursive_get_len(struct Node *current_node) { if(current_node == 0) return 0; return _____; } int main() { int arr[10] = {1,2,3,4,5}, n = 5, i; struct Node *temp, *newNode; head = (struct Node*)malloc(sizeof(struct Node)); head->next = 0; temp = head; for(i=0; i<n; i++) { newNode = (struct Node*)malloc(sizeof(struct Node)); newNode->val = arr[i]; newNode->next = 0; temp->next = newNode; temp = temp->next; } int len = recursive_get_len(head->next); printf("%d",len); return 0; } Which of the following properties does a simple graph not hold?