Get Off-Campus Placement Jobs Info !!!
Programs asked in Mettl Coding Round
Click To Practce List of Programs asked in Nagarro !!!

Technical Interview Questions and Answers :: C++

    11 / 183

    What are the difference between an object and a class?
    Answer:

    Classes are user defined data types and behave like the built-in type of a programming language. The wrapping up of data and functions into a single unit called class.
    Objects are the basic run-time entities in an object-oriented system. When a program is executed, the objects interact by sending messages to one another.

    Please Login First :

    12 / 183

    What do you mean by binding of data and functions?
    Answer:

    Binding refers to the process used for converting variables and functions into machine language addresses. Basically this means linking the adresses of the two either during compile time or runtime(Static and Dynamic Binding).

    Please Login First :

    13 / 183

    Can we implement all the concepts of OOPS using the keyword struct?
    Answer:

    Yes, struct is similar to class, only all attributes/methods are public by default in the struct. You can very well have methods and attributes in a struct. You can also inherit from a struct (default inheritance is public).

    Please Login First :

    14 / 183

    What is the difference between class and structure?
    Answer:

    1. Members of a class are private by default and members of struct are public by default.


    2. 'struct' is the keyword for Structure and 'class' is the keyword for Class.


    3. Structure is used for smaller amount of data and Class is used for larger amount of data.


    4. Structure is usually as for grouping of data and Class is for inheritence and further abstraction.


     

    Please Login First :

    15 / 183

    Can we create an empty class? If so what would be the sizeof such object.
    Answer:

    Yes, Size of an empty class is not zero. It is 1 byte generally. It is nonzero to ensure that the two different objects will have different addresses.

    Please Login First :

    16 / 183

    What are the role of protected access specifier?
    Answer:

    Protected access specifier makes the method accessible only by the derived class.

    Please Login First :

    17 / 183

    What are the role of mutable storage class specifier?
    Answer:

    Mutable storage class is applicable to only class data members. If a data member of a class is declared as mutable, then it can be modified by an object which is declared as constant.

    Please Login First :

    18 / 183

    What are the difference between an ARRAY and a LIST?
    Answer:

    An array is a contiguous chunk of memory with a fixed size whereas a list is typically implemented as individual elements linked to each other via pointers and does not have a fixed size. Once an array is initialized, it cannot be resized, and it uses a fixed amount of memory regardless of how much stuff you put in it. Since a list is a collection of individual chunks of memory that are dynamically allocated, the space required to store a list is directly related to the number of elements in it.

    Please Login First :

    19 / 183

    What is polymorphism and Pure-Polymorphism?
    Answer:

    When a method is declared as abstract/virtual method in a base class and which is overridden in a base class. If we create a variable of a type of a base class and assign an object of a derived class to it, it will be decided at a run time, which implementation of a method is to be called.
    This is known as Pure-Polymorphism or Late-Binding.

    Please Login First :
    Answer:

    This pointer is called current object of the class.

    Please Login First :



You can check latest and updated C++ Exam Questions C++ Exam Questions and Answers on this page. You can filter the question set by the company's name. Looking for the right answer? Don't worry! You can click on view answer section and check the answer with the explanation. You can discuss the answer in the forum with other users easily. Login with Facebook and save the answer To Reading List right now!

Our site contains top IT companies placement paper and mock test to help the freshers and experienced candidate to get hands on experience on the pattern and type of questions. We have curated all the C++ technical interview questions and answers from previous candidates.