Q221
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.
251
Questions
12/13
Page
Pick an option on a question to see the right answer and solution.
Q221
Open questionSelect an option to see the answer and solution.
Q222
Open question#include <stdio.h>
#include<iostream>
using namespace std;
int main()
{
int x = 5, y = 5, z;
x = ++x; y = --y;
z = x++ + y--;
cout << z;
return 0;
}Select an option to see the answer and solution.
Q223
Open question#include <stdio.h>
#include<iostream>
using namespace std;
int main()
{
int num1 = 5;
int num2 = 3;
int num3 = 2;
num1 = num2++;
num2 = --num3;
cout << num1 << num2 << num3;
return 0;
}Select an option to see the answer and solution.
Q224
Open questionway 1:
string s1 = "hello";
string s2 = "world";
string s3 = s1 + s2;
way 2:
string s1 = "hello";
string s2 = "world";
string s3 = s1.append(s2);
way 3:
string s1 = "hello";
string s2 = "world";
string s3 = strcat(s1,s2);Select an option to see the answer and solution.
Q225
Open questionSelect an option to see the answer and solution.
Q226
Open questionSelect an option to see the answer and solution.
Q227
Open questionSelect an option to see the answer and solution.
Q228
Open questionSelect an option to see the answer and solution.
Q229
Open question#include <iostream>
using namespace std;
class sample
{
private:
int a, b;
public:
void test()
{
a = 100;
b = 200;
}
friend int compute(sample e1);
};
int compute(sample e1)
{
return int(e1.a + e1.b) - 5;
}
int main()
{
sample e;
e.test();
cout << compute(e);
return 0;
}Select an option to see the answer and solution.
Q230
Open questionSelect an option to see the answer and solution.
Q231
Open questionSelect an option to see the answer and solution.
Q232
Open question#include <iostream>
#include <string>
using namespace std;
int main(int argc, char const *argv[])
{
string str;
cin>>str;
cout<<str;
return 0;
}Select an option to see the answer and solution.
Q233
Open question#include <iostream>
#include <string>
using namespace std;
class A
{
mutable int a;
public:
int assign(int i) const {
a = i;
}
int return_value() const {
return a;
}
};
int main(int argc, char const *argv[])
{
A obj;
obj.assign(5);
cout<<obj.return_value();
}Select an option to see the answer and solution.
Q234
Open questionSelect an option to see the answer and solution.
Q235
Open question#include <iostream>
#include <string>
using namespace std;
int main ()
{
string str ("helloworld.");
cout << str.substr(3).substr(4) << endl;
return 0;
}Select an option to see the answer and solution.
Q236
Open question#include <iostream>
#include <string>
using namespace std;
int main(int argc, char const *argv[])
{
char str[] = "Hello World";
cout<<str[0];
return 0;
}Select an option to see the answer and solution.
Q237
Open questionSelect an option to see the answer and solution.
Q238
Open questionSelect an option to see the answer and solution.
Q239
Open questionSelect an option to see the answer and solution.
Q240
Open question#include <iostream>
using namespace std;
int main()
{
int a = 0;
int b = 10;
if ( a && b )
{
cout << "true"<< endl ;
}
else
{
cout << "false"<< endl ;
}
return 0;
}Select an option to see the answer and solution.