C Functions Test 26) Which library function can change an unsigned long integer to a string?
The correct option is (c). Explanation: The function ultoa() is used for converting an unsigned long integer to a string. 7) What is the output of below C program?
The correct option is (d). Explanation: Step 1: int k=30; The variable k is declared as an integer type and initialized to 30. Step 2: k=function1(k= function1(k=function1(k))); The function1 (k) increment the value of k by 1 and return it. In program function1(k) is called 3 times. Hence the value of k increments from k=30 to 33. Therefore result stored in the variable k=33. Step 3: printf("k=%d\n", k); It prints the value of variable k =33. 8) What is the purpose of using fflush() function?
The correct option is (d). Explanation: Using "flush()" function we can flush any buffered output associated with a filename, which is either a shell command for redirecting output or a file opened for writing. For example: 9) What is the value returned by strcmp() function when two strings are the equal?
The correct option is (c). Explanation: C library function strcmp() compares the two strings with each other and the value is return accordingly. Comparison occurs between a first string (str1) with a second string (str2). On comparing the two string, the values return by a function strcmp() are:
10) Which function disconnects the stream from a file pointer?
The correct option is (a). Explanation: Function that disconnects the stream from a file pointer is fclose(), it flushes the buffers associated with a stream and disconnects the stream from a file pointer. |