LogoLearning For Everyone
Take Quiz
Contact Us
Related Topics
Related Topics
Selected Topic: All
12. Which concept of OOP is false for C++?
Choose the correct option:
  • a) Code can be written without using classes

  • b) Code must contain at least one class

  • c) A class must have member functions

  • d) At least one object should be declared in code

In C++, it’s not necessary to use classes, and hence codes can be written without using OOP concept. Classes may or may not contain member functions, so it’s not a necessary condition in C++. And, an object can only be declared in a code if its class is defined/included via header file.

7. Which class can have member functions without their implementation?
Choose the correct option:
  • a) Default class

  • b) String class

  • c) Template class

  • d) Abstract class

Abstract classes can have member functions with no implementation, where the inheriting subclasses must implement those functions.

11. Which among the following is false, for a member function of a class?
Choose the correct option:
  • a) All member functions must be defined

  • b) Member functions can be defined inside or outside the class body

  • c) Member functions need not be declared inside the class definition

  • d) Member functions can be made friend to another class using the friend keyword

Member functions must be declared inside class body, though the definition can be given outside the class body. There is no way to declare the member functions outside the class.

1. Which definition best describes an object?
Choose the correct option:
  • a) Instance of a class

  • b) Instance of itself

  • c) Child of a class

  • d) Overview of a class

An object is instance of its class. It can be declared in the same way that a variable is declared, only thing is you have to use class name as the data type.

10. Which among the following is wrong?
Choose the correct option:
  • a) class student{ }; student s;

  • b) abstract class student{ }; student s;

  • c) abstract class student{ }s[50000000];

  • d) abstract class student{ }; class toppers: public student{ }; topper t;

We can never create instance of an abstract class. Abstract classes doesn’t have constructors and hence when an instance is created there is no facility to initialize its members. Option d is correct because topper class is inheriting the base abstract class student, and hence topper class object can be created easily.

Items per page: