Monday, 14 March 2016

C++ One line question answers (SY BCS)

Oct 2004

a)      What do you mean by encapsulation?
The wrapping up of data and functions into a single unit (called class) is known as encapsulation.
b)      Explain abstraction.
Abstraction refers to the act of representing essential features without including the background details or explanations.
c)      What is object? Give one example.
Objects are the basic run-time entities in an object-oriented system. They may represent a person, a place, a bank-account, a table of data or any item that the program must handle. They may also represent user-defined data such as vectors, time and lists.
d)      List the operators, which cannot be overloaded.
1.      Class member access operator (., .*).
2.      Scope resolution operator (::).
3.      Size operator (sizeof).
4.      Conditional operator (?:).
e)      Explain setw() function.
Syntax: setw(int w)
Set the field with to w.
e.g. cout << setw(10) << 12345;
This statement prints the value 12345 right-justified in a field width of 10 characters.
f)       What is destructor?
A destructor like constructor is a special member function which is called or invoked implicitly upon exit from the program (or block or function) to clean up storage that is no longer accessible. In C++ destructor name is same as class name but preceded by a tilde (~)
e.g. ~Integer(){}
g)      Explain new and delete operator.
new operator is used to dynamically allocate memory on heap. Memory allocated by new must be deallocated using delete operator.
Syntax:          ptr_var = new type;
           delete ptr_var;
e.g.                int *p;
           p = new int;
           :
           delete p;
h)      What do you mean by reference variable?
A reference variable provides an alias (alternative name) for previously defined variable.
Syntax:          type & ref_var = var;
e.g.                float total=100;
           float & sum = total;
total and sum can be used interchangeably.
i)       List the different modes of opening files in c++.
ios::app
Append to end-of-file.
ios::binary
Binary file
ios::ate
Go to the end-of-file on opening
ios::in
Open file for reading only.
ios::out
Open file for writing only.
ios::nocreate
Open fails if file doesn’t exist.
ios::noreplace
Open fails if file already exist.
ios::trunc
Delete contents of file if it exists.
j)       What is inline function?
An inline function is a function that is expanded in line when it is invoked. That is, the compiler replaces the function call with the corresponding function code (like macros).
e.g. inline double cube(double x)
    {
           return x*x*x;
    }
April 2005
a)      List various types of constructor.
1.      Default constructor
2.      Parameterized constructor
3.      Copy constructor
4.      Dynamic constructor
b)      Give any two benefits of OOP.
1.      Through inheritance, we can eliminate redundant code and extend the use of existing classes.
2.      The principle of data hiding helps the programmer to build secure programs that cannot be invaded by code in other parts of the program.
c)      What is template class?
A class created from a class template is called a template class.
d)      What is inline function?
Refer Oct 2004 (j)
e)      What is manipulator?
The header file iomanip.h provides a set of functions called manipulators, which can be used to manipulate the output formats.
f)       Explain write() function used in file hanldling.
The function write() stores the data in binary form. The values are stored in the disk file in the same format in which they are in the internal memory.
Syntax: outfile.write((char*)&v, sizeof(v));
g)      Give the syntax and example of precision() function.
Syntax: cout.precision(d);
Where d is the number of digits to the right of the decimal point.
e.g. cout.precision(3);
    cout << sqrt(2);       // 1.141
h)      List the operators which cannot be overloaded.
Refer Oct 2004 (d)
i)       What do you mean by polymorphism?
Polymorphism means the ability to take more than one form. e.g. an operation may exhibit different behavior in different instances. The behavior depends upon the types of data used in the operation.
j)       Give the syntax of class template.
template <class T>
class classname
{
    // class member specification with anonymous type T wherever appropriate
};
Oct 2005
a)      What is a constructor?
A constructor is a special member function whose task is to initialize the objects of its class. It is invokes implicitly whenever an object of its class is created. It is special because its name is the same as the class name.
b)      List applications of OOP.
1.      Real-time systems
2.      Simulation and modeling
3.      Object-oriented database
4.      AI and expert systems
5.      Neural networks and parallel programming
6.      Decision support and office automation systems
c)      Explain message passing.
Objects communicate with one another by sending and receiving information much the same was as people pass messages to one another. Message passing involves specifying the name of the object, the name of the function (message) and the information to be sent.
e.g.                employee.get_salary(name);

           object                             message                        information
