Yash Sir Sanchit Sir: Visit Our Website
Yash Sir Sanchit Sir: Visit Our Website
Download KG App
Ans. A
256*256=65536 exceeded the range of integer and hence wrap around takes
place and value of 256*256 becomes 0. Now (256*256-1) will become (0-1) = -1.
So the malloc in line ptr=(int*)malloc(-1) becomes fail to create memory as the
size is negative, and returns NULL.
Ans. A
Ans. B
256*256L=65536 can be stored in long int. Here 256L means long int. Hence
(65536-1) = 65535 bytes (64KB-1) memory will be allocated by malloc()
successfully.
Ans. C
KGYT
on