Which members are inherited but are not accessible in any case?
Protected
Both private and protected
Public
Private
45 practice sets · Page 2 of 3
Which members are inherited but are not accessible in any case?
Protected
Both private and protected
Public
Private
Which of the following statement is true?
Both I and II
I only
Neither I nor II
II only
What happens if a class does not have a name?
It will not have a destructor
It will neither have a constructor or destructor
It will not have a constructor
It is not allowed
Which of the following is not a type of inheritance?
Multilevel
Multiple
Hierarchical
Distributive
Which of the following is true?
I only
Both I and II
II only
Neither I nor II
Which of the following is a static polymorphism mechanism?
Operator overloading
Templates
All of the mentioned
Function overloading
Which of the following supports the concept that reusability is a desirable feature of a language?
It decreases the compilation time
It reduces maintenance cost
It reduced both testing and maintenance time
It reduces the testing time
Which of the following is correct?
C++ allows dynamic type checking.
C++ allows both static and dynamic type checking
C++ allows static member function to be of type const.
C++ allows static type checking
Which concept is used to implement late binding?
Virtual functions
Operator functions
Static functions
Constant functions
Which of the following cannot be used with the virtual keyword?
Constructors
Destructors
Class
Member functions
Which operator is overloaded for a cout object?
<
<<
In how many ways we can handle errors in any class?
2
1
3
4
What is the use of reset() function?
Used to destroys the contained object in any variable
Used to change the object any container is holding
Used to empty any container value
Used to check the type of any variable
What is the use of has_value() function in any container?
Used to return the type information about the any container
Used to destroys the contained object in any variable
Used to check whether any container is empty or not
Used to change the object any container is holding
What will be the output of the following C++ code
#include
#include
using namespace std;
int main()
{
float val = 5. any var(val);
cout<<var.type().name()<<endl;
return}
Pkc
f
d
u
What is the use of type() function in any container?
Used to change the object any container is holding
Used to return the type information about the any container
Used to check whether a container is empty or not
Used to destroys the contained object in any variable
What is the use of emplace() function?
Used to check the type of any variable
Used to add more item to the any list
Used to empty any container value
Used to change the object any container is holding
Which exception is thrown if the typecasting is not done properly?
type_mismatched
bad_any_cast
bad_cast_mismatched
bad_type_cast
What happens when both of the following C++ programs are compiled and executed
===== Program 1 =====
#include
#include
using namespace std;
int main()
{
array<int,arr arr1.fill(5);
cout<<get<5>(arr1);
return}
=====================
===== Program 2 =====
#include
#include
using namespace std;
int main()
{
array<int,arr arr1.fill(5);
cout<<arr1.at(5);
return}
=====================
Program 1 gives run-time error and Program 2 gives compile-time error
Both programs results into compile-time error
Both programs results into run-time error
Program 1 gives compile-time error and Program 2 gives run-time error
What will be the output of the following C++ code
#include
#include
using namespace std;
int main(int argc, char const *argv[])
{
array<int,arr arr1.fill(5);
cout<<get<5>(arr1);
return}
Compile-time error
Run-time error
Segmentation fault
5