d)      What is function template?
Function template defines a general set of operations that will be applied to various data types. The type of data that the function will operate upon is passed to it as a parameter.
e)      List any four manipulators used in C++.
1.      endl – insert new line and flush stream.
2.      setw(int w) – set the field width to w.
3.      setprecision(int d) – set the floating point precision to d.
4.      setfill(int c) – set the fill character to c.
f)       Explain read() function in file handling.
The function read() function handles the data in binary form. The values are read from the disk file in the same format in which they are in the internal memory.
Syntax: outfile.read((char*)&v, sizeof(v));
g)      What is the use of width() function? Give suitable example.
We can use width() function to define the width of a field necessary for the output of an item.
Syntax:          cout.width(w);
e.g.                cout << width(5) << 543 << width(5) << 12;


5
4
3



1
2
h)      What is reference variable?
Refer Oct 2004 (h)
i)       What is friend function?
A friend function is a function that is not member of a class but has access to the class private and protected members to whom it is friend.
j)       What is difference between template and macro?
Macros
Template
Macros are expanded by preprocessor
Templates are expanded by compiler.
Macros do not obey C++ syntactic rules
Templates are more powerful and obey C++ syntactic rules.

April 2006
a)      State two manipulators used in C++.
Refer Oct 2005 (e)
b)      What is inline function?
Refer Oct 2004 (j)
c)      What is reference variable?
Refer Oct 2004 (h)
d)      Explain destructor.
Refer Oct 2004 (f)
e)      Explain seeking function used in C++.
The seek functions move get/put pointer to a specified location.
Syntax:          seekg(offset, refposition);
           seekp(offset, refposition);
offset is number of bytes the file pointer is to be moved from the location specified by the parameter refposition. refposition can be ios::beg, ios::cur or ios::end.
f)       What is friend function?
Refer Oct 2005 (i)
g)      State the operators which cannot be overloaded.
Refer Oct 2004 (d)
h)      Explain message passing.
Refer Oct 2005 (c)
i)       State the concept of function overloading.
Function overloading or method overloading is the ability to create multiple methods of the same name with different implementation. They are distinguished on number of arguments, types of arguments and order of arguments.
e.g. int add(int, int, int);
    float add(float, float);
j)       Enlist the features of C++.
1.      C++ is an object-oriented programming language.
2.      C++ is super-set of C.
3.      C++ supports classes, function overloading and operator overloading.
4.      C++ supports inheritance and runtime polymorphism.

