-
Which function is used to print formatted text to the standard output in C?
A) `printf`
B) `scanf`
C) `gets`
D) `puts`
Answer: A) `printf`
-
What is the purpose of the `scanf` function in C?
A) To read a single character from the keyboard
B) To read a string of characters from a file
C) To read formatted data from the standard input
D) To print data to the standard output
Answer: C) To read formatted data from the standard input
-
Which function is used to read a line of text from the standard input in C?
A) `gets`
B) `scanf`
C) `printf`
D) `fgets`
Answer: D) `fgets`
-
What is the purpose of the `puts` function in C?
A) To print a string to the standard output followed by a newline character
B) To read input from a file
C) To perform arithmetic calculations
D) To concatenate two strings
Answer: A) To print a string to the standard output followed by a newline character
-
Which function is used to open a file for reading in C?
A) `fopen`
B) `fclose`
C) `fread`
D) `fwrite`
Answer: A) `fopen`
-
What is the purpose of the `fclose` function in C?
A) To close a file after reading or writing
B) To open a file for reading
C) To flush the file buffer
D) To rename a file
Answer: A) To close a file after reading or writing
-
Which function is used to write a character to a file in C?
A) `fputc`
B) `fgets`
C) `fscanf`
D) `fread`
Answer: A) `fputc`
-
What is the purpose of the `fscanf` function in C?
A) To read a character from a file
B) To read a formatted input from a file
C) To write data to a file
D) To close a file
Answer: B) To read a formatted input from a file
-
Which function is used to move the file pointer to a specific location in a file in C?
A) `fseek`
B) `fread`
C) `fwrite`
D) `ftell`
Answer: A) `fseek`
-
What is the purpose of the `rewind` function in C?
A) To rewind the tape drive
B) To move the file pointer to the beginning of the file
C) To close the file
D) To rename a file
Answer: B) To move the file pointer to the beginning of the file
-
Which function is used to read a character from the standard input in C?
A) `gets`
B) `fgetc`
C) `scanf`
D) `getchar`
Answer: D) `getchar`
-
What is the purpose of the `putchar` function in C?
A) To read a character from a file
B) To print a character to the standard output
C) To close a file
D) To perform arithmetic calculations
Answer: B) To print a character to the standard output
-
Which function is used to write a character to a file in C?
A) `puts`
B) `fputc`
C) `fputs`
D) `printf`
Answer: B) `fputc`
-
What is the purpose of the `getchar` function in C?
A) To read a character from a file
B) To read a string from the standard input
C) To read a character from the standard input
D) To print a character to the standard output
Answer: C) To read a character from the standard input
-
Which function is used to write a string to the standard output in C?
A) `puts`
B) `printf`
C) `fputs`
D) `print`
Answer: A) `puts`
-
What is the purpose of the `fputs` function in C?
A) To read a string from a file
B) To write a string to a file
C) To print a formatted string to the standard output
D) To perform arithmetic calculations
Answer: B) To write a string to a file
-
Which function is used to read a line of text from the standard input in C?
A) `fgets`
B) `fread`
C) `scanf`
D) `gets`
Answer: A) `fgets`
-
What is the purpose of the `puts` function in C?
A) To read a character from a file
B) To write a character to a file
C) To print a string to the standard output followed by a newline character
D) To perform arithmetic calculations
Answer: C) To print a string to the standard output followed by a newline character
-
Which function is used to write a character array to a file in C?
A) `fread`
B) `fwrite`
C) `fputs`
D) `fputc`
Answer: C) `fputs`
-
What is the purpose of the `fgets` function in C?
A) To read a character from the standard input
B) To read a formatted input from a file
C) To read a line of text from the standard input
D) To write a line of text to a file
Answer: C) To read a line of text from the standard input
-
Which C library function is used to determine whether a character is a lowercase letter?
A) `islower`
B) `tolower`
C) `isalpha`
D) `isalnum`
Answer: A) `islower`
-
What is the purpose of the `isalpha` function in C?
A) To check if a character is a digit
B) To check if a character is a lowercase letter
C) To check if a character is an uppercase letter
D) To check if a character is an alphabetic character
Answer: D) To check if a character is an alphabetic character
-
Which function is used to convert a character to its uppercase equivalent in C?
A) `toupper`
B) `tolower`
C) `isupper`
D) `islower`
Answer: A) `toupper`
-
What is the purpose of the `isdigit` function in C?
A) To check if a character is a lowercase letter
B) To check if a character is an uppercase letter
C) To check if a character is a digit
D) To check if a character is a special character
Answer: C) To check if a character is a digit
-
Which function is used to determine whether a character is a printable character (including space) in C?
A) `isprint`
B) `isalnum`
C) `isspace`
D) `iscntrl`
Answer: A) `isprint`
-
What is the purpose of the `isalnum` function in C?
A) To check if a character is an alphanumeric character
B) To check if a character is a lowercase letter
C) To check if a character is a digit
D) To check if a character is a printable character
Answer: A) `isalnum`
-
Which C library function is used to determine whether a character is a punctuation character?
A) `ispunct`
B) `isalnum`
C) `isprint`
D) `isspace`
Answer: A) `ispunct`
-
What is the purpose of the `isspace` function in C?
A) To check if a character is an uppercase letter
B) To check if a character is a printable character
C) To check if a character is a whitespace character
D) To check if a character is a control character
Answer: C) To check if a character is a whitespace character
-
Which C library function is used to convert a character to its lowercase equivalent?
A) `tolower`
B) `toupper`
C) `islower`
D) `isupper`
Answer: A) `tolower`
-
What is the purpose of the `iscntrl` function in C?
A) To check if a character is a lowercase letter
B) To check if a character is a control character
C) To check if a character is an uppercase letter
D) To check if a character is a printable character
Answer: B) To check if a character is a control character
-
Which C library function is used to print formatted text to the standard output (usually the console)?
A) `printf`
B) `scanf`
C) `fprintf`
D) `fscanf`
Answer: A) `printf`
-
What is the primary purpose of the `scanf` function in C?
A) To read formatted text from a file
B) To read user input from the keyboard
C) To write formatted text to a file
D) To perform mathematical calculations
Answer: B) To read user input from the keyboard
-
Which format specifier is used in `printf` to print an integer in decimal format?
A) `%d`
B) `%f`
C) `%s`
D) `%c`
Answer: A) `%d`
-
What does the `fgets` function in C do?
A) Reads a character from the keyboard
B) Reads a line of text from a file or the keyboard
C) Writes a line of text to a file
D) Converts a string to an integer
Answer: B) Reads a line of text from a file or the keyboard
-
Which C library function is used to write formatted text to a file?
A) `printf`
B) `fprintf`
C) `scanf`
D) `fscanf`
Answer: B) `fprintf`
-
What is the purpose of the `fscanf` function in C?
A) To read formatted text from a file
B) To read user input from the keyboard
C) To write formatted text to a file
D) To perform mathematical calculations
Answer: A) `fscanf`
-
Which format specifier is used to print a floating-point number in scientific notation in `printf`?
A) `%e`
B) `%f`
C) `%g`
D) `%s`
Answer: A) `%e`
-
How can you read a single character from the keyboard in C?
A) Using `scanf("%c", &ch);`
B) Using `fgets(charArray, 1, stdin);`
C) Using `getchar();`
D) All of the above
Answer: D) All of the above
-
What does the `puts` function in C do?
A) Reads a line of text from the keyboard
B) Writes a line of text to a file
C) Prints a string to the standard output with a newline character
D) Converts a string to an integer
Answer: C) Prints a string to the standard output with a newline character
-
Which format specifier is used to print a character in `printf`?
A) `%d`
B) `%c`
C) `%s`
D) `%f`
Answer: B) `%c`
-
Which C library function is used to calculate the square root of a number?
A) `sqrt`
B) `pow`
C) `abs`
D) `ceil`
Answer: A) `sqrt`
-
What is the purpose of the `fabs` function in C?
A) To calculate the factorial of a number
B) To find the absolute value of a floating-point number
C) To round a floating-point number to the nearest integer
D) To calculate the power of a number
Answer: B) To find the absolute value of a floating-point number
-
Which C library function is used to calculate the sine of an angle in radians?
A) `sin`
B) `cos`
C) `tan`
D) `exp`
Answer: A) `sin`
-
What is the result of `ceil(4.3)` in C?
A) 4
B) 5
C) 4.0
D) 5.0
Answer: B) 5
-
Which mathematical library function can be used to calculate the exponential value of a number (e^x)?
A) `exp`
B) `log`
C) `pow`
D) `sqrt`
Answer: A) `exp`
-
What does the `fmod` function in C do?
A) Returns the remainder of dividing two floating-point numbers
B) Returns the floor value of a floating-point number
C) Returns the absolute value of a floating-point number
D) Returns the square root of a number
Answer: A) Returns the remainder of dividing two floating-point numbers
-
Which library function is used to calculate the natural logarithm (base e) of a number in C?
A) `log10`
B) `log`
C) `exp`
D) `sqrt`
Answer: B) `log`
-
What is the result of `pow(2, 3)` in C?
A) 5
B) 8
C) 6
D) 9
Answer: B) 8
-
Which C library function is used to calculate the hyperbolic sine of a number?
A) `sinh`
B) `cosh`
C) `tanh`
D) `asin`
Answer: A) `sinh`
-
What is the result of `round(3.6)` in C?
A) 3
B) 4
C) 3.0
D) 4.0
Answer: B) 4