1
Q:

What is the output of this program?

#include
        using namespace std;
        struct sec {
            int a;
            char b;
        };
        int main()
        {
            struct sec s ={25,50};
            struct sec *ps =(struct sec *)&s;
            cout << ps->a << ps->b;
            return 0;
        }

A) 252 B) 253
C) 254 D) 262

Answer:   A) 252



Explanation:

In this program, We are dividing the values of a and b, printing it.

Subject: C++
Q:

What is a template?

A) A template is a formula for creating a generic class B) A template is used to manipulate the class
C) A template is used for creating the attributes D) none of the mentioned
 
Answer & Explanation Answer: A) A template is a formula for creating a generic class

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: C++

1 3422
Q:

How many kinds of classes are there in c++?

A) 1 B) 2
C) 3 D) 4
 
Answer & Explanation Answer: B) 2

Explanation:

There are two kinds of classes in c++. They are absolute class and concrete class.

Report Error

View Answer Report Error Discuss

Filed Under: C++

7 10723
Q:

How many types of constructor are there in C++?

A) 1 B) 2
C) 3 D) 4
 
Answer & Explanation Answer: C) 3

Explanation:

There are three types of constructor in C++. They are Default constructor, Parameterized constructor, Copy constructor.

Report Error

View Answer Report Error Discuss

Filed Under: C++

1 3992
Q:

What does inheriatance allows you to do?

A) create a class B) access methods
C) create a hierarchy of classes D) None of the mentioned
 
Answer & Explanation Answer: C) create a hierarchy of classes

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: C++

1 3602
Q:

How many ways of reusing are there in class hierarchy?

A) 1 B) 2
C) 3 D) 4
 
Answer & Explanation Answer: B) 2

Explanation:

Class hierarchies promote reuse in two ways. They are code sharing and interface sharing.

Report Error

View Answer Report Error Discuss

Filed Under: C++

0 6528
Q:

What is meant by pure virtual function?

A) Function which does not have definition of its own. B) Function which does have definition of its own.
C) Function which does not have any return type. D) None of the mentioned
 
Answer & Explanation Answer: A) Function which does not have definition of its own.

Explanation:

As the name itself implies, it have to depend on other class only.

Report Error

View Answer Report Error Discuss

Filed Under: C++

2 5229
Q:

Which is also called as abstract class?

A) virtual function B) pure virtual function
C) derived class D) None of these
 
Answer & Explanation Answer: B) pure virtual function

Explanation:

Classes that contain at least one pure virtual function are called as abstract base classes.

Report Error

View Answer Report Error Discuss

Filed Under: C++

8 10928
Q:

Which of the following can derived class inherit?

A) members B) functions
C) both a & b D) None of the above
 
Answer & Explanation Answer: C) both a & b

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: C++

2 6940