main()

{

int i;

clrscr();

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

{

printf("%d\n", 1L << i);

}

}

a. 5, 4, 3, 2, 1

b. 0, 1, 2, 3, 4

c. 0, 1, 2, 4, 8

d. 1, 2, 4, 8, 16

Answers were Sorted based on User's Feedback



main() { int i; clrscr(); for(i=0;i<5;i++) { printf("%d\..

Answer / thilaga

Clearly ans is d.
1<<0 times is 0001.so in decimal 1.
1<<1 times is 0010.so in decimal 2.
1<<2 times is 0100.so in decimal 4.
1<<3 times is 1000.so in decimal 8.
1<<4 times is 0001 0000.so in decimal 16.
thus it becomes 1,2,4,8,16.

Is This Answer Correct ?    24 Yes 2 No

main() { int i; clrscr(); for(i=0;i<5;i++) { printf("%d\..

Answer / guest

d) L does't make any diff.

Is This Answer Correct ?    21 Yes 4 No

main() { int i; clrscr(); for(i=0;i<5;i++) { printf("%d\..

Answer / karthi

b.o,1,2,3,4

Is This Answer Correct ?    0 Yes 9 No

main() { int i; clrscr(); for(i=0;i<5;i++) { printf("%d\..

Answer / aditi

none of them is correct...

coz l does'nt make any diff...

and << means a left shift

o in binary is 0 only...
and wen it is lft shfted it remains same...
1 in binary is 01 >> makes it 010 i.e 2
nd so on...

Is This Answer Correct ?    1 Yes 15 No

Post New Answer

More C Code Interview Questions

Derive expression for converting RGB color parameters to HSV values

1 Answers  


write a c-program to display the time using FOR loop

3 Answers   HCL,


void main() { static int i=i++, j=j++, k=k++; printf(“i = %d j = %d k = %d”, i, j, k); }

3 Answers  


what is the output of the below program & why ? #include<stdio.h> void main() { int a=10,b=20,c=30; printf("%d",scanf("%d%d%d",&a,&b,&c)); }

6 Answers   CSC, IIIT,


main() { int i=1; while (i<=5) { printf("%d",i); if (i>2) goto here; i++; } } fun() { here: printf("PP"); }

1 Answers  






how to print 1 2 3 4 5 6 7 8 9 10 9 8 7 6 5 4 3 2 1 using any loop(for or while) only once(only 1 loop) and maximum 2 variables using C.

19 Answers   Cap Gemini, Infosys,


main() { char c=' ',x,convert(z); getc(c); if((c>='a') && (c<='z')) x=convert(c); printf("%c",x); } convert(z) { return z-32; }

1 Answers  


pls anyone can help me to write a code to print the values in words for any value.Example:1034 to print as "one thousand and thirty four only"

2 Answers  


int a=1; printf("%d %d %d",a++,a++,a); need o/p in 'c' and what explanation too

1 Answers  


union u { union u { int i; int j; }a[10]; int b[10]; }u; main() { printf("\n%d", sizeof(u)); printf(" %d", sizeof(u.a)); // printf("%d", sizeof(u.a[4].i)); } a. 4, 4, 4 b. 40, 4, 4 c. 1, 100, 1 d. 40 400 4

3 Answers   HCL,


#include<stdio.h> main() { int i=1,j=2; switch(i) { case 1: printf("GOOD"); break; case j: printf("BAD"); break; } }

1 Answers  


write a c program to input initial & final time in the format hh:mm and find the time intervel between them? Ex inputs are initial 06:30 final 00:05 and 23:22 final 22.30

0 Answers  


Categories