Objects

1

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 << s.geti( );
23.
            return 0;
24.
        }
A. 10
B. 11
C. 20
D. 22

2

Which special character is used to mark the end of class?

A. ;
B. :
C. #
D. $

3

What is the output of this program?

1.
        #include 

2.
        using namespace std;

3.
        class sample

4.
        {

5.
            private:

6.
            int var;

7.
            public:

8.
            void input()

9.
            {

10.
               cout << var;

11.
            }

12.
            void output()

13.
            {

14.
               cout << "Variable entered is ";

15.
               cout << var << "\n";

16.
            }

17.
        };

18.
        int main()

19.
        {

20.
            sample object;

21.
            object.input();

22.
            object.output();

23.
            object.var();

24.
            return 0;

25.
        }    
A. Enter an integer 5 Variable entered is 5
B. runtime error
C. error
D. none of the mentioned

4

How many objects can present in a single class?

A. 1
B. 2
C. 3
D. as many as possible

5
Pick out the other definition of objects.
A. member of the class
B. associate of the class
C. attribute of the class
D. instance of the class