1. Which of the following is implicit type conversion in C++?
(A) int a = 10.5;
(B) float f = intVar;
(C) char ch = 'A'; int x = ch;
(D) All of the above
2. Which of the following is explicit type casting in C++?
(A) int x = 5.7;
(B) int y = (int) 3.14;
(C) float f = 2;
(D) double d = 10;
3. Which C++ cast is type-safe and checked at compile time?
(A) static_cast
(B) const_cast
(C) reinterpret_cast
(D) C-style cast (int)x
4. Which cast is used to remove const or volatile qualifier from a variable?
(A) static_cast
(B) const_cast
(C) reinterpret_cast
(D) dynamic_cast
5. What is the type of x after the following operation? double d = 3.7; int x = d;
(A) double
(B) int
(C) float
(D) char
6. Which of the following casts cannot convert a pointer type safely?
(A) dynamic_cast
(B) reinterpret_cast
(C) static_cast
(D) const_cast
7. What is the result of int(3.9) + int(2.1) in C++?
(A) 6
(B) 5
(C) 3.9 + 2.1
(D) 0
8. Which C++ cast is mainly used for polymorphic class pointers and references?
(A) static_cast
(B) dynamic_cast
(C) reinterpret_cast
(D) const_cast
9. Which of the following is an example of type promotion?
(A) int i = 'A';
(B) float f = 2 + 3.5;
(C) double d = 4 + 5;
(D) All of the above
10. What will the following statement do? float f = static_cast<float>(10/3);
(A) Store 3.3333 in f
(B) Store 3 in f
(C) Store 3.0 in f
(D) Compilation error