What Will Be The Output For The Following Codep Pre Langc #1177
What will be the output for the following code?</p> <pre><code class="language-c"> #include <stdio.h> #include <math.h> void PowerSet(char *set, int set_size) { unsigned int pow_size = pow(2, set_size); int count, j; for(count = 0; count < pow_size; count++) { for(j = 0; j < set_size; j++) { if(count & (1<<j)) printf("%c", set[j]); } printf(","); } } int main() { char strset[] = {'a','b','c'}; PowerSet(strset, 3); 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 Subsets - Quiz No.1.
What will be the output for the following code?
#include <stdio.h> #include <math.h> void PowerSet(char *set, int set_size) { unsigned int pow_size = pow(2, set_size); int count, j; for(count = 0; count < pow_size; count++) { for(j = 0; j < set_size; j++) { if(count & (1<<j)) printf("%c", set[j]); } printf(","); } } int main() { char strset[] = {'a','b','c'}; PowerSet(strset, 3); return 0; }
a,b,ab,c,ac,bc,abc,
a,b,ab,c,ac,bc,abc
,a,b,ab,c,ac,bc,abc,
,abc,bc,ac,c,ab,b,a,
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