Discussion
The rule for implicit type conversion is
Answer: A
Correct answer: int < unsigned < float < double
The usual arithmetic conversions promote towards the type of greater rank, and the order is int, unsigned, float, double.
The int to unsigned step is the one that causes real trouble: comparing a negative int with an unsigned converts the negative value to a large positive one, so -1 < 1u evaluates false. The floating point steps are safer, though converting a large integer to float can lose precision silently.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development