Technical Interview Questions and Answers :: Capgemini

Topics List

  •  C
  •  C++
  •  DBMS
  •  Soft. Engineering
  •  Finite Automata
  •  SQL
  •  Java
  •  .NET
  •  WebMethod
  •  EDI
  •  Informatica
  •  Oracle Apps HRMS
  •  Operating System
  •  Data Structure
  •  PHP
  •  Unica
  •  Oracle Apex
  •  Networking
  •  Hadoop
  • 1. 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 :
    Tags:

    Wipro TCS Capgemini iGate Virtusa Syntel Inc. Accenture 

  • 2. 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 :
    Tags:

    Capgemini Virtusa Syntel Inc. 

  • 3. 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 :
    Tags:

    TCS Capgemini Virtusa Syntel Inc. 

  • 4. What is Copy Constructor? Write a program using it.
  • Answer:

    Copy constructor is used to declare and initialize an object from another object.
    For example, the statement
    Integer I2(I1);
    Would define the object I2 and at the same time initialize it to the values of I1. another form of this statement is integer I2=I1;
    The process of initializing through a copy constructor is known as copy initialization. A copy constructor takes a reference to an object of the same class as itself as an argument.

    Please Login First :
    Tags:

    Capgemini Syntel Inc. 

  • 5. Explain about Friend function and friend class.
  • Answer:

    Friend Function:
    A friend function can access a class private data, even though it is not a member function of the class. This is useful when one function must have access to two or more unrelated classes and when an overloaded operator must use, on its left side, a value of a class other than one of which it is a member. Friends are also used to facilitate functional notation.

    Friend Class:
    It is possible to grant a non-member function access to the private members of a class by using a friend. A friend function has access to all private and protected members of the class for which it is a friend.

    Please Login First :
    Tags:

    TCS Capgemini 

  • 6. Difference in instance and database.
  • Answer:

    No Discussion on this question yet!

    Please Login First :
    Tags:

    IBM Capgemini Accenture 

  • 7. What is the difference between declaring a variable and defining a variable?
  • Answer:

    Declaring a variable is initializing a variable where as defining a variable is defining what variables you are initialized.



     

    Please Login First :
    Tags:

    TCS Capgemini 

  • 8. What is a static variable?
  • Answer:

    No Discussion on this question yet!

    Please Login First :
    Tags:

    TCS Capgemini 

  • 9. What is a register variable?
  • Answer:

    No Discussion on this question yet!

    Please Login First :
    Tags:

    TCS Capgemini 

  • 10. Where is an auto variable stored?
  • Answer:

    No Discussion on this question yet!

    Please Login First :
    Tags:

    TCS Capgemini