Sail E0 Webinar
Question


What will be the output of these two programs?



1.


1.
1.
#ifndef Exercise_H
2.
#define Exercise_H
3.
int num = 842;
4.
#endif


2.


1.
#include
2.
#include "exe.h"
3.
using namespace std;
4.
int main(int argc, char * argv[] )
5.
{
6.
cout
Options:
A .  842
B .  843
C .  compile time error
D .  none of the mentioned
Answer: Option A

In this program, we have created a header file and linked that into the source program and we 

are post incrementing that because of that it is printed as 842.
Output:
$ g++ link.cpp
$ a.out
842



Was this answer helpful ?
Next Question

Submit Solution

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

Latest Videos

Latest Test Papers