250+ TOP MCQs on Character Handling and Answers

C MCQs on “Character Handling – 1”.

1. Which header declares several functions useful for testing and mapping characters?
a) assert.h
b) stdio.h
c) ctype.h
d) errno.h
Answer: c
Clarification: The header 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()
Answer: c
Clarification: 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?

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
Answer: c
Clarification:
int iscntrl( int c);
The iscntrl function tests for any control character.

4. What do the following C function do?

a) tests for only space character
b) tests for only digit
c) tests for only lower case
d) tests for any printing character
Answer: d
Clarification: 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
Answer: a
Clarification: 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()
Answer: b
Clarification: 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()
Answer: c
Clarification: 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()
Answer: d
Clarification: 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()
Answer: d
Clarification: 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()
Answer: d
Clarification: int isxdigit( int c) ;
This function tests for any hexadecimal-digit character.

Leave a Reply

Your email address will not be published. Required fields are marked *