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 ?    22 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

Can you send Code for Run Length Encoding Of BMP Image in C Language in linux(i.e Compression and Decompression) ?

0 Answers   Honeywell,


plz send me all data structure related programs

2 Answers  


C program to print magic square of order n where n > 3 and n is odd

2 Answers   Accenture,


#include <stdio.h> #define a 10 main() { #define a 50 printf("%d",a); }

2 Answers  


main() { int y; scanf("%d",&y); // input given is 2000 if( (y%4==0 && y%100 != 0) || y%100 == 0 ) printf("%d is a leap year"); else printf("%d is not a leap year"); }

1 Answers  






Sorting entire link list using selection sort and insertion sort and calculating their time complexity

1 Answers   Infosys, Microsoft, NetApp,


void main() { int i=5; printf("%d",i+++++i); }

3 Answers  


What is full form of PEPSI

0 Answers  


write a program for area of circumference of shapes

0 Answers  


main() { int i=4,j=7; j = j || i++ && printf("YOU CAN"); printf("%d %d", i, j); }

1 Answers  


What is the subtle error in the following code segment? void fun(int n, int arr[]) { int *p=0; int i=0; while(i++<n) p = &arr[i]; *p = 0; }

1 Answers  


Is there any difference between the two declarations, 1. int foo(int *arr[]) and 2. int foo(int *arr[2])

1 Answers  


Categories