C++ interview questions part 31

C++ interview questions part 31

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

Total Questions: 20

1. What is the syntax of defining lambda expression?

Correct Answer is : error

2. What is the correct statement about lambda expression?

Correct Answer is : Friend functions can be invoked as a normal function

3. In how many ways we can capture the external variables in the lambda expression?

Correct Answer is : All of the mentioned

4. Which of the following operator is used to capture all the external variable by reference?

Correct Answer is : friend

5. Which of the following operator is used to capture all the external variable by value?

Correct Answer is : private and protected members of a class cannot be accessed from outside

6. Which is the correct syntax of capturing a variable ‘X’ by reference and other variable ‘Y’ by value in lambda expression?

Correct Answer is : friend

7. What is the output of the following C++ code? #include using namespace std; int main() { int x = 5; auto check = []() -> bool { if(x == 0) return false; else return true; }; cout<
Correct Answer is : friend class1 Class2;


8. What is the output of the following C++ code? #include using namespace std; int main() { int a = 5; auto check = [](int x) { if(x == 0) return false; else return true; }; cout<
Correct Answer is : 20


9. What is the output of the following C++ code? #include using namespace std; int main() { int a = 5; auto check = [=]() { a = 10; }; check(); cout<<"Value of a: "<
Correct Answer is : 24


10. What is the output of the following C++ code? #include using namespace std; int main() { int a = 5; auto check = [&]() { a = 10; }; check(); cout<<"Value of a: "<
Correct Answer is : 36


11. What is the output of the following C++ code? #include using namespace std; int main() { int a = 5; int b = 5; auto check = [&a]() { a = 10; b = 10; } check(); cout<<"Value of a: "<
Correct Answer is : 200


12. How to store the large objects in c++ if it extends its allocated memory?

Correct Answer is : 295

13. When we are using heap operations what do we need to do to save the memory?

Correct Answer is : A friend function may or may not be a member of another class

14. Which container in c++ will take large objects?

Correct Answer is : function declaration

15. How to stop your program from eating so much ram?

Correct Answer is : overloading the objects

16. Which option is best to eliminate the memory problem?

Correct Answer is : virtual functions does not give the ability to write a templated function

17. What is the size of the heap?

Correct Answer is : virtual functions does not give the ability to write a templated function

18. How to unlimit the size of the stack?

Correct Answer is : It will modify the operator to be interpreted

19. In Linux, how do the heaps and stacks are managed?

Correct Answer is : It will modify the operator to be interpreted

20. Which is used to pass the large objects in c++?

Correct Answer is : First Distance : 1110

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon