360 views

1 Answer

Best answer
2 votes
2 votes

Priority of operators:

"~" > "+" > "<<"

"~" is 1's complement operator

for example: if x=4 = 0100, then ~x =1011 =-5

in given ques.

a=2 {0010}

~a= -3 {1101}

~a+2 = -3+2 = -1

now, -1<<1 = -2

o/p: -2

selected by

Related questions

0 votes
0 votes
0 answers
1
srestha asked Mar 7, 2018
585 views
#include<stdio.h int fun1(int x) { x=14; } int fun2(int x) { x=20; } int main() { int(*p)(),m,n; scanf("%d",&m); if(m) p=fun1; else p=fun2; n=(*p)(); printf("%d",n); retu...
0 votes
0 votes
0 answers
2
srestha asked Mar 6, 2018
395 views
#include<stdio.h int main() { char a[]={'A','B','C','D'}; char *p=&a[0]; *p++; printf("%c%c",*++p, *p); }What will be the output?1)C B2)B B3)B A4)C A
0 votes
0 votes
1 answer
3
Parshu gate asked Nov 27, 2017
623 views
main( ){double x, d = 5.0;int y ;x = d * (x = 2.5/d);printf(“x=%lf\n”,x);x = d*(y=(int)2.5+1.5);printf("x=%lf y=%d\n",x,y);}What is output of above program?