Monday, August 12, 2019 admin Comments(0)

C++ Interview Questions & Answers. What is C++?. Released in , C++ is an object-oriented programming language created by. Bjarne Stroustrup. Cpp Interview Questions absolutely free of cost. Candidate who are weak in C Language they can download this C++ interview question pdf for free from here. A class in C++ can be defined as a collection of function and related data Top 24 C++ Interview Questions & Answers .. Download PDF.

Language:English, Spanish, Indonesian
Published (Last):28.08.2015
ePub File Size:15.59 MB
PDF File Size:16.52 MB
Distribution:Free* [*Register to download]
Uploaded by: SCOT

C++ Interview Questions. Compiled by Dr. Fatih Kocan, Wael Kdouh, and Kathryn Patterson for the Data Structures in C++ course(CSE ). Spring Contains Important C++ Interview Questions with Answers and C++ FAQs helpful C++ Interview Questions | C++ Interview Questions and Answers PDF | C++. Important C++ Interview Questions and Answers for Fresher's with PDF on " OOPS concept" including Advanced C++ Questions and Basic C++.

Explain abstraction. What is the real purpose of class to export data? No, the real purpose of a class is not to export data. Rather, it is to provide services. Class provides a way to abstract behaviour rather than just encapsulating the bits. What things would you remember while making a interface? It should behave the way user expects it to.

Define object based programming language? Define object oriented language? Define OOPs? What is public, protected, private? What is a scope resolution operator? What do you mean by inheritance? What is abstraction? What is encapsulation? What are the defining traits of an object-oriented language? What is polymorphism?

What do you mean by inline function? What do you mean by virtual methods? What do you mean by static methods? How many ways are there to initialize an int with a constant?

What is constructors? What is destructors? What is an explicit constructor? Candidates can prepare easily for interview by reading there question.

Read answ er Explain object oriented programming. Read answ er What are recursive functions? What are the advantages and disadvantages of Recursive algorithms? A recursive function is a function which calls itself Private data belongs to the same class in which it is created and can only be used Read answ er What is overriding? Defining a function in the derived class with same name as in the parent class is called overriding Read answ er How to detect an end of a file?

An internal iterator is implemented by the member functions of the class which has the iteration logic Read answ er What are friend classes? What are advantages of using friend classes? Pass by value: The callee function receives a set of values that are to be received by the parameters Read answ er Explain passing objects by reference A substitute for iteration where the iterative solution is very complex.

Abstraction is separating the logical properties from implementation details Read answ er What is the difference between an external iterator and an internal iterator?

200 C++ Interview Questions and Answers - C++ FAQ PDF

Describe an advantage of an external iterator Code isolation: All code that is to be handled when an exception raises is placed in the catch block Read answ er Define private Read answ er What is copy constructor?

A copy constructor is a special type of constructor that is used to create an object as a copy of an existing object.. It can access non public members of the class The process of hiding unnecessary data and exposing essential features is called abstraction A friend function is external to the class definition Private is the default access specifier for every declared data item in a class Read answ er How to control the number of chars read in a string by using scanf?

Doing this limits the length of the characters that will be read by scanf to 20 characters maximum although the buffer can hold 25 characters All these copies of values have local scope.. The advantages of recursive functions are: Explain its purpose A reference must be initialized at the time of declaration whereas not needed in case of pointer Read answ er Explain the advantages of inline functions Read answ er What is Stack?

Explain its uses In using-declaration.. It is very effective in Read answ er What is the importance of mutable keyword? The mutable keyword allows the data member of a class to change within a const member function.

An object creation of a class is failed before executing its constructor.. It is default one and can be access from class member of the same class Read answ er Pointer vs Read answ er What is the difference between Mutex and Binary semaphore?

Semaphore synchronizes processes where as mutex synchronizes threads running in the same process Read answ er What do you mean by stack unwinding? When an exception is thrown It is used for functions that need fast execution.

Read answ er What is a conversion constructor? It is a constructor that accepts one argument of a different type Read answ er What are the advantages of inheritance? Code reusability Saves time in program development It is a linear structure and one can insert and delete from one end only which is called the top.. Read answ er What is a Wrapper class? Wrapper classes are classes that allow primitive types to be accessed as objects Read answ er Explain the difference between Stack and Queue Latest answer: As a constructor would not return a value The protected members can be access from member functions of the..

Read answ er What is the scope resolution operator? Scope resolution operator allows a program to reference an identifier in the global scope that is hidden by another identifier with the same name in the local scope The objects are destroyed in the It relieves the burden involved in calling a function A pointer can point to a null object Constructors are the member functions of the class that executes automatically whenever an object The accessibility. Read answ er What do you mean by binding?

Static vs. Read answ er How do we declare a class as a friend of another class? Class vs Read answ er careerride. It serves as a template of the objects Read answ er Define an Iterator class Latest answer: A container class hold group of objects and iterator class is used to traverse through the objects maintained Read answ er List down elements of an object oriented language A constructor can be overloaded to pass different arguments to the object A container stores many entities and provide sequential or direct access to them..

Is it possible to overload a constructor? Yes it is possible You can create a class as abstract by declaring one or more virtual functions to pure Read answ er Vector vs Overloading means having methods with same name but different signature Overriding means rewriting the virtual method of the base class Binding means connecting the function call to a function implementation..

