Which preprocessor directive is used to include a custom header file?
A#include
B#include "filename"
C#include [filename]
D#include {filename}
Correct Answer:
B. #include "filename"
Explanation:
Custom/local header files are included using double quotes: #include "filename". Standard library headers use angle brackets: #include <filename>. The compiler searches for quoted files in the current directory first.
Which function is used to read a single character from standard input?
Ascanf()
Bgetchar()
Cgets()
Dfgetc()
Correct Answer:
B. getchar()
Explanation:
getchar() reads a single character from standard input (stdin). While fgetc() can also read a character, getchar() is the standard dedicated function for this purpose.