What Will Be The Output For The Following Codep Pre Langc #1158
What will be the output for the following code?</p> <pre><code class="language-c"> #include<stdio.h> void combination(int arr[],int n,int r,int index,int aux[],int i); void print(int arr[], int n, int r) { int aux[r]; combination(arr, n, r, 0, aux, 0); } void combination(int arr[], int n, int r, int index, int aux[], int i) { if (index == r) { for (int j=0; j<r; j++) printf("%d ",aux[j]); printf(", "); return; } if (i >= n) return; aux[index] = arr[i]; combination(arr, n, r, index+1, aux, i+1); combination(arr, n, r, index, aux, i+1); } int main() { int arr[] = {1, 2,2}; int r = 2; int n = sizeof(arr)/sizeof(arr[0]); print(arr, n, r); return 0; } </code></pre>
This multiple choice question (MCQ) is related to the book/course gs gs122 Data Communication and Computer Network. It can also be found in gs gs122 Number Theory - Generating Combinations - Quiz No.1.
Similar question(s) are as followings:
Online Quizzes of gs122 Data Communication and Computer Network
Sorting - Insertion Sort - Quiz No.1
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - Insertion Sort - Quiz No.2
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - Insertion Sort - Quiz No.3
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - LSD Radix Sort - Quiz No.1
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - MSD Radix Sort - Quiz No.1
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - MSD Radix Sort - Quiz No.2
gs gs122 Data Communication and Computer Network
Online Quizzes