Curioustab
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Home
»
C++ Programming
»
Functions
What will be the output of the following program? #include<iostream.h> struct CuriousTabArray { int arr[5]; public: void CuriousTabFunction(); void Display(); }; void CuriousTabArray::CuriousTabFunction() { static int i = 0, j = 4; i++; j--; if(j > 0) CuriousTabFunction(); int tmp = arr[i]; arr[i] = arr[j]; arr[j] = tmp; i--; j++; } void CuriousTabArray::Display() { for(int i = 0; i < 5; i++) cout<< arr[i] << " "; } int main() { CuriousTabArray objArr = {{5, 6, 3, 9, 0}}; objArr.CuriousTabFunction(); objArr.Display(); return 0; }
5 6 3 9 0
0 9 3 6 5
0 5 6 3 9
0 6 3 9 5
None of these
Show Answer
Correct Answer:
0 6 3 9 5
← Previous
Next →
Discussion & Comments
No comments yet. Be the first to comment!
Name:
Comment:
Post Comment