ExamVeda
Login
Home
91
What will be the output of the following C++ code?
#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
template<class T>
T func(T a)
{
	return a;
}
 
template<class T, class U>
T func(U a)
{
	return (T)a;
}
 
int main(int argc, char const *argv[])
{
	int a = 5;
	int b = func(a);
	int c = func(5.5);
	cout<<b<<c<<endl;
	return 0;
}
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
92
Which of the following statements are correct about Catch handler?
i. It must be placed immediately after the try block
ii. It can have more than one parameters
iii. There must be one and only one catch handler for every try block
iv. There can be multiple catch handler for a try block
v. General catch handler can be kept anywhere after try block.
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
93
What is the class relationship?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
94
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
template <class type>
class Test
{
    public:
    Test();
    ~Test();
    type Data(type);
};
template <class type>
type Test<type>::Data(type Var0)
{
    return Var0;
}
template <class type>
Test<type>::Test()
{
}
template <class type>
Test<type>::~Test()
{
}
int main(void)
{
    Test<char> Var3;
    cout << Var3.Data('K') << endl;
    return 0;
}
Discuss
Answer & Solution
Answer: Option A
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 <iterator>
#include <vector>
using namespace std;
int main () 
{
    vector<int> myvector;
    for (int i = 0; i < 10; i++) 
        myvector.push_back(i);
    typedef vector<int> :: iterator iter_int;
    reverse_iterator<iter_int> rev_iterator;
    rev_iterator = myvector.rend() - 4;
    cout << *rev_iterator << endl;
    return 0;
}
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
96
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main()
{
    unsigned long x = 64;
    cout << x << oct << x << endl;
    return 0;
}
Discuss
Answer & Solution
Answer: Option A
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>
using namespace std;
int main()
{
    int x = -1;
    try 
    {
        if (x < 0)
        {
            throw x;
        }
        else
        {
            cout<<x;
        }
    }
     catch (int x )
    {
        cout << "Exception occurred: Thrown value is " << x << endl;
    }
    return 0;
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
98
What is the difference between get() and at()?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
99
How the different permutations are ordered in c++?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
100
What is the use of accumulate function in a numeric library?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board