Q261
Open question#include <iostream>
using namespace std;
int main ()
{
int i;
cout << "Please enter an integer value: ";
cin >> i + 4;
return 0;
}Select 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
14/51
Page
Pick an option on a question to see the right answer and solution.
Q261
Open question#include <iostream>
using namespace std;
int main ()
{
int i;
cout << "Please enter an integer value: ";
cin >> i + 4;
return 0;
}Select an option to see the answer and solution.
Q262
Open questionSelect an option to see the answer and solution.
Q263
Open questionSelect an option to see the answer and solution.
Q264
Open questionSelect an option to see the answer and solution.
Q265
Open questionSelect an option to see the answer and solution.
Q266
Open question#include<iostream>
#include <fstream>
using namespace std;
int main ()
{
ofstream outfile ("test.txt");
for (int n = 0; n < 100; n++)
{
outfile << n;
outfile.flush();
}
cout << "Done";
outfile.close();
return 0;
}Select an option to see the answer and solution.
Q267
Open question#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
string s = "spaces in text";
s.erase(remove(s.begin(), s.end(), ' ' ), s.end() ) ;
cout << s << endl;
}Select an option to see the answer and solution.
Q268
Open questionSelect an option to see the answer and solution.
Q269
Open question#include<iostream>
#include<any>
using namespace std;
int main()
{
int a = 5;
any var = a;
cout<<var<<endl;
return 0;
}Select an option to see the answer and solution.
Q270
Open questionSelect an option to see the answer and solution.
Q271
Open questionSelect an option to see the answer and solution.
Q272
Open question#include <stdexcept>
#include <limits>
#include <iostream>
using namespace std;
void MyFunc(char c)
{
if (c < numeric_limits<char>::max())
return invalid_argument;
}
int main()
{
try
{
MyFunc(256);
}
catch(invalid_argument& e)
{
cerr << e.what() << endl;
return -1;
}
return 0;
}Select an option to see the answer and solution.
Q273
Open question#include <iostream>
using namespace std;
template <class T>
class A
{
public:
A(int a): x(a) {}
protected:
int x;
};
template <class T>
class B: public A<char>
{
public:
B(): A<char>::A(100)
{
cout << x * 2 << endl;
}
};
int main()
{
B<char> test;
return 0;
}Select an option to see the answer and solution.
Q274
Open questionSelect an option to see the answer and solution.
Q275
Open questionSelect an option to see the answer and solution.
Q276
Open question#include <iostream>
using namespace std;
template<int n>
struct funStruct
{
static const int val = 2*funStruct<n-1>::val;
};
template<>
struct funStruct<0>
{
static const int val = 1 ;
};
int main()
{
cout << funStruct<10>::val << endl;
return 0;
}Select an option to see the answer and solution.
Q277
Open question#include <iostream>
using namespace std;
void square (int *x)
{
*x = (*x + 1) * (*x);
}
int main ( )
{
int num = 10;
square(&num);
cout << num;
return 0;
}Select an option to see the answer and solution.
Q278
Open question#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main ()
{
srand (time(NULL));
printf ("Random number: %d\n", rand() % 100);
srand (1);
return 0;
}Select an option to see the answer and solution.
Q279
Open questionSelect an option to see the answer and solution.
Q280
Open questionSelect an option to see the answer and solution.