C Programming Multiple Choice Question - Type Conversion

This section focuses on the "Type Conversion" in C programming. These Multiple Choice Questions (MCQ) should be practiced to improve the C programming skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.

1. How many type of conversion are there in c?

A. 1
B. 2
C. 3
D. 4

View Answer


2. Which conversion also called Automatic Type Conversion?

A. Implicit Type Conversion
B. Explicit Type Conversion
C. Both A and B
D. None of the above

View Answer


3. The following code is an example of?

double da = 4.5;
double db = 4.6;
double dc = 4.9;

//explicitly defined by user
int result = (int)da + (int)db + (int)dc; 

printf(""result = %d"", result);

A. Implicit Type Conversion
B. Explicit Type Conversion
C. Error
D. Can not Say

View Answer


4. What will be output for the following code?

#include<stdio.h> 
int main() 
{ 
    int x = 10;    
    char y = 'a'; 
    x = x + y; 
     
    float z = x + 1.0; 
  
    printf(""x = %d, z = %f"", x, z); 
    return 0; 
} 

A. x = 107, z = 108.00
B. x = 107, z = 108.0000
C. x = 107, z = 108.000000
D. x = 108, z = 108.000000

View Answer


5. What will be output for the following code?

#include<stdio.h> 
int main() 
{ 
    double x = 1.2; 
    int sum = (int)x + 1; 
  
    printf(""sum = %d"", sum); 
  
    return 0; 
} 

A. sum = 2
B. sum = 1
C. sum = 0
D. sum = 3

View Answer


6. In Implicit type conversion, If an operand of long int is present then the other operand will be converted to ?

A. unsigned int
B. unsigned long int
C. float 
D. long int

View Answer


7. In Implicit type conversion, If an operand of type long double is present in the expression, then the corresponding operand will also be converted to?

A. double 
B. long double
C. int
D. float 

View Answer


8. Which type of conversion is NOT accepted?

A. From char to int
B. From float to char pointer
C. From negative int to char
D. From double to char

View Answer


9. Which of the following typecasting is accepted by C?

A. Widening conversions
B. Narrowing conversions
C. Widening & Narrowing conversions
D. None of the above

View Answer


10. When do you need to use type-conversions?

A. The value to be stored is beyond the max limit
B. The value to be stored is in a form not supported by that data type
C. To reduce the memory in use, relevant to the value
D. All of the above

View Answer






Discussion


* You must be logged in to add comment.