Skip to content

Category Archives: C++

Image a situation where we want to use or print a long long string in C or C++, how to do this? In C/C++, we… Read More
Predict the output of the following simple C++ program without any virtual function. #include <iostream> using namespace std;    class Base { public:     void print()… Read More
The memcpy function is used to copy a block of data from a source address to a destination address. Below is its prototype. void *… Read More
Predict the output of following C++ programs. 1) #include <iostream> void init(int a=1, int b=2, int c=3);    int main() {     init();     return 0; }… Read More
Given a C/C++ program, remove comments from it.  We strongly recommend to minimize your browser and try this yourself first. The idea is to maintain… Read More
The Subscript or Array Index Operator is denoted by ‘[]’. This operator is generally used with arrays to retrieve and manipulate the array elements. This… Read More
Assertions are statements used to test assumptions made by programmers. For example, we may use assertion to check if the pointer returned by malloc() is… Read More
A pure virtual destructor can be declared in C++. After a destructor has been created as a pure virtual object(instance of a class), where the… Read More
In C++, stream insertion operator “<<” is used for output and extraction operator “>>” is used for input. We must know the following things before we… Read More
Sometimes implementation of all function cannot be provided in a base class because we don’t know the implementation. Such a class is called abstract class.… Read More
The mutable storage class specifier in C++ (or use of mutable keyword in C++) auto, register, static and extern are the storage class specifiers in C.… Read More
A constructor is a special member function that is automatically called by the compiler when an object is created and the destructor is also a… Read More
In Java, we can use final for a function to make sure that it cannot be overridden. We can also use final in Java to… Read More
Predict the output of following program: Can % be used with floating point numbers in C++? #include <iostream> int main() {     float f = 9.9f,… Read More
C++ provides inline functions to reduce the function call overhead. An inline function is a function that is expanded in line when it is called.… Read More

Start Your Coding Journey Now!