Which exception is thrown if the typecasting is not done properly?
a) bad_type_cast
b) bad_any_cast
c) type_mismatched
d) bad_cast_mismatched
Q.2.
What is the use of emplace() function?
a) Used to change the object any container is holding
b) Used to add more item to the any list
c) Used to empty any container value
d) Used to check the type of any variable
Q.3.
What is the use of type() function in any container?
a) Used to destroys the contained object in any variable
b) Used to change the object any container is holding
c) Used to return the type information about the any container
d) Used to check whether a container is empty or not
Q.4.
What will be the output of the following C++ code?
#include<iostream>
#include<any>
using namespace std;
int main()
{
float val = 5. any var(val);
cout<<var.type().name()<<endl;
return}
a) f
b) d
c) Pkc
d) u
Q.5.
What is the use of has_value() function in any container?
a) Used to destroys the contained object in any variable
b) Used to change the object any container is holding
c) Used to return the type information about the any container
d) Used to check whether any container is empty or not
Q.6.
What is the use of reset() function?
a) Used to destroys the contained object in any variable
b) Used to change the object any container is holding
c) Used to empty any container value
d) Used to check the type of any variable
Q.7.
In how many ways we can handle errors in any class?
a) 1
b) 2
c) 3
d) 4
Support mcqgeeks.com by disabling your adblocker.
Please disable the adBlock and continue. Thank you.