C String Test 311) Function fopen() with the mode "r+" used to open a file for _______
The correct option is (b). Explanation: Function fopen() opens the file and mode "r+" used for checking the file should exist and opens for both reading writing operation. Therefore in file handling reading and writing operation is performed by function fopen() with the mode "r+". 12) Which is used in mode string for opening the file in binary mode?
The correct option is (c). Explanation: For opening the file in binary mode the alphabet 'b' is used in mode string. To perform unformatted data I/O a file is opened in binary mode. 13) Which of the following statement is correct?
The correct option is (a). Explanation: On comparing the two string, the values return by a function strcmp() are:
The strcmp() return an int value and from the given statement only statement (a) is correct i.e. strcmp(s1, s2) returns 0 if s1==s2 14) What will be the output of the below program?
The correct option is (b). Explanation: The string is a collection of characters terminated by '\0'. Step 1: char stri[] = "Java\0\Tpoint\0"; The variable stri is declared as an array of characters and it is initialized with value "Java". Step 2: printf("%s\n", stri); it print the value of stri. Therefore the output of the program isJava. 15) What will be the output of the below program?
The correct option is (c). Explanation: The strcat() function is used for string concatenation. The strcat(first_string, second_string) function concatenates two strings and result is returned to first_string. Therefore the output of the program is helloc. |