Who invented C?

C Programming Language was invented by “Dennis Ritchie” in 1972 at AT&T Bell Laboratories of USA. C Programming is used for developing system software and application software applications. C is a middle level language as it combines features of both high level and low level languages.

What is a Default Constructor?

Constructor which does not contain any parameters (arguments) is known as Default Constructor.

Eg: class student
{
Int roll;
Float marks;
Public:
student() //Default Constructor
{
roll=10;
marks=500;
}
};

What is a Parameterized Constructor?

Constructor which contains parameters or arguments is known as Parameterized Constructor. Parameters are send to the constructors at the time of creation of object of the class.

Eg: class student
{
Int roll;
Float marks;
public:
Student(int r,float m) //Parameterized Constructor
{
Roll=r;
Marks=m;
}

What is a Copy Constructor in C++?

Copy constructor is used to copy the data of one object which already exists to the new object that is the reason why it is known as copy constructor.
E.g.:
class counter
{
int count;
Public:
counter(int c)
{
count=c;
}
counter(counter &ob) //Copy constructor
{
cout<<”Constructor called”. count=ob.count; } void show() { cout<<”\n count=”<

What is Constructor Overloading?

Constructor overloading means defining more than one constructor or multiple constructors in a single class where each constructor have different arguments. In case of constructor overloading, compiler will call different constructors by checking their data types, the number of arguments of the constructors and their order.

Eg of Constructor overloading:
Class area
{
Double ar;
Public:
Area(int s)
{
Ar=s*s;
}
Area(int l,int b)
{
Ar=l*b;
}
Area(float r);
{
Ar=3.142*r*r;
}

What is a Destructor?

Destructors are used to deallocate (free up) the memory space which is allocated to the constructors at the time of object creation. Destructors are declared with the same name as that of class name but a tilde (~) symbol is used along with it in order to differentiate between constructor and destructor. Destructor functions execute automatically when object of a class is destroyed. It does not have any return type and contains no argument that is why they cannot be overloaded.

E.g. of Destructor:
Class abc
{
public:
~abc ()
{
Cout<<”Object destroyed”; } };

What are Inline Functions?

Inline functions are used to increase the speed of a program at run time i.e. its execution speed. A function is declared inline by using the inline keyword along with the function. When we declare a function as an Inline function then the compiler replaces the function call with its definition and in this way the process of transferring control from function call to function definition and returning control back to main function() is not done and in this way the overhead of the compiler is removed.
Eg of inline function:
Inline int add (int x, int y) //inline function
{
return x+y;
}

What are Static data members and Static functions in C++?

Static Data: Static data is the one which is stored only once in the memory for the entire class and all the objects of the class uses the same static data. Basically static data relates to the entire class and all the objects of that class share that data. We can make the data of the class as static by using the static keyword.
Syntax for declaring static data member:
Class classname
{
Static data_type data_member;
};

Static function: Static functions are those functions which have the access to only static data of the class within it and not the non-static data. A static function is declared using static keyword along with the function declaration. We can access the Static functions by the class name rather than by objects.

Syntax for declaring Static function:
Class classname
{
Static return_type function_name ();
};

What are Files in C or C++?

Files are used to store the input and output of programs on secondary storage device like hard disc etc. so that this input and output could be used for future use. A file is a collection of bytes. When we execute a program it displays the output on the monitor after that it is destroyed. In order to save this output, files are used so that we can use the output later on.

Types of Files:
1. Text Files
2. Binary Files

What are the different modes available for opening a file in C?

Modes Description
“r” It opens a file in read mode for reading. File to read must exist.
“r+” It opens a file for both reading and writing. File must exist.
“w” It opens a file in write mode for writing. A file is created if it does not but if it exists its contents are overwritten
“w+” Open a file for both reading and writing. A file is created if it does not exist but if it exists its contents are overwritten.
“a” It opens a file in append mode. It adds the contents at the end of file.
“a+” Opens a file for both reading and appending.