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

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))

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?
  1.     #include 
  2.     #include 
  3.     int main()
  4.     {
  5.         char i = 9;
  6.         if (isdigit(i))
  7.             printf("digit\n");
  8.         else
  9.             printf("not digit\n");
  10.             return 0;
  11.     }
a) digit
b) not digit
c) Depends on the compiler
d) None of the mentioned
Answer: b
.
5. What is the output of this C code?
  1.     #include 
  2.     #include 
  3.     int main()
  4.     {
  5.         int i = 9;
  6.         if (isdigit(i))
  7.             printf("digit\n");
  8.         else
  9.             printf("not digit\n");
  10.             return 0;
  11.     }
a) digit
b) not digit
c) Depends on the compiler
d) None of the mentioned
Answer: b
6. What is the output of this C code?
  1.     #include 
  2.     int main()
  3.     {
  4.         char i = '9';
  5.         if (isdigit(i))
  6.             printf("digit\n");
  7.         else
  8.             printf("not digit\n");
  9.             return 0;
  10.     }
a) digit
b) not digit
c) Depends on the compiler
d) None of the mentioned
Answer: a
7. What is the output of this C code?
  1.     #include 
  2.     #include 
  3.     int main()
  4.     {
  5.         if (isspace('n'))
  6.             printf("space\n");
  7.         else
  8.             printf("not space\n");
  9.             return 0;
  10.     }
a) Compile time error
b) space
c) not space
d) None of the mentioned
Answer: b
8. What is the output of this C code?
  1.     #include 
  2.     #include 
  3.     int main()
  4.     {
  5.         int i = 0;
  6.         if (isspace(i))
  7.             printf("space\n");
  8.         else
  9.             printf("not space\n");
  10.             return 0;
  11.     }
a) Compile time error
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?

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?

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?

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?
  1.     #include 
  2.     #include 
  3.     int main()
  4.     {
  5.         char c = 't';
  6.         printf("%d\n", isspace(c));
  7.     }
a) Non-zero number
b) Nothing
c) Error
d) t
Answer: a
13. What is the output of this C code?
  1.     #include 
  2.     #include 
  3.     int main()
  4.     {
  5.         char c = 't';
  6.         printf("is :%c\n", tolower('A'));
  7.     }
a) A
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

Related

C# Questions & Answers on Bitwise and Conditional Operators for Freshers

1. Select the relevant output for the following set of code : static void Main(string[] args) { byte varA = 10; byte varB = 20; long result = varA & varB; Cons...

C# Questions & Answers on Relational and Logical Operators for Freshers

1. Select the relevant output for the following set of code: static void Main(string[] args) { int a = 4; int b = 5; int c = 6; int d = 8; if (((a * b / c) +...

C# Questions & Answers on Arithmetic Operators for Freshers

1. Predict the output for the following set of code. static void Main(string[] args) { float a = 16.4f; int b = 12; float c; c = a * ( b + a) / (a - b) ; ...

Post a Comment

emo-but-icon
:noprob:
:smile:
:shy:
:trope:
:sneered:
:happy:
:escort:
:rapt:
:love:
:heart:
:angry:
:hate:
:sad:
:sigh:
:disappointed:
:cry:
:fear:
:surprise:
:unbelieve:
:shit:
:like:
:dislike:
:clap:
:cuff:
:fist:
:ok:
:file:
:link:
:place:
:contact:

item