| 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 following C++ code? #include #include #include   using namespace std;   int main() { forward_list fl1 = {1,7,8,9,10}; forward_list fl2 = {2,3,4,5,6}; fl1.splice_after(fl1.begin(), fl2); for (int&c : fl1) cout << c << " "; cout<
Correct Answer is : Friend function

2. What are the vectors?

Correct Answer is : Member functions

3. Pick the incorrect statement.

Correct Answer is : Object

4. Which of the following header file is needed to use vectors in your program?

Correct Answer is : All of the mentioned

5. Which of the following(s) can be used to access the first element of a vector v?

Correct Answer is : Composition

6. Which of the following(s) can be used to access the last element of a vector v?

Correct Answer is : 2

7. What is the difference between begin() and cbegin() in vectors?

Correct Answer is : Using Inheritance and Virtual functions

8. What is the difference between begin() and rbegin()?

Correct Answer is : Using Templates

9. Which is the following is syntactically correct for vector v?

Correct Answer is : class

10. What is the outptu 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);   vector :: const_iterator i; for (i = v.begin(); i != v.end(); ++i) cout << *i << " "; cout<
Correct Answer is : Dynamic loading

11. 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);   vector :: iterator i; i = v.begin(); *i = 3; for (i = v.begin(); i != v.end(); ++i) cout << *i << " "; cout<
Correct Answer is : Ad-hoc polymorphism

12. 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);   vector :: const_iterator i; i = v.begin(); *i = 3; for (i = v.begin(); i != v.end(); ++i) cout << *i << " "; cout<
Correct Answer is : Bottom-up

13. Which of the following function is used to get the actual number of elements stored in vector?

Correct Answer is : <<

14. Which function is used to get the total capacity of a vector?

Correct Answer is : Constructors

15. How the size of a vector increases once it is full?

Correct Answer is : Virtual functions

16. 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 : C++ allows both static and dynamic type checking

17. Which function is used to check whether the vector is empty or not?

Correct Answer is : It reduced both testing and maintenance time

18. 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); v.resize(4); for (auto it = v.begin(); it != v.end(); it++) cout << *it << " "; return 0; }

Correct Answer is : All of the mentioned

19. 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 : Neither I nor II

20. 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 : Distributive