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

#include<stdio.h> main() { char s[]={'a','b','c','\n','c','\0'}; char *p,*str,*str1; p=&s[3]; str=p; str1=s; printf("%d",++*p + ++*str1-32); }

2 Answers   CNSI,


#define FALSE -1 #define TRUE 1 #define NULL 0 main() { if(NULL) puts("NULL"); else if(FALSE) puts("TRUE"); else puts("FALSE"); }

1 Answers  


int a = 10 + 10 .... ,... A = A * A What would be the value of A? The answer is 120!! Could anyone explain this to me.

2 Answers   Bosch, eInfochips, HCL, IHCL,


how many processes will gate created execution of -------- fork(); fork(); fork(); -------- Please Explain... Thanks in advance..!

8 Answers   GATE,


const int perplexed = 2; #define perplexed 3 main() { #ifdef perplexed #undef perplexed #define perplexed 4 #endif printf("%d",perplexed); } a. 0 b. 2 c. 4 d. none of the above

1 Answers   emc2, HCL,






program to find the roots of a quadratic equation

14 Answers   College School Exams Tests, Engineering, HP, IIIT, Infosys, Rajiv Gandhi University of Knowledge Technologies RGUKT, SSC,


main( ) { char *q; int j; for (j=0; j<3; j++) scanf(“%s” ,(q+j)); for (j=0; j<3; j++) printf(“%c” ,*(q+j)); for (j=0; j<3; j++) printf(“%s” ,(q+j)); }

1 Answers  


Is the following code legal? typedef struct a aType; struct a { int x; aType *b; };

1 Answers  


void main() { int c; c=printf("Hello world"); printf("\n%d",c); }

2 Answers  


main() { int c=- -2; printf("c=%d",c); }

1 Answers   TCS,


main(){ int a= 0;int b = 20;char x =1;char y =10; if(a,b,x,y) printf("hello"); }

1 Answers   TCS,


write a c program to Create a registration form application by taking the details like username, address, phone number, email along with password and confirm password (should be same as password).Ensure that the password is of 8 characters with only numbers and alphabets. Take such details for 5 users and display the details. In place of password display “****”. (Use Structures).

0 Answers   CDAC, College School Exams Tests,


Categories