Oct 2006
a)      What is function overloading?
Refer April 2006 (i)
b)      What is the purpose of delete operator?
When a data object is no longer needed, it is destroyed to release the memory space for reuse using delete operator.
Syntax:          delete ptr_var;
c)      What is an abstract class?
An abstract class is one what is not used to create objects. An abstract class is designed only to act as a base class. It is a design concept in programming and provides a base upon which other classes may be built. Abstract class contains pure virtual functions.
d)      List any two operators which cannot be overloaded?
Refer Oct 2004 (d)
e)      Which operators are used for input/output from console?
The left shift operator "<<" and right shift operator ">>" are used for I/O from console.
f)       Name any two classes defined in iostream.h.
1.      istream
2.      ostream
3.      iostream
4.      istream_withassign
5.      ostream_withassign
6.      iostream_withassign
g)      What is meant by protected inheritance?
-         private members of base class are not accessible to derived class.
-         protected members of base class remain protected in derived class.
-         public members of base class become protected in derived class.
h)      What is friend function?
Refer Oct 2005 (i)
i)       What is the use of static keyword?
static keyword can be used for following purpose:
1.      static variable in functions.
2.      static class objects.
3.      static member variable in class.
4.      static methods in class.
j)       Name any two manipulators.
Refer Oct 2005 (f)
April 2007
a)      Justify true/false. In procedure oriented programming all data items are shared by all functions.
True – In a multi-function program many important data items are placed as global so that they may be accessed by all the functions.
b)      Explain any two access specifiers.
1.      private – The members that have been declared as private can be accessed only from within the class.
2.      publicpublic members can be accessed from outside the class also.
c)      Give two methods which are used to define member function.
Member functions can be defined in two places:
1.      Outside the class definition by using scope resolution operator.
2.      Inside the class definition itself.
d)      What is inline function?
Refer Oct 2004 (j)
e)      State true/false. Functions cannot return class objects.
False
f)       Constructors are used to –
a.      Increment the object
b.      Initialize the object
c.      Destroy the object
Initialize the object
g)      List the operators which cannot be overloaded in C+.
Refer Oct 2004 (d)
h)      List the types of inheritance.
1.      Single inheritance
2.      Multilevel inheritance
3.      Multiple inheritance
4.      Hierarchical inheritance
5.      Hybrid inheritance
i)       Differentiate between seekg() and seekp() function.
Seekg
seekp
seekg moves get pointer (input) pointer to a specified location.
seekp moves put pointer (output) pointer to a specified location.
Syntax: infile.seekg(offset, refposition);
Syntax: outfile.seekp(offset, refposition);
j)       State two advantages of templates.
1.      Reuse code.
2.      Save typing time.
3.      Saves time spend on debugging.
4.      Saving source-code space.
Oct 2007
a)      List any two languages other than C++ which support object oriented programming concepts.
Java, Smalltalk, Simula, Objective C etc.
b)      Explain array of object with example in short.
Array can be of any type including struct. Similarly we can have array of variables that are of the type class. Such variables are called array of objects.
e.g. class employee{…};
    employee manager[5], foreman[15],worker[100];
c)      Why you need a scope resolution operator to access global variable?
In C, we cannot access a global variable if we have a local variable with same name, but it is possible in C++ using scope resolution operator (::).
e.g. int x=10;
    int main()
    {
        int x=20;
        cout << x << "\t" << ::x << endl; // 20 10
        return 0;
    }
d)      What is function overloading?
Refer April 2006 (i)
e)      What is the difference between inline function and normal function?
Inline function
Normal function
In case of inline function call, the compiler replaces the function call with the corresponding function code.
In case of normal function call jumping to the function, saving register, pushing arguments into the stack and returning to the calling function takes place.
f)       Justify true/false: Destructors take input parameter.
False: As destructors are called implicitly only once when object is losing its scope, it cannot take input parameter and nor does it return value.
g)      List the operator that cannot be overloaded in C++.
Refer Oct 2004 (d)
h)      Justify true/false: Can base class object access member of a derived class.
False – For base class object additional derived class members will be undefined.
i)       Justify true/false: The programmer must create cin, cout, cerr, clog object explicitly.
False: The header file iostream.h contains declarations for the indentifiers cout, cin, cerr, clog.
j)       What is a function template?
Refer Oct 2005

