Wirecard Frequently Asked C++ Interview Questions Answers

What Are The Defining Traits Of An Object-oriented Language?

The defining traits of an object-oriented langauge are

encapsulation,
inheritance,
polymorphism.

What Methods Can Be Overridden In Java?

In C++ terminology, all public methods in Java are virtual. Therefore, all Java methods can be overwritten in subclasses except those that are declared final, static, and private.

In C++, What Is The Difference Between Method Overloading And Method Overriding?

Overloading a method (or function) in C++ is the ability for functions of the same name to be defined as long as these methods have different signatures (different set of parameters). Method overriding is the ability of the inherited class rewriting the virtual method of the base class.

What Is The Difference Between Mutex And Binary Semaphore?

semaphore is used to synchronize processes, where as mutex is used to provide synchronization between threads running in the same process.

Are There Any New Intrinsic (built-in) Data Types?

Yes. The ANSI committee added the bool intrinsic type and its true and false value keywords.

What Problem Does The Namespace Feature Solve?

Multiple providers of libraries might use common global identifiers causing a name collision when an application tries to link with two or more such libraries. The namespace feature surrounds a library's external declarations with a unique namespace that eliminates the potential for those collisions.

This solution assumes that two library vendors don't use the same namespace identifier, of course.

Describe Run-time Type Identification?

The ability to determine at run time the type of an object by using the typeid operator or the dynamiccast operator.

What Is The Standard Template Library (stl)?

A library of container templates approved by the ANSI committee for inclusion in the standard C++ specification.

A programmer who then launches into a discussion of the generic programming model, iterators, allocators, algorithms, and such, has a higher than average understanding of the new technology that STL brings to C++ programming.

What Is An Explicit Constructor?

A conversion constructor declared with the explicit keyword. The compiler does not use an explicit constructor to implement an implied conversion of types. It's purpose is reserved explicitly for construction.

What Is A Mutable Member?

One that can be modified by the class even when the object of the class or the member function doing the modification is const.
Wirecard Frequently Asked C++ Interview Questions Answers
Wirecard Frequently Asked C++ Interview Questions Answers

When Is A Template A Better Solution Than A Base Class?

When you are designing a generic class to contain or otherwise manage objects of other types, when the format and behavior of those other types are unimportant to their containment or management, and particularly when those other types are unknown (thus, the genericity) to the designer of the container or manager class.

Explain The Isa And Hasa Class Relationships. How Would You Implement Each In A Class Design?

A specialized class "is" a specialization of another class and, therefore, has the ISA relationship with the other class. An Employee ISA Person. This relationship is best implemented with inheritance. Employee is derived from Person. A class may have an instance of another class. For example, an employee "has" a salary, therefore the Employee class has the HASA relationship with the Salary class. This relationship is best implemented by embedding an object of the Salary class in the Employee class.

When Should You Use Multiple Inheritance?

There are three acceptable s: "Never," "Rarely," and "When the problem domain cannot be accurately modeled any other way."

What Is The Difference Between A Copy Constructor And An Overloaded Assignment Operator?

A copy constructor constructs a new object by using the content of the argument object. An overloaded assignment operator assigns the contents of an existing object to another existing object of the same class.

What Is A Conversion Constructor C++?

A constructor that accepts one argument of a different type.

What Is A Default Constructor In C++?

Default constructor WITH arguments
class B {
public
B(int m=0):n(m){}
int n;
};
int main(int argc, char *argv[])
{ Bb;
return 0;
}

How Does Throwing And Catching Exceptions Differ From Using Setjmp And Longjmp?

The throw operation calls the destructors for automatic objects instantiated since entry to the try block.

How Many Ways Are There To Initialize An Int With A Constant?

There are two ways for initializers in C++ as shown in the example that follows. The first format uses the traditional C notation. The second format uses constructor notation.
int foo = 123;
int bar (123);

What Are The Differences Between A C++ Struct And C++ Class?

The default member and base-class access specifiers are different.

Explain The Scope Resolution Operator?

It permits a program to reference an identifier in the global scope that has been hidden by another identifier with the same name in the local scope.

How Do You Link A C++ Program To C Functions?

By using the extern "C" linkage specification around the C function declarations.

How Do I Initialize A Pointer To A Function?

This is the way to initialize a pointer to a function

void fun(int a)
{
void main()
{
void (*fp)(int);
fp=fun;
fp(i);
}
}

What Does Extern Mean In A Function Declaration In C++?

It tells the compiler that a variable or a function exists, even if the compiler hasn't yet seen it in the file currently being compiled. This variable or function may be defined in another file or further down in the current file.

How Do I Declare An Array Of N Pointers To Functions Returning Pointers To Functions Returning Pointers To Characters?

If you want the code to be even slightly readable, you will use typedefs.

typedef char* (*functiontype_one)(void);
typedef functiontypeone (*functiontype_two)(void);
functiontype_two myarray[N]; //assuming N is a const integral

What Is The Auto Keyword Good For In C++?

Local variables occur within a scope; they are "local" to a function. They are often called automatic variables because they automatically come into being when the scope is entered and automatically go away when the scope closes. The keyword auto makes this explicit, but local variables default to auto auto auto auto so it is never necessary to declare something as an auto auto auto auto.

What Is The Difference Between Char A[] = "string"; And Char *p = "string";?

In the first case 6 bytes are allocated to the variable a which is fixed, where as in the second case if *p is assigned to some other value the allocate memory can change.

What Can I Safely Assume About The Initial Values Of Variables Which Are Not Explicitly Initialized?

It depends on complier which may assign any garbage value to a variable if it is not initialized.

What Does Extern Mean In A Function Declaration?

Using extern in a function declaration we can make a function such that it can used outside the file in which it is defined.

An extern variable, function definition, or declaration also makes the described variable or function usable by the succeeding part of the current source file. This declaration does not replace the definition. The declaration is used to describe the variable that is externally defined.

If a declaration for an identifier already exists at file scope, any extern declaration of the same identifier found within a block refers to that same object. If no other declaration for the identifier exists at file scope, the identifier has external linkage.

What Is The Best Way To Declare And Define Global Variables?

The best way to declare global variables is to declare them after including all the files so that it can be used in all the functions.

Post a Comment

Previous Post Next Post