Log In Register

Units


Type Conversions - Questions and Answers

 

Practice these Type Conversions under C Programming walk-in interview Questions/ examination questions with best tricks and short cuts with solution. Student (candidate) who want to crack the walk in interview, competitive exams and want to find short cuts and tricks to solve questions on Type Conversions for following purpose.


– Anyone who is wishing to increase their perfect knowledge of Type Conversions of C Programming.
– Anyone who is preparing for aptitude test and increase his in depth aptitude knowledge C Programming specifically Type Conversions.
– Anyone who is preparing for interviews (competitive examinations, govt examinations and bank examinations, off-campus or on campus interviews, walk-in interview and company interviews) having questions on Type Conversions under C Programming.

– Anyone who is preparing for aptitude test or competitive exam or entrance exam.
– Anyone who is preparing for entrance examinations and other competitive examinations.
– All Experienced, Freshers and Students.

Here is list of Questions and Answers covering all key area of  Type Conversions topic of C Programming:

 

1.

What is the output of this C code?

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

Answer: Option C

Explanation:

2.

Comment on the output of this C code?

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

Answer: Option C

Explanation:

3.

When double is converted to float, the value is?

Answer: Option B

Explanation:

4.

What is the output of this C code?
(7 and 8 are entered)

  1.     #include <stdio.h>
  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.     }

Answer: Option B

Explanation:

5.

What is the output of the below code considering size of short int is 2, char is 1 and int is 4 bytes?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         short int i = 20;
  5.         char c = 97;
  6.         printf("%d, %d, %d\n", sizeof(i), sizeof(c), sizeof(c + i));
  7.         return 0;
  8.     }

Answer: Option B

Explanation:

6.

Which type conversion is NOT accepted?

Answer: Option C

Explanation:

Conversion of a float to pointer type is not allowed.

7.

Which of the following typecasting is accepted by C?

Answer: Option A

Explanation:

8.

function tolower(c) defined in library works for

Answer: Option A

Explanation:

9.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     void main()
  3.     {
  4.         double x = 123828749.66;
  5.         int y = x;
  6.         printf("%d\n", y);
  7.         printf("%lf\n", y);
  8.     }

Answer: Option A

Explanation:

10.

What is the output of this C code?

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

Answer: Option D

Explanation:

11.

What will be the data type of the result of the following operation?
(float)a * (int)b / (long)c * (double)d

Answer: Option A

Explanation:

12.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     void main()
  3.     {
  4.         int x = 97;
  5.         char y = x;
  6.         printf("%c\n", y);
  7.     }

Answer: Option D

Explanation:

13.

When do you need to use type-conversions?

Answer: Option D

Explanation:

14.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         int i = 23;
  5.         char c = -23;
  6.         if (i < c)
  7.             printf("Yes\n");
  8.         else
  9.             printf("No\n");
  10.     }

Answer: Option C

Explanation:

15.

Which of the following type-casting have chances for wrap around?

Answer: Option D

Explanation: