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

4th Jun 2018, 6:34 AM
Nabyendu Barui
Nabyendu Barui - avatar
3 Réponses
+ 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)
4th Jun 2018, 7:47 AM
blackcat1111
blackcat1111 - avatar
+ 3
1/3?
4th Jun 2018, 6:52 AM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar
+ 1
d, since 'x'-'w' is 1 and 1/3 is rounded to 0. but the real ascii value of H is 72
4th Jun 2018, 7:49 AM
Max
Max - avatar