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.

51. Which is the proper syntax of dynamic_cast?
a. dynamic_cast(object)
b. dynamic_cast new (object)
c. dynamic_cast(object)
d. dynamic_cast(object)
View Answer Report Discuss Too Difficult!
Answer: (d).dynamic_cast(object)

52. Which is the exception handler for the exceptions of downcasting?
a. CastException
b. ClassCastingExeption
c. ClassCasting
d. ClassCastException
View Answer Report Discuss Too Difficult!
Answer: (d).ClassCastException

53. How to prevent the ClassCastExceptions?
a. By using instanceof
b. By using is-a check
c. By using arrow operator with check function
d. By checking type of conversion
View Answer Report Discuss Too Difficult!
Answer: (a).By using instanceof

54. Java supports direct downcasting.
a. True
b. False
c. May be
d. Can't say
View Answer Report Discuss Too Difficult!
Answer: (b).False

55. Which way the downcasting is possible with respect to inheritance?
a. Upward the inheritance order
b. Downward the inheritance order
c. Either upward or downward the inheritance order
d. Order of inheritance doesn’t matter
View Answer Report Discuss Too Difficult!
Answer: (b).Downward the inheritance order

56. What happens when downcasting is done but not explicitly defined in syntax?
a. Compile time error
b. Runtime error
c. Code write time error
d. Conversion error
View Answer Report Discuss Too Difficult!
Answer: (a).Compile time error

57. When is downcating used?
a. To separate inherited class from base class
b. To write a more complex code
c. To compare two objects
d. To disable one class in inheritance
View Answer Report Discuss Too Difficult!
Answer: (c).To compare two objects

58. Why is downcasting possible in any language?
a. Because inheritance follows has-a relationship
b. Because inheritance follows is-a relationship
c. Because inheritance doesn’t follow any relationship
d. Because inheritance is not involved in casting
View Answer Report Discuss Too Difficult!
Answer: (b).Because inheritance follows is-a relationship

Page 6 of 6