250+ TOP MCQs on Type Conversions and Answers

C language Objective Questions on “Type Conversions”. One shall practice these Objective Questions to improve their C programming skills needed for various interviews (campus interviews, walkin interviews, company interviews), placements, entrance exams and other competitive exams. These questions can be attempted by anyone focusing on learning C Programming language. They can be a beginner, fresher, engineering graduate or an experienced IT professional. Our C language Objective Questions come with detailed explanation of the answers which helps in better understanding of C concepts.

Here is a listing of C language Objective Questions on “Type Conversions” along with answers, explanations and/or solutions:

1. What will be the output of the following C code?

  1.     #include 
  2.     void main()
  3.     {
  4.         float x = 0.1;
  5.         if (x == 0.1)
  6.             printf("");
  7.         else
  8.             printf("Advanced C Classes");
  9.     }

a) Advanced C Classes
b)
c) Run time error
d) Compile time error
Answer: a
Clarification: None.

2. What will be the output of the following C code?

  1.     #include 
  2.     void main()
  3.     {
  4.         float x = 0.1;
  5.         printf("%d, ", x);
  6.         printf("%f", x);
  7.     }

a) 0.100000, junk value
b) Junk value, 0.100000
c) 0, 0.100000
d) 0, 0.999999
Answer: b
Clarification: None.

3. What will be the output of the following C code? (Initial values: x= 7, y = 8)

  1.     #include 
  2.     void main()
  3.     {
  4.         float x;
  5.         int y;
  6.         printf("enter two numbers n", x);
  7.         scanf("%f %f", &x, &y);
  8.         printf("%f, %d", x, y);
  9.     }

a) 7.000000, 7
b) Run time error
c) 7.000000, junk
d) Varies
Answer: c
Clarification: None.

4. What will be the output of the following C code?

  1.     #include 
  2.     void main()
  3.     {
  4.         double x = 123828749.66;
  5.         int y = x;
  6.         printf("%dn", y);
  7.         printf("%lfn", y);
  8.     }

a) 0, 0.0
b) 123828749, 123828749.66
c) 12382874, 12382874.0
d) 123828749, 0.000000
Answer: d
Clarification: None.

5. What will be the output of the following C code?

  1.     #include 
  2.     void main()
  3.     {
  4.         int x = 97;
  5.         char y = x;
  6.         printf("%cn", y);
  7.     }

a) a
b) b
c) 97
d) Run time error
Answer: a
Clarification: None.

6. When double is converted to float, then the value is?
a) Truncated
b) Rounded
c) Depends on the compiler
d) Depends on the standard
Answer: c
Clarification: None.

7. What will be the output of the following C code?

  1.     #include 
  2.     int main()
  3.     {
  4.         unsigned int i = 23;
  5.         signed char c = -23;
  6.         if (i > c)
  7.             printf("Yesn");
  8.         else if (i < c)
  9.             printf("Non");
  10.     }

a) Yes
b) No
c) Depends on the compiler
d) Depends on the operating system
Answer: b
Clarification: None.

8. What will be the output of the following C code?

  1.     #include 
  2.     int main()
  3.     {
  4.         int i = 23;
  5.         char c = -23;
  6.         if (i < c)
  7.             printf("Yesn");
  8.         else
  9.             printf("Non");
  10.     }

a) Yes
b) No
c) Depends on the compiler
d) Depends on the standard
Answer: b
Clarification: None.

Leave a Reply

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