April 2008
a)     What do you mean by late binding?
Late binding, or dynamic binding is a programming mechanism in which the method being called upon an object is looked up by name at runtime.
b)     Why can’t you initialize members within a class?
Because data member declaration is not a definition. There is not object being introduced. If you have a data member such as int x; no int object is created until you actually create an object of the type of the class.
c)      Write a C++ statement to allocate memory dynamically for an array of 20 pointers to objects of some class, say A.
A **p = new A*[20];
d)     Why do reference variables have to be initialized?
A reference variable must be initialized at the time of declaration. This establishes the correspondence between the reference and the data object that is names.
e)      “Operator overloading is an example of run-time polymorphism”. Justify T/F.
False- operator overloading is a type of compile time polymorphism. When the compiler compiles an instruction that uses overloaded operator, it generates machine code instruction for an overloaded operator based on the operands on which it operates.
f)      What do you mean by virtual destructor?
Deleting a derived class object using a pointer to a base class that has a non-virtual destructor calls only derived destructor. Making base class destructor virtual guarantees that both the base class and derived class destructors are called.
g)     Which operators must be overloaded as member (not friend) functions?
The assignment (=), subscript ([]), call (()), and member selection (->) operator must be overloaded as member functions.
h)     What happens if a derived class fails to explicitly provide arguments to the base class constructor?
It tries to call default constructor of base class if there is one. However, if any base class contains a constructor with one or more arguments, then it is mandatory for the derived class to have a constructor and pass the arguments to the base class constructor. Otherwise it will generate error.
i)       For what purpose, fstream is used?
Provide support for simultaneous input and output operations. Contains open() with default input mode. Inherits all the functions from the istream and ostream classes through iostream.
j)      “It is sometimes necessary to overload a function template”. Justify T/F.
True – if we want the function to behave in one way for all data types except one. In such case it is necessary to overload function template.

Oct 2008
a)      State any one advantage of object oriented programming over procedure oriented programming.
The principle of data hiding helps the programmer to build secure programs that cannot be invaded by code in other parts of the program.
b)      List the functions of istream class.
1.      Contains basic facilities that are used by all other I/O classes.
2.      It also contains pointer to a buffer object (streambuf)
3.      Declares constants and functions that are necessary for handling I/O operations.
c)      Give the syntax to create a reference variable.
Syntax:          data-type & referene-name = variable-name;
d)      State the disadvantage of using inline function.
Inline function makes the program to take up more memory because the statements that define the inline function are reproduced at each point where the function is called.
e)      How many times will the constructor of class student be invoked for the following statement?
Student S, *P;
Only once for S because P is not object it is just pointer to object.
f)       Write the syntax for overloading << operator.
friend ostream & operator << (ostream &, classtype &);

ostream & operator << (ostream & o, classtype &t){...}
g)      A class containing a virtual function cannot be instantiated. (true/false)
False – A class containing pure virtual function cannot be instantiated.
h)      When do we make a class virtual?
In multiple inheritance situation, when class A is inherited by class B and class C, and class D inherits from both B and C, then it inherits two instances of A which introduces ambiguity. By declaring A to be virtual in both B and C, then D inherits directly from A, while B and C share the same instance of A.
i)       Which classes define the file handling methods?
fstream, ifstream, ofstream
j)       Give the syntax to create an object of a template class.
Syntax:          classname <type> objectname(arglist);

April 2009
1.      State the reason why we cannot use the this pointer in a friend function.
this pointer is implicitly passed to only non-static member function of the class. Whereas friend functions are non-member functions of the class.
2.      Which file opening mode should be used to open a file only if the file exists?
ios::nocreate
3.      The insertion and extraction operators have to be overloaded as member functions. State whether True/False and justify.
False: the invoking object is implicitly passed as argument to operator function if overloaded using member function. In case of insertion and extraction operators the invoking object will be cin or cout. Therefore we will have to write operator function in istream or ostream class which is not allowed.
4.      State the use of the protected access specifier.
A member declared as protected is accessible by the member function within its class and any class immediately derived from it. It cannot be accessed by the functions outside these two classes.
5.      Overloading means redefining a function in an inheritance class hierarchy. State whether True/False and justify.
False – overloading means writing family of functions in same class with same name and there differ only in number of arguments, type of arguments and order of arguments.
6.      How does a class achieve data hiding?
The class achieve data hiding by declaring data members as private.
7.      Write the C++ statement to free the memory allocated by the following statement.
int *p = new int (10);

*p = 0;
delete p;
p = 0;
8.      Do the following lines of C++ code have an error? If yes, state the reason.
class NUMBER
{
int a;
void NUMBER (int x = 0)
{
a = x;
}
};
There is error in given code. The constructor is given return type void whereas constructors don’t return anything. Not event void.
9.      What will be the output of the following C++ statements?
cout.precision(2);
cout.width(6);
cout << 7.1234;


