Test 1 Oop
Test 1 Oop
3 /12/ 2012
10 R 60
if ( x 12) if ( x 12)
(b) Define a class template for the PHONE class containing a name of the person, his mobile phone number, and his email address. Include a constructor and any friend method. Draw the Class Diagram? 2# (a) Write a function template that inserts an element in the Kth position of an array A of size n and any type. (b) What is the output from the following program?
#include <iostream> using namespace std; void Fn() { static int b = 5 ; b ++ ; } int main() { int a = 7 ; Fn(); cout << a ; return 0 ; }
3# (a) How do you declare and initialize a Static data member of a class? (b) Fill in the blanks with the appropriate words: (i) A class C is declared as friend of class B in the body of class B. With this declaration, class B ...a friend of class C. (becomes, does not become) (ii) A friend function to a class has access to .... members of a class. (only public members, only private members, all members) 4# (a) Find the error(s) in the following code? Or write No Error (i) class sample1 { float a, b, c ; public : void sample1( ) ; }; (ii) class sample2 { float a, b, c ; sample2( ) ; };
(b) TRUE or FALSE: The constructor and the destructor can be overloaded. TRUE or FALSE: A destructor does not accept any arguments. TRUE or FALSE: A default copy constructor is created automatically by compiler.