ExamVeda
Login
Home
91
What is meant by template specialization?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
92
What will be the output of the following C++ code?
#include <iostream>
#include <vector>
using namespace std;
class Component
{ 
    public:
    virtual void traverse() = 0;
};
class Leaf: public Component
{
    int value;
    public:
    Leaf(int val)
    {
        value = val;
    }
    void traverse()
    {
        cout << value << ' ';
    }
};
class Composite: public Component
{
    vector < Component * > children;
    public:
    void add(Component *ele)
    {
        children.push_back(ele);
    }
    void traverse()
    {
        for (int i = 0; i < children.size(); i++)
            children[i]->traverse();
    }
};
int main()
{
    Composite containers[4];
    for (int i = 0; i < 4; i++)
        for (int j = 0; j < 3; j++)
            containers[i].add(new Leaf(i *3+j));
        for (int k = 1; k < 4; k++)
            containers[0].add(&(containers[k]));
        for (int p = 0; p < 4; p++)
        {
            containers[p].traverse();
        }
}
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
93
Which can be used to create a random number without duplication?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
94
Which handler is used to handle all types of exception?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
95
What will be the output of the following C++ code?
#include <iostream>
#include <queue>
using namespace std;
int main ()
{
    priority_queue<int> mypq;
    mypq.push(30);
    mypq.push(100);
    mypq.push(25);
    mypq.push(40);
    while (!mypq.empty())
    {
        cout << " " << mypq.top();
        mypq.pop();
    }
    cout << endl;
    return 0;
}
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
96
Which of the following is true about exception handling in C++?
i. There is a standard exception class in C++ similar to Exception class in Java.
ii. All exceptions are unchecked in C++, i.e., the compiler does not checks if the exceptions are caught or not.
iii. In C++, a function can specify the list of exceptions that it can throw using comma separated list like following.
void fun(int a, char b) throw (Exception1, Exception2, ..)
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
97
What will be the output of the following C++ code?
#include <iostream>
#include <iterator>
#include <list>
using namespace std;
int main () 
{
    list<int> firstlist, secondlist;
    for (int i = 1; i <= 2; i++)
    {  
        firstlist.push_back(i); 
        secondlist.push_back(i * 10); 
    }
    list<int> :: iterator it;
    it = firstlist.begin(); 
    advance (it, 3);
    copy (secondlist.begin(), secondlist.end(), inserter(firstlist, it));
    for ( it = firstlist.begin(); it != firstlist.end(); ++it )
        cout << *it << " ";
    return 0;
}
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
98
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
template<typename type>
type Max(type Var1, type Var2)
{
    return Var1 > Var2 ? Var1:Var2;
}
int main()
{
    int p;
    p = Max(100, 200);
    cout << p << endl;
    return 0;
}
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
99
Which operator is used for input stream?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
100
How many categories are available in facets?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board