AndrewJD
BAN USER
Comments (11)
Reputation 70
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
I would say neither option is correct.
- AndrewJD July 31, 2014a. The program cannot crash OS. Memory either will be allocated or not.
b. Incorrect due virtual memory concept.
c. Memory will be allocated but WITHOUT any guarantee it will be a PHYSICAL memory. Actually, only single physical memory page is needed here.
d. It depends from many factors...
For instance on 32-bit platform 1 << 31 after conversion to size_t gives 2147483648 bytes and allocation likely will be satisfied.
On other hand on 64-bit platform 1 << 31 after conversion to size_t gives 0xffffffff80000000 bytes and allocation will fail.