This set of C Multiple Choice Questions & Answers (MCQs) focuses on “Character Handling – 1”.
Pre-requisite for this C MCQ set: Advanced C Programming Video Tutorial.
1. Which header declares several functions useful for testing and mapping characters?
a) assert.h
b) stdio.h
c) ctype.h
d) errno.h
View Answer
Explanation: The header <ctype.h> declares several functions useful for testing and mapping characters.
2. The______function tests for any character for which isalpha or isdigit is true.
a) isxdigit()
b) isspace()
c) isalnum()
d) isupper()
View Answer
Explanation: int isalnum(int c)
The isalnum function tests for any character for which isalpha or isdigit is true.
3. What does the following C code do?
int iscntrl( int c);
a) checks if character is upper case
b) checks if character is lower case
c) tests for any control character
d) no function as such
View Answer
Explanation:
int iscntrl( int c);
The iscntrl function tests for any control character.
4. What do the following C function do?
int isgraph(int c);
a) tests for only space character
b) tests for only digit
c) tests for only lower case
d) tests for any printing character
View Answer
Explanation: int isgraph(int c);
The isgraph function tests for any printing character except space.
5. The isdigit function tests for any decimal-digit character.
a) true
b) false
View Answer
Explanation: int isdigit(int c);
This function checks whether the passed character is a decimal digit.
6. Which function returns true only for the characters defined as lowercase letters?
a) islow()
b) islower()
c) isalpa()
d) isalnum()
View Answer
Explanation: int islower( int c);
The islower function tests for any character that is a lowercase letter.
7. This function checks whether the passed character is white-space.
a) ispunct()
b) isgraph()
c) isspace()
d) isalpha()
View Answer
Explanation: The isspace function tests for any character that is a standard white-space character.
8. The standard white-space characters are the following: space (' '), form feed (' \ f '),
newline (' \n') , horizontal tab (' \tr), and vertlcal tab (' \v') can be tested with function.
a) ispunct()
b) isalpha()
c) isgraph()
d) isspace()
View Answer
Explanation: The isspace function tests for any character that is a standard white-space character.
9. Which function tests for any character that is an uppercase letter.
a) iscntrl()
b) ispunct()
c) isdigit()
d) isupper()
View Answer
Explanation: isupper() returns true only for the characters defined as uppercase letters.
10. The______function tests for any hexadecimal-digit character.
a) iscntrl()
b) ispunct()
c) isgraph()
d) isxdigit()
View Answer
Explanation: int isxdigit( int c) ;
This function tests for any hexadecimal-digit character.
Sanfoundry Global Education & Learning Series – C Programming Language.
To practice all areas of C language, here is complete set of 1000+ Multiple Choice Questions and Answers.
- Check Computer Science Books
- Apply for C Internship
- Check C Books
- Practice BCA MCQs
- Practice Computer Science MCQs