classes and data abstraction

mcqspedia.com has 5 Question/Answers about Topic classes and data abstraction

If a class wants to allow clients to read private data, class can provide a

If a class wants to allow clients to read private data, class can provide a
  • A. Get function
  • B. Set function
  • C. Allow function
  • D. Both A and B
  • Correct Answer: Option D

If no constructor is defined for a class, compiler

If no constructor is defined for a class, compiler
  • A. Creates a default constructor
  • B. Creates a function for constructor
  • C. Start working with pointers
  • D. None of them
  • Correct Answer: Option A

Passing arguments to a destructor, or specifying return type to destructor, causes

Passing arguments to a destructor, or specifying return type to destructor, causes
  • A. Logical error
  • B. Syntax error
  • C. Run time error
  • D. Fatal error
  • Correct Answer: Option B

Destructors do not receive parameters and do not

Destructors do not receive parameters and do not
  • A. Return values
  • B. Initialized
  • C. Compiled
  • D. None of them
  • Correct Answer: Option A

When an object goes out of scope, which function is called automatically?

When an object goes out of scope, which function is called automatically?
  • A. Constructor
  • B. Destructor
  • C. Inline
  • D. End of line
  • Correct Answer: Option B