C Plus Plus Miscellaneous - Study Mode
[#701] What will be the output of the following C++ code? #include <iostream>
#include <algorithm>
#include <vector>
using namespace std
int main ()
{
int myints[] = {1, 2, 3, 4 ,5}
vector<int> v(myints, myints + 5)
v.push_back(33)
push_heap (v.begin(),v.end())
cout << v.front() << '
'
sort_heap (v.begin(),v.end())
return 0
}
Correct Answer
(B) 33
[#702] What will be the output of the following C++ code? #include <iostream>
#include <limits>
using namespace std
int main( )
{
cout << numeric_limits<float> :: is_exact
cout << numeric_limits<double> :: is_exact
cout << numeric_limits<long int> :: is_exact
cout << numeric_limits<unsigned char> :: is_exact
}
Correct Answer
(D) 0011
[#703] What will be the output of the following C++ code? #include <iostream>
#include <bitset>
using namespace std
int main()
{
bitset<8> b1(15)
cout<<b1
}
Correct Answer
(A) 00001111
[#704] What will be the output of the following C++ code? #include <iostream>
#include <array>
using namespace std
int main(int argc, char const *argv[])
{
array<int,5> arr1
arr1.fill(5)
cout<<get<5>(arr1)
return 0
}
Correct Answer
(B) Compile-time error
[#705] What will be the output of the following C++ code? #include <iostream>
using namespace std
int main( )
{
char line[100]
cin.getline( line, 100, 't' )
cout << line
return 0
}
Correct Answer
(C) It will print what we enter till character t is encountered in the input data