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

How to count a sum, when the numbers are read from stdin and stored into a structure?

1 Answers  


You are given any character string. Find the number of sets of vowels that come in the order of aeiou in the given string. For eg., let the given string be DIPLOMATIC. The answer returned must be "The number of sets is 2" and "The sets are "IO and AI". Vowels that form a singleton set must be neglected. Try to post the program executable in gcc or g++ or in java.

3 Answers  


main(){ unsigned int i; for(i=1;i>-2;i--) printf("c aptitude"); }

2 Answers  


main() { int *ptr=(int*)malloc(sizeof(int)); *ptr=4; printf("%d",(*ptr)+++*ptr++); }

3 Answers   GNITC,


func(a,b) int a,b; { return( a= (a==b) ); } main() { int process(),func(); printf("The value of process is %d !\n ",process(func,3,6)); } process(pf,val1,val2) int (*pf) (); int val1,val2; { return((*pf) (val1,val2)); }

1 Answers   Satyam,






Write a Program that Inputs 10 Numbers in an Array and Show the Maximum Number

2 Answers   Ace Info,


Write a C program to print ‘Campus Force training’ without using even a single semicolon in the program.

3 Answers   Wipro,


#include<stdio.h> main() { struct xx { int x; struct yy { char s; struct xx *p; }; struct yy *q; }; }

1 Answers  


Find your day from your DOB?

15 Answers   Accenture, Microsoft,


What is the problem with the following code segment? while ((fgets(receiving array,50,file_ptr)) != EOF) ;

1 Answers  


main() { int i, n; char *x = “girl”; n = strlen(x); *x = x[n]; for(i=0; i<n; ++i) { printf(“%s\n”,x); x++; } }

2 Answers  


Write a program to receive an integer and find its octal equivalent?

7 Answers  


Categories