C Array Test 11) In C, if we pass an array as an argument to a function, what actually get passed?
The correct option is (b). Explanation: In C language when we pass an array as a function argument, then the Base address of the array will be passed. 2) What will be the output of the below program?
The correct option is (a). Explanation: In the program we are comparing the base address of 'x' and 'y' and they are not same. Therefore the program has No output. 3) What will be the output of the below program?
The correct option is (c). Explanation: The strlen(x) function is used for finding the length of string 'x'. In program the length of string is count of character upto '\0'. Hence the string length output is 2. The sizeof(x) function is used for finding the size of string 'x'. In program sizeof() returns the size of the complete array. Hence the size of array output is 9. Therefore the combined output of the program is 2 9. 4) A pointer to a block of memory is effectively same as an array.
The correct option is (a). Explanation: Using the standard library function malloc() and treat it as an array. The value of array is same as pointer to a block of memory. Therefore it is possible to allocate block of memory at run time in array. 5) Which of the following statements are correct about array in C?
The correct option is (b). Explanation:
Therefore statements '2' and '3' are correct. |