C Functions Test 11) What is the built-in library function for comparing the two strings?
The correct option is (a). Explanation: The strcmp() is a built-in function available in "string.h" header file. It is used for comparing the two strings. It returns 0 if both are same strings. It returns positive value greater than 0 if first string is greater than second string, otherwise it returns negative value. 2) What is passed when we pass an array as a function argument?
The correct option is (a). Explanation: On passing the name of array as function argument; the name contain the base address of an array and base address is updated inside a main function. 3) Which function finds the first occurrence of a substring in another string?
The correct option is (c). Explanation: The first occurrence of a substring in another string is founds in strstr() function. 4) What is the built-in library function for adjusting the allocated dynamic memory size.
The correct option is (c). Explanation: realloc() is a built in library function for adjusting the dynamic memory size. malloc() and calloc() allocates the memory but don't resize. There is no built in function with a name resize(). 5) Which keyword is used to transfer control from a function back to the calling function?
The correct option is (a). Explanation: In C language, the return function stops the execution of function and returns a value to calling function. Execution is begins in a calling function by instantly following the call. |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India