C Plus Plus Miscellaneous - Study Mode

[#831] What will be the output of the following C++ code? #include <iostream>
#include <string>
using namespace std
int main()
{
cout<<extent<remove_all_extents<string[10][20][30]>::type>::value
return 0
}
Correct Answer

(D) 0

[#832] 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(10)
mypq.push(20)
mypq.push(15)
cout << mypq.top() << endl
return 0
}
Correct Answer

(B) 20

[#833] What will be the output of the following C++ code? #include <iostream>
#include <locale>
using namespace std
int main()
{
locale mylocale("")
cout.imbue( mylocale )
cout << (double) 3.14159 << endl
return 0
}
Correct Answer

(B) 3.14159

[#834] What will be the output of the following C++ code? #include <iostream>
using namespace std
template <class T>
class XYZ
{
public:
void putPri()
static T ipub
private:
static T ipri
}
template <class T>
void XYZ<T>::putPri()
{
cout << ipri++ << endl
}
template <class T> T XYZ<T>::ipub = 1
template <class T> T XYZ<T>::ipri = 1.2
int main()
{
XYZ<int> a
XYZ<float> b
a.putPri()
cout << a.ipub << endl
b.putPri()
}
Correct Answer

(D) 1 1 1.2

[#835] What will be the output of the following C++ code? #include <iostream>
#include <complex>
using namespace std
int main()
{
complex <double> cn(3.0, 4.0)
cout<<log(cn)<<endl
return 0
}
Correct Answer

(B) (1.60944,0.927295)