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 :: iGate

37.2K

Tot. Mock Test: 11


Total Qs: 160+

  •  Select All
  •  Java
  •  C++
  •  Oracle PLSQL
  •  WebMethod
  •  Informatica
  •  Operating System
  •  Networking
  •  SQL
  •  HR Question in TR
  •  DBMS
  •  Soft. Engineering
  •  C
  •  Data Structure
  •  Hadoop
  •  .NET

    11 / 160

    What is virtual functions, and explain with an example?
    Answer:

    A virtual function allows derived classes to replace the implementation provided by the base class. The compiler makes sure the replacement is always called whenever the object in question is actually of the derived class, even if the object is accessed by a base pointer rather than a derived pointer. This allows algorithms in the base class to be replaced in the derived class, even if users don't know about the derived class.

    Please Login First :
    Answer:

    As the name suggests, the function acts as a friend to a class. As a friend of a class, it can access its private and protected members. A friend function is not a member of the class. But it must be listed in the class definition.

    Please Login First :

    13 / 160

    What is the difference between class and structure?
    Answer:

    Structure: Initially (in C) a structure was used to bundle different type of data types together to perform a particular functionality. But C++ extended the structure to contain functions also. The major difference is that all declarations inside a structure are by default public.

    Class: Class is a successor of Structure. By default all the members inside the class are private.

    Please Login First :

    14 / 160

    What is public, protected, and private?
    Answer:

    Ø Public, protected and private are three access specifier in C++.
    Ø Public data members and member functions are accessible outside the class.
    Ø Protected data members and member functions are only available to derived classes.
    Ø Private Data members and member functions can’t be accessed outside the class. However there is an exception can be using friend classes.

    Please Login First :

    15 / 160

    What is the scope resolution operator? Explain how does it work in c++?
    Answer:

    The :: operator links a class name with a member name in order to tell the complier what class the member belongs to. It has another use that is it can allow access to a name in an enclosing scope that is hidden by a local declaration of the same name.

    Egname.
    Eg:
    Void f()
    {
    int I;
    I=10;
    ………..
    ……..
    }
    It may do so by preceding the I with the :: as shown here
    Void f()
    {
    int I;
    :: I=10;
    ……..
    ……..
    }

    Please Login First :

    16 / 160

    What is the difference between declaration and definition?
    Answer:

    In C , function declaration is means telling the compiler that a function occurs but there's no definition given to it. When in the program, the function with definition is given, it's known as function definition.



    For eg.: void display();//function declaration



    void display){ cout<<"Function Definition";}//Function Definition

    Please Login First :

    17 / 160

    What are limitations of union?
    Answer:

    This means if one member variable of union is updated then the rest will be updated as well. This also leads compilation error when initializing multiple members at a time as the memory locations are not different. So in case of union only one member should be initialized at a time.

    Please Login First :
    Answer:

    Preprocessor directives are lines included in the code of programs preceded by a hash sign (#). These lines are not program statements but directives for the preprocessor. The preprocessor examines the code before actual compilation of code begins and resolves all these directives before any code is actually generated by regular statements.

    Please Login First :

    19 / 160

    How can we access private members of a classs?
    Answer:

    By using a friend function.
    A friend function has access to all private and protected members of the class for which it is a friend.

    Please Login First :

    20 / 160

    What are the differences between C and C++?
    Answer:

    1. C can run most of the code of C, but C can't run C code.



    2. C supports procedural programming paradigm whereas C supports both procedural and object oriented programming paradigm.



    3. C is a function driven and C is an object driven language.



    4. C doesn't allow function definitions within structures whereas in C function definition can be within structures.



    5. C doesn't support reference variables but C does support. 

    Please Login First :


Most Frequent Qs.