🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Type Casting in C++: all 10 questions

Quiz: Type Casting in C++ · Question 7 of 10

Why are C-style casts like (int)x discouraged in C++?

Why are C-style casts like (int)x discouraged in C++?

  1. A.They do not compile in C++
  2. B.They are slower at run time
  3. C.They can perform any kind of conversion silently and are hard to search for
  4. D.They always round instead of truncating
Answer & explanation

Correct answer: They can perform any kind of conversion silently and are hard to search for

The named casts make intent clear and let the compiler reject the wrong kind of conversion.

Can you get the rest right without peeking?

Take the timed Quiz: Type Casting in C++ quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →