A directory of Objective Type Questions covering all the Computer Science subjects. Here you can access and discuss Multiple choice questions and answers for various compitative exams and interviews.

41. When are the pointer types known for upcasting the objects?
a. Compile time
b. Runtime
c. Source code build time
d. Doesn’t apply to pointer types
View Answer Report Discuss Too Difficult!
Answer: (a).Compile time

42. When are the object type known for upcasting the objects?
a. Compile time
b. Runtime
c. Source code build time
d. Doesn’t apply to objects directly
View Answer Report Discuss Too Difficult!
Answer: (b).Runtime

43. If two classes are defined “Parent” and “Child” then which is the correct type upcast syntax in C++?
a. Parent *p=child;
b. Parent *p=*child;
c. Parent *p=&child;
d. Parent *p=Child();
View Answer Report Discuss Too Difficult!
Answer: (c).Parent *p=&child;

44. What is downcasting?
a. Casting subtype to supertype
b. Casting supertype to subtype
c. Casting subtype to supertype and vice versa
d. Casting anytype to any other type
View Answer Report Discuss Too Difficult!
Answer: (b).Casting supertype to subtype

45. Which among the following is a mandatory condition for downcasting?
a. It must not be done explicitly
b. It must be done implicitly
c. It must be done explicitly
d. It can’t be done explicitly
View Answer Report Discuss Too Difficult!
Answer: (c).It must be done explicitly

46. Downcasting is _______________________
a. Always safe
b. Never safe
c. Safe sometimes
d. Safe, depending on code
View Answer Report Discuss Too Difficult!
Answer: (b).Never safe

47. Downcasting ____________________
a. Can result in unexpected results
b. Can’t result in unexpected result
c. Can result only in out of memory error
d. Can’t result in any error
View Answer Report Discuss Too Difficult!
Answer: (a).Can result in unexpected results

48. What should be used for safe downcast?
a. Static cast
b. Dynamic cast
c. Manual cast
d. Implicit cast
View Answer Report Discuss Too Difficult!
Answer: (b).Dynamic cast

49. What does dynamic_cast return after successful type casting?
a. Address of object which is converted
b. Address of object that is used for conversion
c. Address of object that is mentioned in the syntax
d. Doesn’t return any address
View Answer Report Discuss Too Difficult!
Answer: (a).Address of object which is converted

50. If dynamic_cast fails, which value is returned?
a. void
b. null
c. void pointer
d. null pointer
View Answer Report Discuss Too Difficult!
Answer: (d).null pointer

Page 5 of 6