1,109 views
1 votes
1 votes
{

int i ;

int power_of_ten[5] = {00001,00010,00100,01000};

for(i=0;i<4;++i)

printf("%d",power_of_ten[i]);

}

a.1 4 8 16

b. 1 8 64 512

c.compilation error

d.none of the above

1 Answer

Best answer
3 votes
3 votes

When we prefix a '0' before a number in C program , this means the number is in octal representation..And for hexadecimal representation we prefix by '0x'..

Hence on printing the decimal equivalent of  00001 , we will get  80 = 1..

         on printing the decimal equivalent of  00010 , we get  81  =  8   and so on for the remaining numbers too..

Hence B) should be the correct answer..

selected by

Related questions

94
views
2 answers
1 votes
kirmada asked 5 days ago
94 views
#include <stdio.h> int main() { // Write C code here int i=10,*p,**q,***r; p=&i; *p=15; q=&p; **q=20; r=&q; ***r=*p+1; printf("%d",i); return 0; }answer the output as integer _________
58
views
0 answers
1 votes
shivamSK asked 6 days ago
58 views
#include <stdio.h> void f(int (*x)(int)); int mysh(int); int (*sh)() = mysh; int main() { f(sh); sh++; for(int x=sh;x>=0;x--){ if(x){ printf ... A:10C:10 i will go thereB:10 i will go there number of timesD:10 i will go here number of times
105
views
1 answers
1 votes
shivamSK asked Jun 9
105 views
#include <stdio.h> double pom(double x,int n){ if(n==1) return x; else return x*pom(x,n-1); --n; } int main() { int a=pom(2,5); printf("%d",a); return 0; }what is the output of following c codeA:2B:32C:16D:NONE
83
views
1 answers
1 votes
shivamSK asked Jun 9
83 views
what is output of this c codeA: 321B: 123C: error(infinite/segmentation)D:333