| 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 will be output of this program? #include using namespace std; int main() { int i = 3; int l = i / -2; int k = i % -2; cout << l << k; return 0; }

Correct Answer is : User interface

2. What will be output of this function? int main() { register int i = 1; int *ptr = &i; cout << *ptr; return 0; }

Correct Answer is : cout << “Hai” <<

3. What are Iterators?

Correct Answer is : int a = 5;

4. Which function is used increment the iterator by a particular value?

Correct Answer is : int main()

5. What is the output of the following C++ code? #include #include #include using namespace std; int main() { vector ar = { 1, 2, 3, 4, 5 }; vector::iterator ptr = ar.begin(); advance(ptr, 2); cout << *ptr << endl; return 0; }

Correct Answer is : setw

6. What is the output of the following C++ code? #include #include #include using namespace std; int main() { vector ar = { 1, 2, 3, 4, 5 }; vector::iterator ptr = ar.begin(); ptr = advance(ptr, 2); cout << *ptr << endl; return 0; }

Correct Answer is : 41275

7. What is the output of the following C++ code? #include #include #include using namespace std; int main() { vector ar = { 1, 2, 3, 4, 5 }; vector::iterator ptr = ar.begin(); ptr = next(ptr, 3); cout << *ptr << endl; return 0; }

Correct Answer is : 64100

8. How many types of Iterators are there?

Correct Answer is : Indicate the base used

9. Which of the following is correct about Input Iterators?

Correct Answer is : Freestore

10. What type of Iterator i1 is in the following C++ code snipet? ================ code ================ vector::iterator i1; for (i1=v1.begin();i1!=v1.end();++i1) *i1 = 1; ======================================

Correct Answer is : both new & delete

11. If i1 is Input Iterator and i2 is Output Iterator, then which of the following things are correct? i) cout<<*i1; ii) i2 can be used with == operator iii) *i1 = 1 iv) i2--

Correct Answer is : static

12. Which of the following is an advantage of Forward iterator over input and output iterator?

Correct Answer is : B::operator delete

13. What are Bi-directional iterators?

Correct Answer is : Warning

14. What are Random-access Iterators?

Correct Answer is : Both X::operator delete(void*) & Depends on the compiler

15. How many categories of iterators are there in c++?

Correct Answer is : Runtime error

16. Which of the following can serve as random-access iterator?

Correct Answer is : Segmentation fault

17. What kind of pattern is iterator pattern?

Correct Answer is : Pointer

18. In which type of semantics does c++ implements iterator?

Correct Answer is : error

19. By using which operator does point to next element is represent in iterator?

Correct Answer is : value of b is: 10

20. What is lambda expression in C++?

Correct Answer is : error