Q201
Open question#include <stdio.h>
#include<iostream>
using namespace std;
int main()
{
int x = 5, y = 5, z;
x = ++x; y = --y;
z = x + ++x;
cout << z;
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.
251
Questions
11/13
Page
Pick an option on a question to see the right answer and solution.
Q201
Open question#include <stdio.h>
#include<iostream>
using namespace std;
int main()
{
int x = 5, y = 5, z;
x = ++x; y = --y;
z = x + ++x;
cout << z;
return 0;
}Select an option to see the answer and solution.
Q202
Open question#include <iostream>
#include <string>
using namespace std;
class B
{
int b;
public:
B(){}
B(int i){
b = i;
}
int show(){
return b;
}
};
class C
{
B b;
public:
C(int i){
b = B(i);
}
friend void show();
};
void show()
{
C c(10);
cout<<"value of b is: "<<c.b.show()<<endl;
}
int main(int argc, char const *argv[])
{
show();
return 0;
}Select an option to see the answer and solution.
Q203
Open question#include
using namespace std;
class CDummy
{
public:
int isitme (CDummy& param);
};
int CDummy::isitme (CDummy& param)
{
if (¶m == this)
return true;
else
return false;
}
int main ()
{
CDummy a;
CDummy *b = &a;
if (b->isitme(a))
{
cout << "execute";
}
else
{
cout<<"not execute";
}
return 0;
} Select an option to see the answer and solution.
Q204
Open questionSelect an option to see the answer and solution.
Q205
Open questionSelect an option to see the answer and solution.
Q206
Open question#include <iostream>
#include <string>
using namespace std;
class A
{
static int a;
public:
void show()
{
a++;
cout<<"a: "<<a<<endl;
}
};
int A::a = 5;
int main(int argc, char const *argv[])
{
A a;
return 0;
}Select an option to see the answer and solution.
Q207
Open questionSelect an option to see the answer and solution.
Q208
Open questionSelect an option to see the answer and solution.
Q209
Open question#include <iostream>
#include <string>
using namespace std;
class Box{
int capacity;
public:
Box(){}
Box(double capacity){
this->capacity = capacity;
}
};
int main(int argc, char const *argv[])
{
Box b1(10);
Box b2 = Box(14);
if(b1 == b2){
cout<<"Equal";
}
else{
cout<<"Not Equal";
}
return 0;
}Select an option to see the answer and solution.
Q210
Open questionSelect an option to see the answer and solution.
Q211
Open question#include <iostream>
using namespace std;
class numbers
{
private:
int m_nValues[10];
public:
int& operator[] (const int nValue);
};
int& numbers::operator[](const int nValue)
{
return m_nValues[nValue];
}
int main()
{
numbers N;
N[5] = 4;
cout << N[5];
return 0;
}Select an option to see the answer and solution.
Q212
Open questionSelect an option to see the answer and solution.
Q213
Open questionSelect an option to see the answer and solution.
Q214
Open questionSelect an option to see the answer and solution.
Q215
Open questionSelect an option to see the answer and solution.
Q216
Open questionSelect an option to see the answer and solution.
Q217
Open questionSelect an option to see the answer and solution.
Q218
Open question#include <iostream>
using namespace std;
int main()
{
typedef int num;
typedef char let;
let w = "steve";
num a = 10, b = 15;
num c = a + w;
cout << c;
return 0;
}Select an option to see the answer and solution.
Q219
Open question#include <iostream>
#include <string>
using namespace std;
int main(int argc, char const *argv[])
{
char str[10];
cin>>str;
cout<<str;
return 0;
}Select an option to see the answer and solution.
Q220
Open questionSelect an option to see the answer and solution.