Sail E0 Webinar
Question


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
Options:
A .  2035655065
B .  2035655035
C .  2035635065
D .  none of the mentioned
Answer: Option A

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 ?
Next Question

Submit Solution

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

Latest Videos

Latest Test Papers