CPP

CPP

Classes has 9 Questions
What does your class can hold?

data
functions
both a & b
none of the mentioned
How many specifiers are present in access specifiers in class?

1
2
3
4
Which is used to define the member of a class externally?

:
::
#
none of the mentioned
Which other keywords are also used to declare the class other than class?

struct
union
object
both a & b
What is the output of this program?
  1.     #include 
  2.     using namespace std;
  3.     class CDummy
  4.     {
  5.         public:
  6.         int isitme (CDummy& param);
  7.     };
  8.     int CDummy::isitme (CDummy& param)
  9.     {
  10.         if (&param == this)
  11.             return true;
  12.         else
  13.             return false;
  14.     }
  15.     int main ()
  16.     {
  17.         CDummy a;
  18.         CDummy *b = &a;
  19.         if (b->isitme(a)) {
  20.             cout << "execute";
  21.         }
  22.         else
  23.         {
  24.             cout<<"not execute";
  25.         }
  26.         return 0;
  27.     }

execute
not execute
none of the mentioned
both a & b
Which of the following is a valid class declaration?

class A { int x; };
class B { }
public class A { }
object A { int x; };
The fields in the class in c++ program are by default

protected
private
public
none of the mentioned
Constructors are used to

initalize the objects
construct the data members
both a & b
none of the mentioned
When struct is used instead of the keyword class means, what will happen in the program?

access is public by default
access is private by default
access is protected by default
none of the mentioned