Vidyalelo
C++ Programming · all questions

Standard Template Library (STL) in C++
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

109

Questions

4/6

Page

Pick an option on a question to see the right answer and solution.

Which header file is used for Iterators?

Select an option to see the answer and solution.

What will be the output of the following C++ code?
#include <iostream>
#include <exception>
using namespace std;
class myexc: public exception
{
    virtual const char* what() const throw()
    {
        return "My exception";
    }
} myex;
int main () 
{
    try
    {
        throw myex;
    }
    catch (exception& e)
    {
        cout << e.what() << endl;
    }
    return 0;
}

Select an option to see the answer and solution.

What is the use of make_heap in the heap operation?

Select an option to see the answer and solution.

What will be the output of the following C++ code?
#include <stdio.h>
#include <math.h>
int main ()
{
    printf ("The value of -3.1416 is %lf\n", fabs (-3.1416));
    return 0;
}

Select an option to see the answer and solution.

What are the predefined exceptions in c++?

Select an option to see the answer and solution.

Pick out the correct library in the following choices.

Select an option to see the answer and solution.

In how many categories, containers are divided?

Select an option to see the answer and solution.

Which header file is used to declare the standard exception?

Select an option to see the answer and solution.

Pick out the wrong header file about strings.

Select an option to see the answer and solution.

What is the type of the first item in the heap?

Select an option to see the answer and solution.

How many components STL has?

Select an option to see the answer and solution.

What will be the output of the following C++ code?
#include <iostream>
#include <exception>
using namespace std;
int main () 
{
    try
    {
        int* myarray= new int[1000];
        cout << "Allocated";
    }
    catch (exception& e)
    {
        cout << "Standard exception: " << e.what() << endl;
    }
    return 0;
}

Select an option to see the answer and solution.

What is meant by standard c++ library?

Select an option to see the answer and solution.

How many Container Adaptors are provided by C++?

Select an option to see the answer and solution.

Which of the following mathematical function is overloaded in <complex> and <valarray>?

Select an option to see the answer and solution.

Pick out the correct syntax of the header file that can be used with C++.

Select an option to see the answer and solution.

What will be the output of the following C++ code?
#include <stdio.h>
#include <stdlib.h>
int compareints (const void * a, const void * b)
{
    return ( *(int*)a - *(int*)b );
}
int values[] = { 50, 20, 60, 40, 10, 30 };
int main ()
{
    int * p;
    int key = 40;
    qsort(values, 6, sizeof (int), compareints);
    p = (int*) bsearch (&key, values, 6, sizeof (int), compareints);
    if (p != NULL)
    printf ("%d\n",*p);
    return 0;
}

Select an option to see the answer and solution.

With which does the trigonometric functions work with angles in c++?

Select an option to see the answer and solution.

What are the Associative Containers?

Select an option to see the answer and solution.

How many types of Iterators are provided by C++?

Select an option to see the answer and solution.