Question 21
In C programming, what does the 'extern' storage class declare?
Option C is correct. The 'extern' keyword tells the compiler that a variable or function is declared elsewhere with external linkage.
In C programming, what does the 'extern' storage class declare?
Option C is correct. The 'extern' keyword tells the compiler that a variable or function is declared elsewhere with external linkage.
What is the output of the bitwise AND operation (5 & 3) in C/C++?
Option B is correct. 5 in binary is 0101, and 3 is 0011. Performing bitwise AND: 0101 & 0011 = 0001 (which is 1).
Which preprocessor directive is used in C/C++ to define macro constants?
Option C is correct. #define is a preprocessor directive used to define symbolic constants and macros.
In C++, what is the default member access specifier for members declared inside a 'class' versus a 'struct'?
Option B is correct. In C++, the only difference between class and struct is that class members/inheritance default to private, whereas struct defaults to public.
What is the purpose of the pseudo-random number generator function rand() in C standard library stdlib.h?
Option A is correct. rand() returns a pseudo-random integer value in the range [0, RAND_MAX]. srand(seed) is used to seed the generator.