0/47

C

Which Code sample will eventually cause the computer to run out of memory?

c while(1) { char *smallString = (char *) malloc(10); } c long long number = 1; while(1) number *= 2; c while(1) { char hugeString[1000000L]; memset(hugeString, 0, 1000000L); } c while(1) { long *bigArray = (long *) malloc(sizeof(long) * 1000); memset(bigArray, 1000000, 1000); free(bigArray); }

1.

c while(1) { char *smallString = (char *) malloc(10); }

2.

c long long number = 1; while(1) number *= 2;

3.

c while(1) { char hugeString[1000000L]; memset(hugeString, 0, 1000000L); }

4.

c while(1) { long *bigArray = (long *) malloc(sizeof(long) * 1000); memset(bigArray, 1000000, 1000); free(bigArray); }

Q 1 / 47

Press C to Clear

Press R to Reset

Press N or Enter to Next or Check answer

Press 1,2,3, ... to toggle answers