Hi
Here is the basic question which may get confused at some times
++a it increments the value and then it will assign where as a++ it will assign the value and then it increments
int a = 2;
int b = ++a;
Response.Write(b+","+a);
Result:
b : 3
a : 3
int a=2 ;
int b =a++;
Response.write(b+","+a);
Result:
b : 2
a : 3
?? is the operator chks for the null if both c&f are null it results as -1 or else it results first non null value
int? c = 20;
int? f = null ;
int d = c ?? f ?? -1;
Response.Write(d);
Result:
d : 20
int? c = null;
int? f = null;
int d = c ?? f ?? -1;
Response.write(d);
Result:
d : -1;
Convert to binary and left shift bit by 4 digits and then conver to numeric number.Shortcut method is 1*4*4.
int i = 1;
int j = i <<4
Response.Write(j);
Result:
j : 16
Convert to binary and right shift by 2 digits and convert to numeric number .Shortcut Method is i =8 then 8/2 = 4/2 = 2
int i = 8;
int j = i >> 2;
Response.Write(j);
Result:
j : 2
No comments:
Post a Comment