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: "<
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: "<
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: "<