ExamVeda
Login
Home
51
Pick out parameter for rehash method in unordered_set in c++?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
52
What are Container Adaptors?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
53
What are Unordered Associative Containers?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
54
How does the limits.h header file can be represented in C++?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
55
What will be the output of the following C++ code?
#include <iostream>
#include <vector>
using namespace std;
int main()
{
    vector<int> v;
    v.assign( 10, 42 );
    for (int i = 0; i < v.size(); i++) 
    {
        cout << v[i] << " ";
    }
}
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
56
Pick out the wrong header file.
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
57
What will be the output of the following C++ code?
#include <stdio.h>    
#include <stdlib.h>
int main ()
{
    char s[] = "365.24 29.53";
    char* p;
    double d1, d2;
    d1 = strtod (s, &p);
    d2 = strtod (p, NULL);
    printf ("%.2f\n", d1/d2);
    return 0;
}
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
58
What will be the output of the following C++ code?
#include <iostream>
#include <list>
#include <queue>
using namespace std;
int main()
{
    queue<char> q;
    q.push('a');
    q.push('b');
    q.push('c');
    cout << q.front();
    q.pop();
    cout << q.front();
    q.pop();
    cout << q.front();
    q.pop();
}
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
59
What will be the output of the following C++ code?
#include <list>
#include <string>
#include <iostream>
using namespace std ;
typedef list<string> LISTSTR; 
int main()
{
    LISTSTR :: iterator i;
    LISTSTR test;
    test.insert(test.end(), "one");
    test.insert(test.end(), "two");
    LISTSTR test2(test);
    LISTSTR test3(3, "three");
    LISTSTR test4(++test3.begin(),
    test3.end());
    cout << "test:";
    for (i =  test.begin(); i != test.end(); ++i)
        cout << " " << *i << endl;
    cout << "test:";
    for (i =  test2.begin(); i != test2.end(); ++i)
        cout << " " << *i << endl;
    cout << "test:";
    for (i =  test3.begin(); i != test3.end(); ++i)
        cout << " " << *i << endl;
    cout << "test:";
    for (i =  test4.begin(); i != test4.end(); ++i)
        cout << " " << *i << endl;
}
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
60
What is the use of <exception> header
Discuss
Answer & Solution
Answer: Option A
Solution:
The <exception> header in C++ is specifically designed to handle errors and unusual situations that occur during the execution of a program.
It defines a hierarchy of standard exception classes, such as std::exception, std::bad_alloc, std::runtime_error, and others.
These classes are used to represent different types of errors and provide a way to report and handle them gracefully.
Option B is incorrect because <exception> doesn't contain all standard library files.
Option C is partially correct, as exceptions can be raised, but <exception> primarily *defines* the exception classes, not directly raise them (though you can throw instances of these classes).
Option D is incorrect because <exception> has nothing to do with reducing memory size. Its purpose is for error handling.