C Programming Multiple Choice Questions and Answers on Character Class Testing & Conversions for Freshers

https://www.computersprofessor.com/2018/01/c-programming-multiple-choice-questions_8.html
1. Which of the following library function is not case-sensitive?
a) toupper()
b) tolower()
c) isdigit()
d) all of the mentioned
Answer: c
2. The following expression can be substituted for.
if (isalpha(c) && isdigit(c))
if (isalpha(c) && isdigit(c))
a) if (isalnum(c))
b) if (isalphanum(c))
c) if (isalphanumeric(c))
d) none of the mentioned
Answer: d
3. Which of the following will return a non-zero value when checked with isspace(c)?
a) blank
b) newline
c) return
d) all of the mentioned
Answer: d
4. What is the output of this C code?
#include
#include
int main()
{
char i = 9;
if (isdigit(i))
printf("digit\n");
else
printf("not digit\n");
return 0;
}
a) digit
b) not digit
c) Depends on the compiler
d) None of the mentioned
b) not digit
c) Depends on the compiler
d) None of the mentioned
Answer: b
.
.
5. What is the output of this C code?
#include
#include
int main()
{
int i = 9;
if (isdigit(i))
printf("digit\n");
else
printf("not digit\n");
return 0;
}
a) digit
b) not digit
c) Depends on the compiler
d) None of the mentioned
b) not digit
c) Depends on the compiler
d) None of the mentioned
Answer: b
6. What is the output of this C code?
#include
int main()
{
char i = '9';
if (isdigit(i))
printf("digit\n");
else
printf("not digit\n");
return 0;
}
a) digit
b) not digit
c) Depends on the compiler
d) None of the mentioned
b) not digit
c) Depends on the compiler
d) None of the mentioned
Answer: a
7. What is the output of this C code?
#include
#include
int main()
{
if (isspace('n'))
printf("space\n");
else
printf("not space\n");
return 0;
}
a) Compile time error
b) space
c) not space
d) None of the mentioned
b) space
c) not space
d) None of the mentioned
Answer: b
8. What is the output of this C code?
#include
#include
int main()
{
int i = 0;
if (isspace(i))
printf("space\n");
else
printf("not space\n");
return 0;
}
a) Compile time error
b) space
c) not space
d) None of the mentioned
b) space
c) not space
d) None of the mentioned
Answer: c
9. Which is true about isaplpha(c), where c is an int that can be represented as an unsigned
char or EOF.isalpha(c) returns?
char or EOF.isalpha(c) returns?
a) Non-zero if c is alphabetic
b) 0 if c is not alphabetic
c) Both Non-zero if c is alphabetic & 0 if c is not alphabetic
d) None of the mentioned
Answer: c
10. Which is true about isupper(c), where c is an int that can be represented as an unsigned
char or EOF.isupper(c) returns?
char or EOF.isupper(c) returns?
a) Non-zero if c is upper case
b) 0 if c is not upper case
c) Nothing
d) Both Non-zero if c is upper case & 0 if c is not upper case
Answer: d
11. Which is true about isalnum(c), where c is an int that can be represented as an unsigned
char or EOF.isalnum(c) returns?
char or EOF.isalnum(c) returns?
a) Non-zero if isalpha(c) or isdigit(c)
b) 0 if not isalpha(c) or not isdigit(c)
c) Both Non-zero if isalpha(c) or isdigit(c) & 0 if not isalpha(c) or not isdigit(c)
d) None of the mentioned
Answer: c
12. What is the output of this C code?
#include
#include
int main()
{
char c = 't';
printf("%d\n", isspace(c));
}
a) Non-zero number
b) Nothing
c) Error
d) t
b) Nothing
c) Error
d) t
Answer: a
13. What is the output of this C code?
#include
#include
int main()
{
char c = 't';
printf("is :%c\n", tolower('A'));
}
a) A
b) a
c) Non-zero number
d) Zero
b) a
c) Non-zero number
d) Zero
Answer: b
14. Which types of input are accepted in toupper(c)?
a) char
b) char *
c) float
d) Both char and char *
Answer: a
15. What is the difference in the ASCII value of capital and non-capital of the same letter is?
a) 1
b) 16
c) 32
d) Depends with compiler
Answer: c