Sail E0 Webinar
Question


What is the output of this program?


1.
#include
2.
using namespace std;
3.
void func(int a, bool flag = true)
4.
{
5.
if (flag == true ) {
6.
cout
Options:
A .  Flag is true. a = 200
B .  Flag is false. a = 100
C .  Flag is false. a = 200
D .  Flag is true. a = 100
Answer: Option C

In this program, we are passing the value, as it evaluates to false, it produces the output as following.
Output:
$ g++ def.cpp
$ a.out
Flag is false. a = 200



Was this answer helpful ?

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers