Q361
Open questionSelect an option to see the answer and solution.
Practice every MCQ with options. Use Show answers when you want the correct option and solution.
1,008
Questions
19/51
Page
Pick an option on a question to see the right answer and solution.
Q361
Open questionSelect an option to see the answer and solution.
Q362
Open question#include <iostream>
#include <complex>
using namespace std;
int main()
{
complex <double> cn(3.0, 4.0);
cout<<"Norm is: "<<norm(cn)<<endl;
return 0;
}Select an option to see the answer and solution.
Q363
Open question#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
cout << RAND_MAX << endl;
}Select an option to see the answer and solution.
Q364
Open questionSelect an option to see the answer and solution.
Q365
Open questionSelect an option to see the answer and solution.
Q366
Open question#include <iostream>
#include <cctype>
using namespace std;
int main(int argc, char const *argv[])
{
char arr[12] = "H3ll0\tW0r1d";
for(int i=0;i<12;i++)
{
cout<<(bool)iscntrl(arr[i]);
}
}Select an option to see the answer and solution.
Q367
Open question#include <iostream>
#include <functional>
#include <algorithm>
using namespace std;
int main ()
{
int numbers[] = {10, -20, -30, 40, -50};
int cx;
cx = count_if ( numbers, numbers + 5, bind2nd(less<int>(), 0) );
cout << cx;
return 0;
}Select an option to see the answer and solution.
Q368
Open question#include <iostream>
#include <bitset>
using namespace std;
int main()
{
bitset<8> b1(95);
bitset<8> b2(46);
cout<<(b1^b2);
}Select an option to see the answer and solution.
Q369
Open questioni) cout<<*i1;
ii) i2 can be used with == operator
iii) *i1 = 1
iv) i2--Select an option to see the answer and solution.
Q370
Open questionSelect an option to see the answer and solution.
Q371
Open questionSelect an option to see the answer and solution.
Q372
Open question#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main ()
{
int myints[] = { 10, 20, 30 ,40 };
int * p;
p = find (myints, myints + 4, 30);
--p;
cout << *p << '\n';
return 0;
}Select an option to see the answer and solution.
Q373
Open questionSelect an option to see the answer and solution.
Q374
Open questionSelect an option to see the answer and solution.
Q375
Open questionSelect an option to see the answer and solution.
Q376
Open question#include <iostream>
using namespace std;
struct A
{
int i;
char j;
float f;
void func();
};
void A :: func() {}
struct B
{
public:
int i;
char j;
float f;
void func();
};
void B :: func() {}
int main()
{
A a; B b;
a.i = b.i = 1;
a.j = b.j = 'c';
a.f = b.f = 3.14159;
a.func();
b.func();
cout << "Allocated";
return 0;
}Select an option to see the answer and solution.
Q377
Open questionSelect an option to see the answer and solution.
Q378
Open question#include <iostream>
using namespace std;
template <class T>
inline T square(T x)
{
T result;
result = x * x;
return result;
};
template <>
string square<string>(string ss)
{
return (ss+ss);
};
int main()
{
int i = 2, ii;
string ww("A");
ii = square<int>(i);
cout << i << ": " << ii;
cout << square<string>(ww) << ":" << endl;
}Select an option to see the answer and solution.
Q379
Open questionSelect an option to see the answer and solution.
Q380
Open question#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
template<class T>
class A
{
public:
T func(T a, T b){
return a/b;
}
};
int main(int argc, char const *argv[])
{
A <float>a1;
cout<<a1.func(3,2)<<endl;
cout<<a1.func(3.0,2.0)<<endl;
return 0;
}Select an option to see the answer and solution.