Take as many assements as you can to improve your validate your skill rating
Total Questions: 20
1. What is the output of the following C++ code?
#include
#include
using namespace std;
int main(int argc, char const *argv[])
{
array arr = {1,2,3,4,5};
cout<<"size:"<
Correct Answer is : class
2. What is the use of swap() function in array class?
Correct Answer is : direct member access operator
3. What is the syntax of swap()?
Correct Answer is : both private & protected
4. What is the output of the following C++ code?
#include
#include
using namespace std;
int main(int argc, char const *argv[])
{
array arr1 = {1,2,3,4,5};
array arr2 = {6,7,8,9,10};
arr1.swap(arr2);
for(int i=0;i<5;i++)
cout<
Correct Answer is : 213
5. What is the output of the following C++ code?
#include
#include
using namespace std;
int main(int argc, char const *argv[])
{
array arr1 = {1,2,3,4,5};
array arr2 = {6,7,8,9,10};
arr1.swap(arr2);
for(int i=0;i<5;i++)
cout<
Correct Answer is : recta area: 30 rectb area: 42
6. What is the use of empty() function in array classes?
Correct Answer is : instance of the class
7. What is the use of fill() function in array class?
Correct Answer is : as many as possible
8. What is the output of the following C++ code?
#include
#include
using namespace std;
int main(int argc, char const *argv[])
{
array arr1;
arr1.fill(2);
for(int i=0;i<5;i++)
cout<
Correct Answer is : Error
9. What is the output of the following C++ code?
#include
#include
using namespace std;
int main(int argc, char const *argv[])
{
int arr1[5] = {1,2,3,4,5};
int arr2[5] = {6,7,8,9,10};
arr1.swap(arr2);
for(int i=0;i<5;i++)
cout<
Correct Answer is : 10
10. What is the output of the following C++ code?
#include
#include
using namespace std;
int main(int argc, char const *argv[])
{
array arr1;
arr1.fill(5);
cout<(arr1);
return 0;
}
Correct Answer is : Encapsulation
11. What happens when both of these below program are compiled and executed?
===== Program 1 =====
#include
#include
using namespace std;
int main()
{
array arr1;
arr1.fill(5);
cout<(arr1);
return 0;
}
=====================
===== Program 2 =====
#include
#include
using namespace std;
int main()
{
array arr1;
arr1.fill(5);
cout<
Correct Answer is : Classes follows OOP concepts whereas structure does not
12. How many list sequence containers are provided by STL?
Correct Answer is : Concept of allowing overiding of functions
13. Which type of list a Forward_list sequence container implements?
Correct Answer is : Inheritance
14. Which of the following header file is required for forwawrd_list?
Correct Answer is : A,B->C
15. Which of the following(s) is/are the correct way of assigning values to a forward_list f?
Correct Answer is : They allows us to show only required things to outer world
16. How the list differs from vectors?
Correct Answer is : both procedural and object oriented programming language
17. What is the syntax of declaraing a forward_list?
Correct Answer is : Subdividing program into small independent parts
18. What is the output of the following C++ code?
#include
#include
#include
using namespace std;
int main()
{
forward_list fl1;
fl1.assign(5,10);
for (int&c : fl1)
cout << c << " ";
cout<
Correct Answer is : Singleton class
19. What is the output of the following C++ code?
#include
#include
#include
using namespace std;
int main()
{
forward_list fl1 = {1,2,3,4,5};
for (int&c : fl1)
cout << c << " ";
cout<::iterator ptr = fl1.begin();
fl1.erase_after(ptr);
for (int&c : fl1)
cout << c << " ";
cout<
Correct Answer is : Friend constructor
20. What is the output of the following C++ code?
#include
#include
#include
using namespace std;
int main()
{
forward_list fl1 = {1,2,3,4,5};
for (int&c : fl1)
cout << c << " ";
cout< 3;});
for (int&c : fl1)
cout << c << " ";
cout<
Correct Answer is : Derived class pointer object cannot point to a base class object