Type Casting Flashcards

1
Q

Type casting is a way to convert a variable from one data type to another data type

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which of the following is an example of using the cast operator?

A

(type_name) expression

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

It is considered good programming practice to use the cast operator whenever type conversions are necessary

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q
void integerPromotion()
{
      int i = 17;
      char c = 'c';
      int sum;  
  sum = i + c;
  printf("Value of sum : %d\n", sum ); }

Given the C data types and the concept of integer promotion, the above source code would compile and run without errors.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

The usual arithmetic conversions are not performed for the assignment operators, nor for the logical operators && and ||

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly