Q341
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
18/51
Page
Pick an option on a question to see the right answer and solution.
Q341
Open questionSelect an option to see the answer and solution.
Q342
Open questionSelect an option to see the answer and solution.
Q343
Open question#include<iostream>
using namespace std;
int main()
{
int a = 5;
auto check = [](int x)
{
if(x == 0)
return false;
else
return true;
};
cout<<check(a)<<endl;
return 0;
}Select an option to see the answer and solution.
Q344
Open question#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
bool mygreater (int i,int j)
{
return (i > j);
}
int main ()
{
int myints[] = {10, 20, 30, 30, 20, 10, 10, 20};
vector<int> v(myints, myints + 8);
pair<vector<int> :: iterator, vector<int> :: iterator> bounds;
sort (v.begin(), v.end());
bounds = equal_range (v.begin(), v.end(), 20);
cout << (bounds.first - v.begin());
cout << " and " << (bounds.second - v.begin()) << '\n';
return 0;
}Select an option to see the answer and solution.
Q345
Open questionSelect an option to see the answer and solution.
Q346
Open question#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
template<class T>
class A
{
T a;
public:
A(){}
~A(){}
};
int main(int argc, char const *argv[])
{
A <char>a1;
A <int>a2;
A <double>a3;
cout<<sizeof(a1)<<endl;
cout<<sizeof(a2)<<endl;
cout<<sizeof(a3)<<endl;
return 0;
}Select an option to see the answer and solution.
Q347
Open question#include <iostream>
using namespace std;
class Cat
{
public:
int age;
int weight;
};
int main()
{
Cat f;
f.age = 56;
cout << "Gates is " ;
cout << f.age << " years old.\n";
}Select an option to see the answer and solution.
Q348
Open questionSelect an option to see the answer and solution.
Q349
Open questionSelect an option to see the answer and solution.
Q350
Open questionSelect an option to see the answer and solution.
Q351
Open questionSelect an option to see the answer and solution.
Q352
Open questionSelect an option to see the answer and solution.
Q353
Open questionSelect an option to see the answer and solution.
Q354
Open questionSelect an option to see the answer and solution.
Q355
Open questionSelect an option to see the answer and solution.
Q356
Open questionSelect an option to see the answer and solution.
Q357
Open questionSelect an option to see the answer and solution.
Q358
Open questionSelect an option to see the answer and solution.
Q359
Open questionSelect an option to see the answer and solution.
Q360
Open question#include <stdio.h>
int main ()
{
int n;
FILE * p;
char buffer [5];
p = fopen ("myfile.txt", "w+");
for ( n = 'A' ; n <= 'D' ; n++)
fputc ( n, p);
rewind (p);
fread (buffer, 1, 5, p);
fclose (p);
buffer[3] = '\0';
puts (buffer);
return 0;
}Select an option to see the answer and solution.