7
.
1
2
10.   A class template is defined as follows:
template < class T>
class Myclass
{
T data;
public:
// methods
};
Write the C++ statement to create an object of Myclass having member of the type int.
MyClass <int> obj;

Oct 2009
1.      List any 2 features of C++ programming language.
Refer April 2006 (j)
2.      What are objects? How are they created?
Objects are variables or instances of class. They are created much the same way we create primitive type variables.
Syntax:          classname object;
e.g.                Student me;
3.      Give the syntax for explicit type conversion of a variable or expression in C++.
Syntax:          type-name(expression);
e.g.                avg = sum / float(n);
4.      A function can return a value by reference. Comment.
True – A function can return a reference but do not try to returns a local variable by reference. Because local variable goes out of scope when the function returns.
5.      List the operators for which friend function cannot be used.
Refer April 2008 (g)
6.      What is destructor? Is it mandatory to use destructor in a class?
Refer Oct 2004 (f)
It is not mandatory to use destructor in a class because compiler adds a default constructor in a class. But it is good practice to add your own destructor.
7.      In what order constructors are invoked in multilevel inheritance?
In multilevel inheritance, the constructors are called in the order of inheritance.
e.g. If class B derived from A and C derived from B, then first constructor of A, then B and then C is called.
8.      Define pure virtual function.
A pure virtual function is a function declared in a base class that has no definition relative to the base class.
Virtual return-type function-name([args])=0;
9.      List various classes available for file operations.
Refer Oct 2008 (i);
10.   Give the syntax for function template.
template <class T>
return-type functionname(arguments of type T)
{
// body of function with type T where appropriate.
}

Oct 2010
a)      State any two applications of OOP.
Refer Oct 2005 (b)
b)      What is data abstraction?
Data abstraction refers to, providing only essential information to the outside world and hiding their background details, i.e., to represent the needed information in program without presenting the details.
c)      Justify true/false ‘Function cannot return class objects’.
False – As function can return primitive type values it can also return class objects.
e.g. Time Time::add(Time &t1){...}
d)      What is meant by dynamic constructors?
The constructor can also be used to allocate memory while creating objects. Allocation of memory to objects at the time of their construction is known as dynamic construction of objects. The memory is allocated with the help of the new operator.
e)      What is advantage and disadvantage of operator overloading?
Advantage: User-defined data types can be made to behave like built-in types using operator overloading. Operator overloading permit to add two variables of user-defined data types in similar way as basic types.
Disadvantage: We cannot change the basic meaning of an operator i.e. we cannot redefine the ‘+’ operator to subtract one value from the other. There are some operators that cannot be overloaded.
f)       Where can an ambiguity occur in overloading a function?
If for function call two matches are found, the call is rejected as ambiguous.
e.g. long square(long n);
    double square(double x);
    :
    square(10);    // function call
g)      Differentiate between seekg() and seekp() functions.
Refer April 2007 (i)
h)      Why cannot a static member function access a non-static member of other class?
Because non-static member variables of a class always belong to an object – meaning that every object has it’s own personal copy of non-static member variables (also known as instance variables). And, static functions have no object to work with since they belong to the class as a whole. You can call a static function without an object – and for that exact reason a static function cannot access non-static member of other class.
i)       What is an iterator? Give any two types.
An iterator is any object that, pointing to some element in a range of elements (such as an array or a container), has the ability to iterate through the elements of that range using a set of operators (with at least the increment (++) and dereference (*) operators).
1.    Input iterator
2.    Output iterator
3.    Forward iterator
4.    Bi-directional iterator
5.    Random access iterator
j)       Justify true/false ‘the programmer must create cin, cout, cerr, clog object explicitly.
Refer Oct 2007 (i)

