| Snaprecruit.com

| Snaprecruit.com

Interview question based on skill :

Take as many assements as you can to improve your validate your skill rating

Total Questions: 20

1. What is the output of the folowing C++ code? #include #include   using namespace std;   int main() { vector v; for (int i = 1; i <= 5; i++) v.push_back(i); cout<
Correct Answer is : It will not have a destructor

2. What will be the capacity of the vector after 10 is pushed into the vector in the following C++ code? #include #include   using namespace std;   int main() { vector v; for (int i = 1; i <= 5; i++) v.push_back(i); cout<
Correct Answer is : I only

3. What will be the capacity of vector at the end in the following C++ code? #include #include   using namespace std;   int main() { vector v; for (int i = 1; i <= 5; i++) v.push_back(i); v.reserve(50); cout<
Correct Answer is : Private

4. What is the output of the following C++ code? #include #include   using namespace std;   int main() { vector v; for (int i = 1; i <= 5; i++) v.push_back(i); int *pos = v.data(); cout<<*(pos + 3); return 0; }

Correct Answer is : All of the mentioned

5. What is the output of the following C++ code? #include #include   using namespace std;   int main() { vector v; for (int i = 1; i <= 5; i++) v.push_back(i); cout<
Correct Answer is : Structures can have member functions

6. What is the output of the following C++ code? #include #include   using namespace std;   int main() { vector v; for (int i = 1; i <= 5; i++) v.push_back(i); for(int i=0;i
Correct Answer is : By declaring a pure virtual function in a class

7. Which function is used to swap two vectors?

Correct Answer is : An object is an instance of its class

8. What is the output of the following C++ code? #include #include   using namespace std;   int main() { vector v1; vector v2; for (int i = 1; i <= 5; i++) v1.push_back(i); for (int i = 6; i <= 10; i++) v2.push_back(i); v1.swap(v2); for(int i=0;i
Correct Answer is : Pointer object initialization of a class using new involves constructor call whereas using malloc does not involve constructor call

9. What is the output of the following C++ code? #include #include   using namespace std;   int main() { vector v1; vector v2; for (int i = 1; i <= 5; i++) v1.push_back(i); for (int i = 6; i <= 10; i++) v2.push_back(i); v1.swap(v2); for(int i=0;i
Correct Answer is : C++ technique to avoid multiple copies of the base class into children/derived class

10. What do container adapter provide to interface?

Correct Answer is : delete is used to delete single object whereas delete[] is used to multiple(array/pointer of) objects

11. What does the sequence adaptor provide?

Correct Answer is : Segmentation fault

12. Which are presented in the container adaptors?

Correct Answer is : “Constructor called” five times and then “Destructor called” five times

13. In which context does the stack operates?

Correct Answer is : The program is compiled and executed successfully

14. Which operator is used in priority queue?

Correct Answer is : Undefined behaviour

15. How many items are there in sequence container?

Correct Answer is : operator overloading

16. Which of the following class template are based on arrays?

Correct Answer is : ::

17. Which of the following will return the new element at the end of container?

Correct Answer is : operator sign

18. How the list containers are implemented?

Correct Answer is : adding operation to the existing operators

19. Which of the following does not support any insertion or deletion?

Correct Answer is : error

20. What kind of iteration does forward_list provide in C++?

Correct Answer is : No output