Sail E0 Webinar
Question


What is the output of this program?


1.
#include
2.
using namespace std;
3.
class number
4.
{
5.
int i;
6.
public:
7.
int geti();
8.
void puti(int j);
9.
};
10.
int number::geti()
11.
{
12.
return i;
13.
}
14.
void number::puti(int j)
15.
{
16.
i = j;
17.
}
18.
int main()
19.
{
20.
number s;
21.
s.puti(10);
22.
cout
Options:
A .  10
B .  11
C .  20
D .  22
Answer: Option A

We are getting the number and copying it to j and printing it.
Output:
$ g++ obj2.cpp
$ a.out
10



Was this answer helpful ?
Next Question

Submit Solution

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

Latest Videos

Latest Test Papers