Question
1.
#include
2.
using namespace std;
3.
int g = 100;
4.
int main()
5.
{
6.
int a;
7.
{
8.
int b;
9.
b = 20;
10.
a = 35;
11.
g = 65;
12.
cout
What is the output of this program?
1.
#include
2.
using namespace std;
3.
int g = 100;
4.
int main()
5.
{
6.
int a;
7.
{
8.
int b;
9.
b = 20;
10.
a = 35;
11.
g = 65;
12.
cout
Answer: Option A
Was this answer helpful ?
The local values of a and g within the block are more dominant than the global values.
Output:
$ g++ dec1.cpp
$ a.out
2035655065
Was this answer helpful ?
Submit Solution