April 2011
a)      What are the different types of containers?
1.      Sequence container – vector, list, deque.
2.      Associative container – set, multiset, map, multimap
b)      Define virtual base class.
An ambiguity can arise when several paths exist to a class from the same base class. This means that a child class could have duplicate sets of members inherited from a single base class.
C++ solves this issue by introducing a virtual base class. When a class is made virtual, necessary care is taken so that the duplication is avoided regardless of the number of paths that exist to the child class.
c)      The input pointer is also called as put pointer. State True/False.
False
d)      State the rule to define default arguments.
The defaults can be added from right to left only i.e. default values cannot be provided to the arguments in the middle.
e)      When do you use function overriding?
Use function overloading when you want to create a family of functions with similar type of task on different on different type of values.
e.g. int add(int, int);
    float add(float, float);
f)       Default constructor is always called without any arguments. State True/False.
True
g)      List any four applications of OOP.
Refer Oct 2005 (b)
h)      How dynamic allocation is done in C and C++ compare?
C uses malloc() function to allocate memory dynamically.
C++ uses unary operator new to allocate memory dynamically.
i)       Write the syntax to declare non-member operator function and member operator function.
Member operator function: returnType operator#(const className&);
Non-member operator function: friend returnType operator#(const className&, const className&);
j)       What will be the output of the following ?
cout << setbase(16) << 15;
Output: f

 Oct 2011
a)      Define following:
i.       Sequence containers
A sequence container is a container that stores objects of the same type in a linear arrangement.
ii.      Associative containers.
An associative container is an ordered container that provides fast lookup of objects based on keys.
b)      Write syntax to create virtual base class.
class A{};
class B: virtual public A{};
class C: virtual public A{};
c)      List files mode operation.
Oct 2004 (i)
d)      What is friend class? Give its syntax.
A friend class in C++ can access the "private" and "protected" members of the class in which it is declared as a friend.
Syntax:
class A{
    :
public:
    friend class B;        // class B is friend to class A
    :
};
e)      Differentiate multiple and hierarchical inheritance.
Multiple inheritance
Hierarchical inheritance
A derived class with several base classes is called multiple inheritance
The feature of one class may be inherited by more than one class. This process is called as hierarchical inheritance.
f)       The destructor can have different name as the class – state true/false.
False
g)      Which are the types of polymorphism?
1.      Compile time polymorphism
2.      Run time polymorphism
h)      List the different cast operators in C++.
1.      static_cast operator
2.      dynamic_cast operator
3.      cons_cast operator
4.      reinterpret_cast operator
i)       The over loaded operator must have at least one user defined type operand. State true/false.
True
j)       What will be the output of the following
cout < < setbase (16) < < 14;
Output: e


 April 2012
a)      How does function overriding differ from function overloading?
Function overloading
Function overriding
Method overloading deals with the notion of having two or more methods(functions) in the same class with the same name but different arguments.
Method overriding means having two methods with the same arguments, but different implementation. One of them would exist in the Parent class (Base Class) while another will be in the derived class(Child Class).
b)      State the purpose of “this” pointer.
1.      To resolving ambiguity between local variables name and member variable names.
2.      To return reference to the calling object.
c)      A destructor can be overloaded in a class. State True/False.
False
d)      Define abstract class.
Refer Oct 2006 (c)
e)      What is the difference between the following C++ statements?
int *ptr = new int(10);
int *ptr = new int [10];
First statement allocation dynamically memory for only one integer and initialize it with 10. The second statement allocates contiguous memory for 10 integers.
f)       State the advantage of encapsulation.
Using encapsulation, the programmer cannot directly access the data. Data is only accessible through the functions existing inside the class.
g)      Give any two ways to check the success or failure of a file open operation.
1.      if(file.fail())        // open attempt failed.
{...}
Or
if(!file.good())       // open attempt failed.
{...}
2.      if(!file)              // open attempt failed.
{...}
h)      List the types of STL containers.
Refer April 2011 (a)
i)       An exception can be thrown again after catching it. State True/False.
True
j)       What is the purpose of forward declaration of a class?
Forward references are necessary in cases where the compiler needs to know that a symbol refers to a class before the class is actually defined. The classic example of this is when two classes need to contain pointers to each other.
class B;
class A
{
B* b;
};
class B
{
A* a;
};

