11 What is the range of rand15 a 0 15 b 0 15 c 0 15 d 0 15
11. What is the range of rand()%15 ?
a) (0, 15)
b) [0, 15)
c) (0, 15]
d) [0, 15]
e) None of the abover
Solution
rand() will give a random number but when 15 is used with modulus operator than the random number will be divided by the number 15 and the remainder will be returned hence when a number divided by 15 what values of remainder are possible [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]
which is [0,15)
hence the option b is the answer.
![11. What is the range of rand()%15 ? a) (0, 15) b) [0, 15) c) (0, 15] d) [0, 15] e) None of the aboverSolutionrand() will give a random number but when 15 is us 11. What is the range of rand()%15 ? a) (0, 15) b) [0, 15) c) (0, 15] d) [0, 15] e) None of the aboverSolutionrand() will give a random number but when 15 is us](/WebImages/25/11-what-is-the-range-of-rand15-a-0-15-b-0-15-c-0-15-d-0-15-1064320-1761556474-0.webp)