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 |
How to count a sum, when the numbers are read from stdin and stored into a structure?
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.
main(){ unsigned int i; for(i=1;i>-2;i--) printf("c aptitude"); }
main() { int *ptr=(int*)malloc(sizeof(int)); *ptr=4; printf("%d",(*ptr)+++*ptr++); }
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)); }
Write a Program that Inputs 10 Numbers in an Array and Show the Maximum Number
Write a C program to print ‘Campus Force training’ without using even a single semicolon in the program.
#include<stdio.h> main() { struct xx { int x; struct yy { char s; struct xx *p; }; struct yy *q; }; }
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) ;
main() { int i, n; char *x = “girl”; n = strlen(x); *x = x[n]; for(i=0; i<n; ++i) { printf(“%s\n”,x); x++; } }
Write a program to receive an integer and find its octal equivalent?