0
If ASCII value of 'x' is 120 , then what is the value of the 'H' , if H =('x' - 'w')/3 ;
a. 1 b. 2 c. 3 d. 0
3 Answers
+ 4
Answer is 1/3 (or 0 depending on which language you're using)
Every character has an ASCII code. The one for 'x' is 120. The ASCII codes are sequential, and as 'w' is just before 'x', its ASCII code is 119. Hence ('x' - 'w') = 120 - 119 = 1. Then you divide that by 3 and you get 1/3 (or 0, if you're doing integer division). (When you perform operations on characters, you use their ASCII values.)
(Hope I didn't get anything wrong)
+ 3
1/3?
+ 1
d, since 'x'-'w' is 1 and 1/3 is rounded to 0. but the real ascii value of H is 72