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
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 |
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 |
main() { int i, n; char *x = “girl”; n = strlen(x); *x = x[n]; for(i=0; i<n; ++i) { printf(“%s\n”,x); x++; } }
main() { static char names[5][20]={"pascal","ada","cobol","fortran","perl"}; int i; char *t; t=names[3]; names[3]=names[4]; names[4]=t; for (i=0;i<=4;i++) printf("%s",names[i]); }
Finding a number which was log of base 2
How do you verify if the two sentences/phrases input is an anagram using predefined functions in string.h and by using arrays?
#define f(g,g2) g##g2 main() { int var12=100; printf("%d",f(var,12)); }
main(){ unsigned int i; for(i=1;i>-2;i--) printf("c aptitude"); }
What are the files which are automatically opened when a C file is executed?
find A^B using Recursive function
main() { printf("%d", out); } int out=100;
main() { int x=5; clrscr(); for(;x==0;x--) { printf("x=%d\n”", x--); } } a. 4, 3, 2, 1, 0 b. 1, 2, 3, 4, 5 c. 0, 1, 2, 3, 4 d. none of the above
Write a procedure to implement highlight as a blinking operation
main() { char c=' ',x,convert(z); getc(c); if((c>='a') && (c<='z')) x=convert(c); printf("%c",x); } convert(z) { return z-32; }