Read answ er What is abstract class? A class whose object can't be created is abstract class. Default inheritance type is private Map Latest answer: In a vector Read answ er Explain constructors and destructors. Read answ er Explain the difference between structures and classes Latest answer: Syntactically and functionally Read answ er Overriding vs.

Storage class defined for a variable determines the accessibility and longevity of the variable A class is a user defined data type Read answ er Explain how to call a base member function from derived class member function Structure Latest answer: Class has private as default access specifier. Why ATL Server? What is SRF Files?

Explain with an example. The base class with pure virtual function can't be instantiated since there is no definition.. What are GUID? What is a type library? What is the IUnknown interface? Explain Binary object model.. Explain the ATL Server architecture.. How does COM provide language transparency?.

What is the object serialization? Interview Questions Latest answer: What is the STL Read answ er What is object oriented programming OOP?

What are the various elements of OOP? Explain an object. What are the advantages of OOP? Write your comment. B BObject. Explain the concepts and capabilities of ATL Server. It's a variable that is known only in the function that contains its definition but is never destroyed and retains its value between calls to that function. This the default.

Define macro.. Variables are naturally created and initialized when they are defined and are destroyed at the end of the block contained their definition.

It's a static variable whose definition and placement is determined when all object and library modules are combined linked to form the executable code file.

What is a virtual function? It's a type of auto variable. If an array of objects are created using new. While we define function prototype in a base class without implementation. This can be done Intwo methods.

The base class is called abstract class Example of a pure virtual function or abstract class this way. Define STL. Verify the following code. Point out the problems. Describe the advantage of an external iterator.. List is a name of any class. Explain the differences between List x. The 3 types of STL containers are: Define a nested class.

If the function parameter is a "const reference".

Pdf questions cpp interview

How come you find out if a linked-list is a cycle or not? We can find out if the linked-list is cycle or not by the use of two pointers: There exists a big difference which is explained via a code below: If this occurs. For example: Explain how it can be useful. B int i. When do we use copy constructors? Copy constructors are called in these scenarios below: Then function f evokes a local List object x: Explain when it is get created?

This means that if a member of a structure or class can be altered though a particular structure variable. What is dangling pointer? When do we run a shell in the UNIX system? How will you tell which shell you are running?

What are the storage qualifiers? The storage qualifiers are: The examples of such situations can be given as: Define a pdb file. Provide an example where they are useful.

Do we have to use initialization list in spite of the assignment in constructors? Define Stacks. If the value in the memory location will be altered though nothing is changed in the program code. How we can differentiate between a pre and post increment operators during overloading?

If the memory gets initialized once.

Important C++ Interview Questions and Answers for Freshers with pdf

Thus the results obtained will be: Define copy constructor. Define VPTR. Define virtual constructor. Destructor destroys any extra resources allocated by the object.

It initializes it's object member variables with another object of the same class.

When a non-static member function of a class is called. Storing the address of the derived class object in the base class pointer. Jitendra Explain how to initialize a const data member.

Code will work fine. Define default constructor. There should be no problem in deletion of NULL pointer. If pointer is uninitialized then only it will crash. Use constructor initializer list. Define anonymous class. Madhumita It is a constant pointer. Difference between delete and free. The const data member can be initialized with constructor initializer list. Delete invokes destructor. A class that is defined without any name is called anonymous class. Define Default assignment operator.

Explain how to initialize a const member data. Define upcasting. Constructor with no arguments or all the arguments has default values. Rakesh Define a class. Neelam It also creates vtable for virtual functions. Name the keyword used when defining a function in base class to allow this function to be a polimorphic function.

Objects have state and behavior and it is a bundle of variables and related methods. Define a conversion constructor. Constructor creates an object and initializes it.

C++ Interview Questions

A constructor that accepts one argument of a different type. Semaphore performs atomic operations. Rajesh A dangling pointer arises when you use the address of an object after its lifetime is over. You can do so by using the extern "C" linkage specification around the C function declarations.

C and C++ Interview Questions & Answers

Is C an object-oriented language? C is not an object-oriented language. Define constructor.

Pdf questions cpp interview

This may occur in situations like returning addresses of the automatic variables from a function or using the address of the memory block after it is freed. Inheritance allows code reusability that saves time in program development. What are the traits of an object-oriented language? After creation the user need not know the specifics of the working of a class.

NET www. The following code snippet depicts the linkage declaration: They must define the primitive data types such as int. It encourages the reuse of proven and debugged high-quality software. Abstraction is of the process of hiding unwanted details from the user. Inline functions is to insert the code of a called function at the point where the function is called. To access a function with C linkage. Improve the application's performance in exchange for increased compile time.

Raj Globally Unique Identifier. Windows also identifies the user accounts by a user name and assigns it a GUID. GUIDS are also used by database administrators as primary key values in the databases.

The following code snippet does this. The following code snippet illustrates the use of static member functions. Explain the problem with dynamic type checking. If the value of the pointer is set to 0 soon after first delete. Send request to get more ASP.

It is hard to read or modify or maintain the code for dynamic type checking.