What is ANSI-C++?

ANSI-C++ is the name by which the international ANSI/ISO standard for the C++ language is known. But before this standard was published, C++ was already widely used and therefore there is a lot of code out there written in pre-standard C++. Referring to ANSI-C++ explicitly differenciates it from pre-standard C++ code, which is incompatible in some ways.

What is C++?

C++ is a programming language. It literally means 'increased C', reflecting its nature as an evolution of the C language.

What is OOP: Object-oriented programming?

It is a programming model that treats programming from a perspective where each component is considered an object, with its own properties and methods, replacing or complementing structured programming paradigm, where the focus was on procedures and parameters.

What is an object?

A region of storage with associated semantics.For example, int i; "i is an object of type int". In Object Oriented C++, "object" usually means "an instance of a class." Thus a class defines the behavior of possibly many objects.

Why are member functions not virtual by default?

Because many classes are not designed to be used as base classes.Also, objects of a class with a virtual function require space needed by the virtual function call mechanism - typically one word per object. This overhead can be significant, and can get in the way of layout compatibility with data from other languages.

What is faster ++i or i++, where i is an interger variable?

The answer to this lies in the fact, how they used. With ++i(PreIncrement) the variable is incremented and new value is returned. So it requires one instruction to increment the variable. In case of i++(post Increment), the old value has to be returned or used in the expression and then the variable is incrememented after the expression is evaluated. Since you need one instruction to save the old value to be used in the expression and other instruction to increment the variable, its comparatively slower.

Why is "this" not a reference?

Because "this" was introduced into C++ before references were added

Why doesn't C++ have an equivalent to realloc()?

If you want to, you can of course use realloc(). However, realloc() is only guaranteed to work on arrays allocated by malloc() (and similar functions) containing objects without user-defined copy constructors. Also, please remember that contrary to naive expectations, realloc() occationally does copy its argument array. In C++, a better way of dealing with reallocation is to use a standard library container, such as vector, and let it grow naturally

Can I mix C-style and C++ style allocation and deallocation?

Yes, in the sense that you can use malloc() and new in the same program. No, in the sense that cannot allocate an object with malloc() and free it using delete. Nor can you allocate with new and delete with free () or use realloc() on an array allocated by new.

What is Memory Leak?

Memory which has no pointer pointing to it and there is no way to delete or reuse this memory(object), it causes Memory leak

What is inline function?

An inline function is a programming language construct used to tell a compiler it should perform inline expansion on a particular function. In other words, the compiler will insert the complete body of the function in every place in the code where that function is used.

What is templates?

Templates are a feature of the c++ programming language that allow functions and classes to operate with generic types. This allows a function or class to work on many different datatypes without being rewritten for each one.

What is operator overloading?

operator overloading (less commonly known as operato ad-hoc polymorphim) is a specific case of polymorphis in which some or all of operators like +, =, or == have different implementations depending on the types of their arguments

What is a reference?

A reference is an alias (an alternate name) for an object. It is frequently used for pass-by-reference.

What is the difference between argument and parameter?

A Parameter is the required data defined in the function/method's header. An Argument is the actual data variable that is passed to that function/method during a call to execute the function/method

What is access specifier? what are the different access specifier?

The access-specifier determines the access to the names that follow it, up to the next access-specifier or the end of the class declaration. The different access specifiers are public,private and protected. 

What is a far pointer?

Every pointer variable takes a limited space accoding to the machine used. Far pointer gives the more space to store the address. the memory is prodected by operating system by segmenting it into segments.The whole application which runs on one system is in userspace and remaining system resourses are put in low memory. the far pointer manipulate such a momory

What is smart pointer?

In computer science, a smart pointer is an abstract data type that simulates a pointer while providing additional features, such as automatic garbage collection or bounds checking. These additional features are intended to reduce bugs caused by the misuse of pointers while retaining efficiency. Smart pointers typically keep track of the objects they point to for the purpose of memory management.

What is the difference between static and global variables?

Static variables are local in scope to their module in which they are defined, but life is throughout the program. On the other hand global variables have to be defined globally, persists (life is) throughout the program, scope is also throughout the program.

What is mean by constructor and destructor in c++?

A constructor is a function that initilizes the members of an object. When an object of a class is created, C++ calls the constructor for that class. If no constructor is defined, C++ invokes a default constructor, which allocates memory for the object, but doesn't initialize it. Destructors are usually used to deallocate memory and do other cleanup for a class object and its class members when the object is destroyed.

What is Inheritance? What is the advantage of it?

Inheritance is the process by which new classes called derived classes are created from existing classes called base classes. The derived classes have all the features of the base class and the programmer can choose to add new features specific to the newly created derived class. The most important advantage is reusability.

What are the important classes for file handling?

Provides input operations. Contains open() with default input mode. Inherits the functions get(), getline(), read(), seekg() and tellg() functions from istream.

Provides output operations. Contains open() with default output mode. Inherits put(), seekp(), tellp(), and write() functions from ostream.

Provides support for simultaneous input and output operations. Contains open() with default input mode. Inherits all the functions from istream and ostream classes through iostream.

What is mean by encapsulation?

Encapsulation is the process of combining data and functions into a single unit called class. Using the method of encapsulation, the programmer cannot directly access the data. Data is only accessible through the functions present inside the class.

How to maintain enhanced security using encapsulation in c++?

There are numerous reasons for the enhancement of security using the concept of Encapsulation in C++ The access specifier acts as the key strength behind the concept of security and provides access to members of class as needed by users. This prevents unauthorized access. If an application needs to be extended or customized in later stages of development, the task of adding new functions becomes easier without breaking existing code or applications, there by giving an additional security to existing application.

What are the different types of polymorphisms in c++?

1.Virtual functions
2.Function name overloading
3.Operator overloading

How can I learn C++?

There are many ways. Depending on the time you have and your preferences. The language is taught in many types of academic forms throughout the world, and can also be learnt by oneself with the help of tutorials and books. The documentation section of this Website contains an online tutorial to help you achieve the objective of learning this language.

Is C++ a proprietary language?

No. No one owns the C++ language. Anyone can use the language royalty-free.

Should I learn C before beginning with C++?

C++ is based on C. In fact, it was originally called "C with classes", so if you do not know C, you should learn it before beginning your study of C++.

Is it necessary to already know another programming language before learning C++?

Not necessarily. C++ is a simple and clear language in its expressions. It is true that a piece of code written with C++ may be seen by a stranger of programming a bitmore cryptic than some other languages due to the intensive use ofspecial characters ({}[]*&!|...), but once one knows the meaning of such characters it can be even more schematic and clear than other languages that rely more on English words

What is Visual C++? And what does "visual programming" mean?

Visual C++ is the name of a C++ compiler with an integrated environment from Microsoft. It includes special tools that simplify the development of large applications as well as specific libraries that improve productivity. The use of these tools is generally known as visual programming. Other manufacturers also develop these types of tools and libraries, like Borland C++, Visual Age, etc...

What is Virtual Function?

In object-oriented programing a virtual function or virtual method is a function or method whose behaviour can be overidden within an inheriting class by a function with the same signature. This concept is a very important part of the polymorphism portion of object oriented programing(OOP).

How do you link a C++ program to C functions?

By using the extern "C" linkage specification around the C function declarations. Programmers should know about mangled function names and type-safe linkages. Then they should explain how the extern "C" linkage specification statement turns that feature off during compilation so that the linker properly links function calls to C functions

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.

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 virtual destructor?

The simple answer is that a virtual destructor is one that is declared with the virtual attribute.The behavior of a virtual destructor is what is important. If you destroy an object through a pointer or reference to a base class, and the base-class destructor is not virtual, the derived-class destructors are not executed, and the destruction might not b compile

Can a constructor throw a exception? How to handle the error when the constructor fails?

The constructor never throws a error

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 generality) to the designer of the container or manager class.

What are the differences between a C++ struct and C++ class?

ANSI-C++ is the name by which the international ANSI/ISO standard for the C++ language is known. But before this standard was published, C++ was already widely used and therefore there is a lot of code out there written in pre-standard C++. Referring to ANSI-C++ explicitly differenciates it from pre-standard C++ code, which is incompatible in some ways.

What is the difference between new/delete and malloc/free?

New and delete create and destroy objects, while malloc and free allocate and deallocate memory.

What happens when a function throws an exception that was not specified by an exception specification for this function?

Unexpected() is called, which, by default, will eventually trigger abort().

Why do C++ compilers need name mangling?

Name mangling is the rule according to which C++ changes function's name into function signature before passing that function to a linker. This is how the linker differentiates between different functions with the same name.


Academic Projects