Q181
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
10/13
Page
Pick an option on a question to see the right answer and solution.
Q181
Open questionSelect an option to see the answer and solution.
Q182
Open questionSelect an option to see the answer and solution.
Q183
Open question#include <iostream>
#include <complex>
using namespace std;
int main()
{
complex<int> i(2, 3);
i = i * 6 / 3;
cout << i;
return 0;
}Select an option to see the answer and solution.
Q184
Open question#include <iostream>
using namespace std;
class sample
{
public:
sample()
{
cout << "X::X()" << endl;
}
sample( sample const & )
{
cout << "X::X( X const & )" << endl;
}
sample& operator=( sample const & )
{
cout << "X::operator=(X const &)" << endl;
}
};
sample f()
{
sample tmp;
return tmp;
}
int main()
{
sample x = f();
return 0;
}Select an option to see the answer and solution.
Q185
Open questionSelect an option to see the answer and solution.
Q186
Open questionSelect an option to see the answer and solution.
Q187
Open question#include <iostream>
using namespace std;
int main ()
{
int a, b, c;
a = 2;
b = 7;
c = (a > b) ? a : b;
cout << c;
return 0;
}Select an option to see the answer and solution.
Q188
Open question#include <iostream>
using namespace std;
class Distance
{
private:
int feet;
int inches;
public:
Distance()
{
feet = 0;
inches = 0;
}
Distance(int f, int i)
{
feet = f;
inches = i;
}
Distance operator()(int a, int b, int c)
{
Distance D;
D.feet = a + c + 10;
D.inches = b + c + 100 ;
return D;
}
void displayDistance()
{
cout << feet << inches << endl;
}
};
int main()
{
Distance D1(11, 10), D2;
cout << "First Distance : ";
D1.displayDistance();
D2 = D1(10, 10, 10);
cout << "Second Distance :";
D2.displayDistance();
return 0;
}Select an option to see the answer and solution.
Q189
Open question#include <iostream>
#include <string>
using namespace std;
class A
{
int a = 5;
public:
void change(int i){
a = i;
}
static void value_of_a(){
cout<<a;
}
};
int main(int argc, char const *argv[])
{
A a1 = A();
a1.change(10);
a1.value_of_a();
return 0;
}Select an option to see the answer and solution.
Q190
Open questionSelect an option to see the answer and solution.
Q191
Open questionSelect an option to see the answer and solution.
Q192
Open questionSelect an option to see the answer and solution.
Q193
Open question#include <iostream>
using namespace std;
class sample
{
private:
int var;
public:
void input()
{
cout << var;
}
void output()
{
cout << "Variable entered is ";
cout << var << "\n";
}
};
int main()
{
sample object;
object.input();
object.output();
object.var();
return 0;
}Select an option to see the answer and solution.
Q194
Open questionSelect an option to see the answer and solution.
Q195
Open question#include <iostream>
#include <string>
using namespace std;
class Box
{
int capacity;
public:
Box(int cap){
capacity = cap;
}
friend void show();
};
void show()
{
Box b(10);
cout<<"Value of capacity is: "<<b.capacity<<endl;
}
int main(int argc, char const *argv[])
{
show();
return 0;
}Select an option to see the answer and solution.
Q196
Open questionSelect an option to see the answer and solution.
Q197
Open question#include <iostream>
#include <string>
using namespace std;
class A
{
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.
Q198
Open question#include <iostream>
#include <string>
using namespace std;
int main ()
{
string str ("Microsoft");
for (size_t i = 0; i < str.length();)
{
cout << str.at(i-1);
}
return 0;
}Select an option to see the answer and solution.
Q199
Open question#include <stdio.h>
#include<iostream>
using namespace std;
int main()
{
int a = 21;
int c ;
c = a++;
cout << c;
return 0;
}Select an option to see the answer and solution.
Q200
Open questionSelect an option to see the answer and solution.