Popular Questions from IT interviews on the C ++ language

We have collected the most tricky questions from IT interviews on C ++, which are not just desirable, but you need to know the answers.

Often employers try to mislead us with complex questions and logical tasks. This is a kind of brainstorming session to test a candidate not only on the ability to correctly solve complex problems but also on the time for which he comes to the right answers.

In order not to hit the face in the dirt, look through our selection of hard questions from the IT interviews on C ++: it will definitely come in handy.

What does the modifier virtual mean?

In C ++, virtual functions allow supporting polymorphism – one of the critical components of OOP. Using it in child classes, you can override the functions of the parent class. Without a virtual function, we get “early binding”, and with it – “late binding”. That is, which implementation of the method is used, is determined directly at runtime and is based on the type of object with a pointer to the object from which it is built.

Is there a difference between a class and a structure?

The only difference between a class and a structure is access modifiers. The structure elements are public by default, and the class is private. It is recommended that you use classes when you need an object with methods, and in the case of a simple object, structures.

What is a storage class?

A class that defines the lifetime, layout, and location of variables/functions in memory.

In C ++, storage classes are supported: auto, static, register, extern, and mutable.

Note that register is deprecated for C ++ 11. For C ++ 17, it was removed and reserved for future use.

What does the keyword const do?

It specifies the constancy of the object, the pointer, and also indicates that this method preserves the state of the object (does not modify the members of the class).

Virtual constructor: what is it?

A tricky question from IT-interviews, which are often asked after virtual destructors, in order to confuse the candidate. The constructor cannot be virtual, because it does not make any sense: when creating objects, there is no ambiguity, as when they are deleted.

Close

About The Author

Ruchi Singla
An enthusiast writer with years of experience, who loves to create beautiful thoughts into words. She writes with a zeal and enjoys reading vogue with a good cup of coffee when not writing. Ruchi is working as a content writer for many businesses, helping them gain an extra edge over their competitors. As a content writer, she is responsible for enhancing engagement and traffic on the blog by brainstorming exciting content ideas.

This site uses Akismet to reduce spam. Learn how your comment data is processed.