GATE Exam  >  GATE Questions  >  Consider the following function.Void rajkumar... Start Learning for Free
Consider the following function.
Void rajkumar(int n)
{
enqueue(Q,0);
enqueue(Q,1);
for (i=0;i<n;i++)
{
x = dequeue(Q);
y = dequeue(Q);
enqueue(O,y);
enqueue(Q+x+y);
print(x);
}
}
What is the functionality of above function rajkumar?
  • a)
    Prints numbers from 0 to n-1
  • b)
    Prints number from n-1 to 0
  • c)
    Prints first n fibboacci numbersCorrect Answer
  • d)
    Prints first n fibbonacci number in reverse order
Correct answer is option 'C'. Can you explain this answer?
Verified Answer
Consider the following function.Void rajkumar(int n){enqueue(Q,0);enqu...
The function prints first n fibbonacci numbers note that 0 and 1 are initially there in the queue. In every iteration of loop, sum of two queue items is enqueued and the front item is dequeued.
View all questions of this test
Most Upvoted Answer
Consider the following function.Void rajkumar(int n){enqueue(Q,0);enqu...
The given function appears to be incomplete as it is missing the closing bracket for the loop and the function itself. Additionally, it is not clear what the purpose of the function is or what the variables Q and i represent.

However, based on the provided code, it seems like the function is enqueueing the values 0 and 1 into a queue called Q. It then iterates from 0 to n (assuming the variable n is defined somewhere outside the function) and performs some operations within the loop. Without the complete code or a clear explanation of what the function is supposed to do, it is difficult to determine the exact purpose or functionality of this code snippet.
Explore Courses for GATE exam

Similar GATE Doubts

Consider the following function.Void rajkumar(int n){enqueue(Q,0);enqueue(Q,1);for (i=0;i<n;i++){x = dequeue(Q);y = dequeue(Q);enqueue(O,y);enqueue(Q+x+y);print(x);}}What is the functionality of above function rajkumar?a)Prints numbers from 0 to n-1b)Prints number from n-1 to 0c)Prints first n fibboacci numbersCorrect Answerd)Prints first n fibbonacci number in reverse orderCorrect answer is option 'C'. Can you explain this answer?
Question Description
Consider the following function.Void rajkumar(int n){enqueue(Q,0);enqueue(Q,1);for (i=0;i<n;i++){x = dequeue(Q);y = dequeue(Q);enqueue(O,y);enqueue(Q+x+y);print(x);}}What is the functionality of above function rajkumar?a)Prints numbers from 0 to n-1b)Prints number from n-1 to 0c)Prints first n fibboacci numbersCorrect Answerd)Prints first n fibbonacci number in reverse orderCorrect answer is option 'C'. Can you explain this answer? for GATE 2024 is part of GATE preparation. The Question and answers have been prepared according to the GATE exam syllabus. Information about Consider the following function.Void rajkumar(int n){enqueue(Q,0);enqueue(Q,1);for (i=0;i<n;i++){x = dequeue(Q);y = dequeue(Q);enqueue(O,y);enqueue(Q+x+y);print(x);}}What is the functionality of above function rajkumar?a)Prints numbers from 0 to n-1b)Prints number from n-1 to 0c)Prints first n fibboacci numbersCorrect Answerd)Prints first n fibbonacci number in reverse orderCorrect answer is option 'C'. Can you explain this answer? covers all topics & solutions for GATE 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for Consider the following function.Void rajkumar(int n){enqueue(Q,0);enqueue(Q,1);for (i=0;i<n;i++){x = dequeue(Q);y = dequeue(Q);enqueue(O,y);enqueue(Q+x+y);print(x);}}What is the functionality of above function rajkumar?a)Prints numbers from 0 to n-1b)Prints number from n-1 to 0c)Prints first n fibboacci numbersCorrect Answerd)Prints first n fibbonacci number in reverse orderCorrect answer is option 'C'. Can you explain this answer?.
Solutions for Consider the following function.Void rajkumar(int n){enqueue(Q,0);enqueue(Q,1);for (i=0;i<n;i++){x = dequeue(Q);y = dequeue(Q);enqueue(O,y);enqueue(Q+x+y);print(x);}}What is the functionality of above function rajkumar?a)Prints numbers from 0 to n-1b)Prints number from n-1 to 0c)Prints first n fibboacci numbersCorrect Answerd)Prints first n fibbonacci number in reverse orderCorrect answer is option 'C'. Can you explain this answer? in English & in Hindi are available as part of our courses for GATE. Download more important topics, notes, lectures and mock test series for GATE Exam by signing up for free.
Here you can find the meaning of Consider the following function.Void rajkumar(int n){enqueue(Q,0);enqueue(Q,1);for (i=0;i<n;i++){x = dequeue(Q);y = dequeue(Q);enqueue(O,y);enqueue(Q+x+y);print(x);}}What is the functionality of above function rajkumar?a)Prints numbers from 0 to n-1b)Prints number from n-1 to 0c)Prints first n fibboacci numbersCorrect Answerd)Prints first n fibbonacci number in reverse orderCorrect answer is option 'C'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of Consider the following function.Void rajkumar(int n){enqueue(Q,0);enqueue(Q,1);for (i=0;i<n;i++){x = dequeue(Q);y = dequeue(Q);enqueue(O,y);enqueue(Q+x+y);print(x);}}What is the functionality of above function rajkumar?a)Prints numbers from 0 to n-1b)Prints number from n-1 to 0c)Prints first n fibboacci numbersCorrect Answerd)Prints first n fibbonacci number in reverse orderCorrect answer is option 'C'. Can you explain this answer?, a detailed solution for Consider the following function.Void rajkumar(int n){enqueue(Q,0);enqueue(Q,1);for (i=0;i<n;i++){x = dequeue(Q);y = dequeue(Q);enqueue(O,y);enqueue(Q+x+y);print(x);}}What is the functionality of above function rajkumar?a)Prints numbers from 0 to n-1b)Prints number from n-1 to 0c)Prints first n fibboacci numbersCorrect Answerd)Prints first n fibbonacci number in reverse orderCorrect answer is option 'C'. Can you explain this answer? has been provided alongside types of Consider the following function.Void rajkumar(int n){enqueue(Q,0);enqueue(Q,1);for (i=0;i<n;i++){x = dequeue(Q);y = dequeue(Q);enqueue(O,y);enqueue(Q+x+y);print(x);}}What is the functionality of above function rajkumar?a)Prints numbers from 0 to n-1b)Prints number from n-1 to 0c)Prints first n fibboacci numbersCorrect Answerd)Prints first n fibbonacci number in reverse orderCorrect answer is option 'C'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice Consider the following function.Void rajkumar(int n){enqueue(Q,0);enqueue(Q,1);for (i=0;i<n;i++){x = dequeue(Q);y = dequeue(Q);enqueue(O,y);enqueue(Q+x+y);print(x);}}What is the functionality of above function rajkumar?a)Prints numbers from 0 to n-1b)Prints number from n-1 to 0c)Prints first n fibboacci numbersCorrect Answerd)Prints first n fibbonacci number in reverse orderCorrect answer is option 'C'. Can you explain this answer? tests, examples and also practice GATE tests.
Explore Courses for GATE exam
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev