Consider a scenario where you need to store a variable that can hold values up to 10 billion. Which data type is most suitable?
Aint
Blong int
Clong long int
Dfloat
Correct Answer:
C. long long int
EXPLANATION
int max is ~2.1 billion, long int varies (may be 32 or 64 bits). long long int guarantees 64 bits with max ~9.2 quintillion, sufficient for 10 billion.
Which storage class has both 'static' and 'auto' properties in certain contexts?
Aregister
Bextern
Cstatic
Dvolatile
Correct Answer:
A. register
EXPLANATION
register requests compiler to store variable in CPU register for faster access but falls back to memory if unavailable, combining automatic allocation with optimization hints.
Which of the following is a valid declaration of a constant array?
Aconst int arr[5] = {1,2,3,4,5};
Bint const arr[5];
Cconst int arr[];
DBoth A and B
Correct Answer:
D. Both A and B
EXPLANATION
Both declarations make the array elements constant. Option A initializes the array, while B declares it without initialization (valid at global scope).