21-02-2012, 04:01 PM
OOPS ANSWER KEY
OOPS ANSWER KEY.doc (Size: 52.5 KB / Downloads: 41)
PART-A
1) What are new type conversions available in c++?
• basic to class type conversion
• class to class type conversion
• class to basic type conversion
2) what is generic programming?
Generic programming is an approach where generic types are used as parameters in algorithms so that they work for a variety of suitable data types and data structures. Templates provide support for generic programming.
3) Give the syntax for function templates.
template<class T>
returntype functioname(arguments of type T)
{
//……..
//body of the function with type T wherever appropriate
//………
}
4) Give the 3 constructs for defining exception handling.
• Try block
• Catch block
• Throw statement
5) What are the two types of exceptions available in c++?
• Synchronous exceptions
Eg- division by zero, access to an array out of its bounds.
• Asynchronous exceptions
Eg- interruption of keyboard.