Subjective Solved
Question No: 30 ( Marks: 2 )
What are the two types of conversion for user-defined data types?
There are two types of conversion: implicit and explicit.
Question No: 31 ( Marks: 2 )
Give the general syntax of class template.
The syntax of the template class is
template
class class-name()
{ definition of class };
Question No: 32 ( Marks: 2 )
What is a constructor in class?
The name of this function is same as the name of the class, having no return type. This function is called constructor.
Question No: 33 ( Marks: 2 )
Is there a way to increase the size of already allocated memory chunk ? Can the same chunk be increased or not?
Can the same chunk be increased or not? The answer is yes. we can reallocate the same memory with a new size according to our requirement. The function that reallocates the memory is realloc.
Question No: 34 ( Marks: 3 )
What is the difference between structure and class?.
The ONLY DIFFERENCES between classes and structures are
1) classes DEFAULT to having private members. Structures DEFAULT to having public members. These defaults can be changed so classes can be made to work like structures and vice versa.
2) classes DEFAULT to inheriting privately from base classes. Structures DEFAULT to inheriting public from base classes. These defaults can be changed so classes can be made to work like structures and vice versa.
Question No: 35 ( Marks: 3 )
How many arguments does binary member operator function and binary non- member operator function take?
When an operator function is defined as member function for a binary Plus (+)
operator then the number of argument it take is/are
Question No: 36 ( Marks: 2 ) - Write Program
Find the error in the given code for ( int i=0; imRows; i++)
{
for(int j=0; jumCols; j++)
{
elements[i , j] = m.elements[i][j];
}
}
Question No: 39 ( Marks: 10 ) -
What is Standard Template Library (STL) also describe its advantages?
The standard template library is the collection of functions of very common use. Their every day use is so important that two researchers wrote a whole library of these functions. This library is a part of the official standard of C++. It is called STL i.e. Standard Template Library. As a library, it is a tested code base. Some one has written, tested and compiled for the ultimate use of programmers. We can use these templates and can implement different concepts for our own data types. Equally is true about the use of the array data type. Our code will become very small with the use of this tested facility. Similarly, there is no bug or error in it. Thus, if we have a tested and tried code base, we should try our best to write programs by using it. STL is a lot of important code, pre-developed for us. It is available as a library. We can write programs by using it. Thus our programs will be small and error free