21. Subsequent elements are moved in terms of . . . . . . . . when an element in inserted in vector?
22. Sets are implemented using . . . . . . . .
23. What will be the output of the following C++ code?
#include <iostream>
#include <string>
using namespace std;
int main()
{
cout<<is_array<int>::value;
cout<<is_array<char[10]>::value;
cout<<is_array<string>::value;
return 0;
}
#include <iostream>
#include <string>
using namespace std;
int main()
{
cout<<is_array<int>::value;
cout<<is_array<char[10]>::value;
cout<<is_array<string>::value;
return 0;
}24. Which of the following operations can be performed on a pair?
25. What will be the output of the following C++ code?
#include <iostream>
#include <exception>
using namespace std;
void myunexpected ()
{
cout << "unexpected handler called\n";
throw;
}
void myfunction () throw (int,bad_exception)
{
throw 'x';
}
int main (void)
{
set_unexpected (myunexpected);
try
{
myfunction();
}
catch (int)
{
cout << "caught int\n";
}
catch (bad_exception be)
{
cout << "caught bad_exception\n";
}
catch (...)
{
cout << "caught other exception \n";
}
return 0;
}
#include <iostream>
#include <exception>
using namespace std;
void myunexpected ()
{
cout << "unexpected handler called\n";
throw;
}
void myfunction () throw (int,bad_exception)
{
throw 'x';
}
int main (void)
{
set_unexpected (myunexpected);
try
{
myfunction();
}
catch (int)
{
cout << "caught int\n";
}
catch (bad_exception be)
{
cout << "caught bad_exception\n";
}
catch (...)
{
cout << "caught other exception \n";
}
return 0;
}26. What will be the output of the following C++ code?
#include <iostream>
using namespace std;
template<typename type>
class TestVirt
{
public:
virtual type TestFunct(type Var1)
{
return Var1 * 2;
}
};
int main()
{
TestVirt<int> Var1;
cout << Var1.TestFunct(100) << endl;
return 0;
}
#include <iostream>
using namespace std;
template<typename type>
class TestVirt
{
public:
virtual type TestFunct(type Var1)
{
return Var1 * 2;
}
};
int main()
{
TestVirt<int> Var1;
cout << Var1.TestFunct(100) << endl;
return 0;
}27. Which of the following is correct about swap()?
28. Which function is used to check whether a character is tab or space or whitespace control code(\n,\r,etc.)?
29. What will be the output of the following C++ code?
#include <iostream>
using namespace std;
class stu
{
protected:
int rno;
public:
void get_no(int a)
{
rno = a;
}
void put_no(void)
{
}
};
class test:public stu
{
protected:
float part1,part2;
public:
void get_mark(float x, float y)
{
part1 = x;
part2 = y;
}
void put_marks()
{
}
};
class sports
{
protected:
float score;
public:
void getscore(float s)
{
score = s;
}
void putscore(void)
{
}
};
class result: public test, public sports
{
float total;
public:
void display(void);
};
void result::display(void)
{
total = part1 + part2 + score;
put_no();
put_marks();
putscore();
cout << "Total Score=" << total << "\n";
}
int main()
{
result stu;
stu.get_no(123);
stu.get_mark(27.5, 33.0);
stu.getscore(6.0);
stu.display();
return 0;
}
#include <iostream>
using namespace std;
class stu
{
protected:
int rno;
public:
void get_no(int a)
{
rno = a;
}
void put_no(void)
{
}
};
class test:public stu
{
protected:
float part1,part2;
public:
void get_mark(float x, float y)
{
part1 = x;
part2 = y;
}
void put_marks()
{
}
};
class sports
{
protected:
float score;
public:
void getscore(float s)
{
score = s;
}
void putscore(void)
{
}
};
class result: public test, public sports
{
float total;
public:
void display(void);
};
void result::display(void)
{
total = part1 + part2 + score;
put_no();
put_marks();
putscore();
cout << "Total Score=" << total << "\n";
}
int main()
{
result stu;
stu.get_no(123);
stu.get_mark(27.5, 33.0);
stu.getscore(6.0);
stu.display();
return 0;
}30. Which type of list a Forward_list sequence container implements?
Read More Section(C plus plus miscellaneous)
Each Section contains maximum 100 MCQs question on C plus plus miscellaneous. To get more questions visit other sections.
- C plus plus miscellaneous - Section 1
- C plus plus miscellaneous - Section 2
- C plus plus miscellaneous - Section 3
- C plus plus miscellaneous - Section 5
- C plus plus miscellaneous - Section 6
- C plus plus miscellaneous - Section 7
- C plus plus miscellaneous - Section 8
- C plus plus miscellaneous - Section 9
- C plus plus miscellaneous - Section 10
- C plus plus miscellaneous - Section 11