Oct 2012
a)      State the purpose of virtual base class.
An ambiguity can arise when several paths exist to a class from the same base class. This means that a child class could have duplicate sets of members inherited from a single base class. C++ solves this issue by introducing a virtual base class. When a class is made virtual, necessary care is taken so that the duplication is avoided regardless of the number of paths that exist to the child class.
b)      What is late binding?
Refer April 2008 (a)
c)      What will be the output of the following?
cout << setw(10) << 15 << setbase(16) << 15;








1
5
f
d)      “A destructor can be declared virtual” - State True/False.
True
e)      List any two operators which should be overloaded as a member function.
Refer April 2008 (g)
f)       What is the purpose of reference variable?
While working with classes in C++, there are times when you have to pass a class object as an argument to some function. If we pass the object by value it will be very expensive as all the object data is copied from actual object to formal object. But if we pass the object by reference the formal object just becomes alias to actual object and no copying takes place.
g)      Which flags should be used to open a binary file for writing only if the file does not exist?
ios::binary|ios::noreplace|ios::out
h)      List the different types of iterators.
Refer Oct 2010 (i)
i)       We cannot prevent a function from throwing an exception state True/False and justify.
False – It is possible to restrict a function to throw only certain specified exceptions. This is achieved by adding a throw list class to the function definition.
j)       Write a disadvantage of the inline function.
Refer Oct 2008 (d)

April 2013
a)      Differentiate between structure and class in C++.
Structure
Class
Members of struct are public by default.
Members of a class are private by default.
When deriving a struct from a class/struct, default access-specifier for a base class/struct is public.
When deriving a class, default access specifier is private.
b)      Write syntax to invoke static member function.
Syntax: class-name::function-name([args]);
c)      What is the order of execution of constructors?
class A: public B, virtual public C
{
:
};
First constructor of C, then B and then A is called.
d)      How many explicit arguments are required if binary operator is overloaded using member function?
One
e)      State one advantage of generic function.
Refer April 2007 (j)
f)       What is the difference between pointer and a reference variable?
Pointer
Reference
A pointer can be re-assigned any number of times.
A reference cannot be re-seated after binding.
Pointers can point nowhere (NULL)
Reference always refers to an object.
You can get the address of a pointer
You can't take the address of a reference
Pointer arithmetic is allowed
Reference arithmetic is not allowed
g)      Justify true/false: “function cannot return class object”.
Refer Oct 2010 (c)
h)      Write the syntax of pure virtual function.
Syntax: virtual void function-name([args])=0;
i)       Write meaning of ios::trunc file mode parameter.
Delete contents of file if it exists. (truncate) Any current content is discarded, assuming a length of zero on opening.
j)       The generic catch block must be the first among all catch blocks. State true or false.

False

14 comments:

  1. It was vry helpful for us.....thanqq sir....!!

    ReplyDelete
  2. Nicely done and very insightful!! ����

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. 👌👌👌👌✌✌✌✌
    Helped alot..
    Thank you sir..

    ReplyDelete
  5. 👌👌👌👌✌✌✌✌
    Helped alot..
    Thank you sir..

    ReplyDelete
  6. Thank you for sharing useful notes Sir!!!

    ReplyDelete
  7. Thank you so much sir for this..surely it will help us��

    ReplyDelete
  8. Thanks a lot Sir.Exciting stuff!
    It will definitely help us.

    ReplyDelete
  9. This comment has been removed by the author.

    ReplyDelete
  10. Good one. This will definitely help the students.

    ReplyDelete
  11. Thank you sir,it will definitely help the students.

    ReplyDelete
  12. Fantastic Start sir!! Hope this blog becomes most popular among puṇe uni students !
    All the very best����

    ReplyDelete