C and C++ Interview Questions and Answers
C and C++ Interview Questions & Answers
Here are the list of most frequently asked C and C++ Interview Questions & Answers in technical interviews. These questions and answers are suitable for both fresher’s and experienced professionals at any level. These C and C++ Interview Questions and Answers will guide you to clear all Interviews.
Best C and C++ Interview Questions and Answers
C and C++ Interview Questions and Answers for beginners and experts. List of frequently asked C and CPP Interview Questions with answers by Besant Technologies. We hope these interview questions and answers are useful and will help you to get the best job in industry. This C and C++ interview questions and answers are prepared by Professionals based on MNC Companies expectation. Stay tune we will update New C and C++ Interview questions with Answers Frequently.
Best C and C++ Interview Questions & Answers for Job Placements
Besant Technologies supports the students by providing C and C++ interview questions and answers for the job placements and job purposes. We provide the C and C++ online training also for all students around the world through the Gangboard medium. These are top interview questions and answers, prepared by our institute experienced trainers.
Here are the list of most frequently asked C and C++ Interview Questions and Answers in technical interviews. These questions and answers are suitable for both freshers and experienced professionals at any level.
C programming language supports multiple features. They are
- Middle-Level Programming Language: C programming supports high-level features like Pointers, Structures data structures and as well as it will supports assembly code also so we conclude c as a middle level programming language.
- Structured oriented programming Language: C program is structure oriented programming language means it will execute the statement in sequence
- Modularity: In c programming language we can reduce the more line number of code by using modularity
- Portability: C programming language is platform-independent means with minor modifications we can reuse the code on different platforms also.
- Powerful Data Structure: With the help of data structures we can implement the complex application easily
Data types divided into two types. They are
- Predefined data types
- User defined data types
Predefined Data types: Int, char, float and double are the predefined data types
User-defined data types: Arrays, Pointers, strings, and structures are user-defined data types
Errors in c programming are divided in two types. They are
- Compile Time Errors
- Run Time Errors
Here we can discuss about the compile time they are
- Pre-processor errors: Pre-processor errors will occur at the time of pre-processing EX: #include<stdi.h>
Here “stdi.h” is the fatal error - Translate Errors: These errors also called as syntactical errors. EX: printf(“Hello\n”) //Here missing semicolon “;”
- Linker Error: Linking errors occur while linking the modules , methods or functions Ex: print(“Hello\n”); //Here printf is the error
Here we can discuss the compile-time they are
- Segmentation Fault: Un authorized memory access called as segmentation fault
- Bus Error: Memory is not at all existing still programmer trying to access it
The function is nothing but a collection of a set of statements called function. Functions are divided into two types they are
- Pre Defined Functions
- User defined Functions
The functions which are coming with compiler by default that functions we can call it as pre defined functions
Ex: sqrt,pow etc
The functions which are written by the programmer, then we can call it as user defined functions. To write user defined function need three components. They are below
- Function declaration
- Function definition
- Function call
Control statements are divided into three types. They are
- Conditional Statements
- Iterative Statements
- Jump Statements
These statements are decision making statements in source code. This are several types
- if statements
- if-else statement
- if-else if –else statement
- nested if statement
- switch-case statement
When we are going to use repeated code we will use iterative statements. These are several types
- for loop
- While loop
- do-while loop
Jump statements are used to break the loops , continue the loop and jump to the required statement. These are several types
- break
- continue
- goto
It is also known as a library file.it contains definition and prototype of the program. header file contains a set of functions.
Eg.stdio.h it contains a definition and prototype of commands like scanf and printf.
- assembler
- compiler
- interpreter.
assembler is used to convert assembly lang.into machine lang. assembly lang. is noting but low level languge.
It convert high level lang.into machine language.
Compiler takes the program as a whole and converts it into object code before execution.
variable is name given to mamory space that may be used to store data.its value can be change depends on user reqirements.
Eg: int x=4 and int x=8.
- int-integer data type.
- Char-character data type.
- Float-floating point value.
- Double-a double precision floting point value.
- Void-valueless special purpose type.
In program first variable is declare and this variable is used in whole program .variable declaration tells compiler two things first name of variable and data type.
a local variable, global variable, and static variable.
local variable
The variable that is defined within the body of a function or a block is known as a local variable. These variables are created when the function is entered and are destroyed when the function is exited.
Example:
void func(void)
{
int a,b;
}
Global variable
The global variable defines outside any function and is used for whole program. These variable are automatically initialized to 0 at the time of declaration.
Static variable
static variable are declared by writing keyword static in front of the declaration.if static variable is not initialized then it is automatically initialized to 0.a static variable is initialized only one.
Static type var_name;
yes due to modern gcc compiler support it.
32 Keywords are used in c (0-31)
it is a case of automatic variable.it is used to store data.
extern is a keyword which is used to extends the visibility of c variable and c function .and also due to extern variable memory is allocated for that variable.
token is a smallest basic component of source code.tokens are ( constant,identifier ,operator,reserved word,separater)
The basic difference is that declaration has many form but the definition has only one. the declaration makes the variable as a part of a program that can be used in the program. and definition tells the compiler to set storage for the variable.
No, is not a Boolean variable.
- sign
- exponent
- mantissa,
when keywords are not supported some special character.
keyword hassome predefined meaning and it can not be changed.
constant have fixed values and they can not be changed during the execution of the program.
The function is a block of statement that perform some specific task, the function is the fundamental modular unit,it is reusable.
- arithmetic operator.
- logical operator.
- relational operator.
- comma operator.
- size of the operator.
- conditional operator./ternary operator.
- assignment operator.
- bitwise operator.
- increment and decrement operator.
- other operator
If function will not return any value at that time we use the void keyword at the leftmost part of the header function.
The algorithm provides a step by step procedure on how a solution can be derived.
Due to semicolon compiler knows where each statement ends. and also it can divide the statement Into smaller statements for syntax checking.it acts as the delimiter.
you can do it by using %% in the printf statement.eg you can write printf(“10%%”)to have the op appear an s10%on the screen.
Yes, it is possible to create a customized header file.it can be created by using #include directive followed by the name of your header file.
Text file contains data can be easily understood by humans.it include number, letter and another character. on the other hand binary files contains 1s and 0s that computer can interpret.
1) Compile-time error_ a)Preprocessor error b) linker error c) syntax error.
2)Run time error_ a) segmentation error b) bus error
This error occurs when the program being executed.one common instance wherein run time error can happen is when you are trying to divide a number by zero.when run time error occurs program execution will pause, showing which program line caused the error.
logical error occurs at compile time. this happen when a wrong formula was inserted into the code wrong sequence of command was performed.on the other hand syntax error occurs due to incorrect command that is not recognized by the compiler.
control structure decides which instruction are to be performed in program.and also define how the control is transferred to another part of the program. i.e it controls the flow of the program.
- selection statement_ if …else, switch.
- Iterative statement_ while,do..while, for
- jump statement _ goto, break, continue.
If we have more than one condition to check on a single variable or a single expression then switch is better than if. In a switch statements, program execution jumps to matching value. and if we use it if the condition it checks one by one condition.
In entry controlled loop body is checked after checking the condition, ie condition is checked first and after that body will be executed. Eg. For loop, while loop.
In exit controlled loop body is executed first and then loop test condition is checked.eg.do while loop.
In counter control loop ,we know that exactly how many times loop body will be executed while in sentinel loop we don’t know about the loop recurrence,execution of loop is based on condition not on counter.
switch case statements follows fall down property. It means when case block is executed and break statements is not used after the block statements,then it will execute next case or default statements until break not reached or switch not finished.
It is used to transfer the program control from one location to other location .
1.goto_ is used to jump program control from one locationto de
fine label
2.break_ is used in switch and loop statements it is used to break the execution of the switch and transfer the control after switch statement.
3continue_ is used in looping statement it transfer programs control in the starting of the loops body.
4.return_generally return is used in function body it transfer programs control from called to calling function.
No,continue statement can be used within the loop only.if we used without loop there will be compiler error “misplaced continue”.
No,it can transfer programs control within the function only.
Array is a collection of same data type elements.Arrays are always fixed.
array contain data type ,array name and size of array
It can be delare as eg. int arr[5]; or int arr[];
No,we can not change the array size.
default values of array is as follow
1.For byte ,short ,long ,int default value id 0.
2For float ,double default values is 0.0.
3.For boolen default value is false.
4.For object default value is null.
when you pass an array as a function the base address of an array will be passed.
The return 0 value in the main function considered as the exit status of program or application. In some program return 0 is a success status of the program.
In c program, we cannot return the whole array as an argument to a function. but you can return a pointer to an array by specifying an array name without an index.
array is a collection of similar data type elements. the length of array is established when the array is created .each atom is called elements of array,and each elements is accessed by its numerical index.
The array is a data structure consisting of a collection of elements each is identified by array index or key.
the array holds multiple values, whereas the normal variable holds a single value
One dimensional array is a type of linear array.accessing its elements involves a single subscript which can be row or column index.
- C++ is an object-oriented programming language having features like abstraction, polymorphism, encapsulation, dynamic binding, and inheritance.
- C++ provides a set of the library called STL to perform various functionalities like creating dynamic arrays like vectors.
- It’s powerful and fast as compilation and execution take very less time. C++ provides allocation of memory dynamically(at run time).
Class is a user-defined datatype that has its own member function and member variables. Consider the example of a laptop. Let the laptop be a class. It will have member variables in parts such as a keyboard, mouse, ram, hard disk, etc. If we want to manipulate these members we need a set of functions called member functions.
Examples of Class Laptop
{
Char *keyboard; Char *mouse; Char *ram;
};
Reference is another name for a variable used in the program.
FOR example, I have a variable called x x
Right now x is a variable let us suppose it is present at memory address 80. If I create a reference of x
Int &y = x
Now y , called reference of x is created. It will be just an alternate name of x, which means it will be pointing to the same memory location as that of x.
x y
Alternatively, I can also say that if someone’s name is “Ramesh” and his nickname is “Ram”.
both are the same person only.
Pointer contains the address of a variable. Let us take an example below :
A variable x we have, stored at address 80. Ptr contains the address of a variable. Int x = 10;
Int *ptr = &x;
X ptr
0X7ef999ef80
We can say ptr will contain a value of 80. ptr
0X7ffffeed300
The main difference between pointer and reference is
- Reference is the alias of the variable, whereas the pointer contains the address of a variable.
- Once a reference is created for a variable, it cant be made to point to some other variable, whereas a pointer can be referred to some other variable.
- Reference must be initialized when created, whereas no such restriction is there in
the case of the pointer. If the pointer isn’t initialized it will be called a wild pointer.
Access specifiers are the keyword used in C++ to define the scope of visibility outside class. three types of access specifier in C++
- Public
- Private
- Protected
Example:
Class A
{
Public:
Int x;
Private:
Int y; Protected:
Int z;
};
Public access specifier means variables is accessible / viewed even from outside class.
Private access specifier means variables is not accessible/visible outside class. Only class members can see and access it. If we try to access it from outside class directly. The compiler will generate an error. Though Friend class can access private members.
Protected access specifier is similar to protected in the sense that it can’t be accessed outside class unless it with help of a friend class or by a derived class.
Encapsulation is binding together data and functions that manipulate data . A good example we already discussed above is class.
example
Void A::setX()
{
X = a;
}
Int A::getX()
{
Return x;
}
Here in above example data x cant be modified directly so using member function setX we modified it and to get value of x also we can get directly using function getX we fetched it. Above class defined is example of encapsulation as it binds data (called x in above example) and member function that modifies them (getX,setX in above example) together.
When proram executes function in C++. Int fun(int x)
{
Return x;
}
Int Main()
{
Int y = fun(x);
}
- During compilation as soon as program sees function call instructions CPU stores memory address of instruction following function call.
- It also stores argument of function in stack(in above case x wil be stored in stack).
- CPU then executes function code, stores the value returned by function in some memory location and returns the control to function who called this function(in above case control goes back to main).
This whole set of above process takes some time to execute called as execution time.
What if we have a function that is just returning the value or just setting value example getter setter which we explained in above question. In that case spending too much times in function call can impact total execution so to avoid this what if we have any such functionality which could retuce our function calls ,we can make such function as inline.
By specifying keyword inline in front of function, compiler sees instructions and if function doesn’t take much time it replaces function calling with function definition like when fun(x) is called it replaces definition of fun(x) in main thereby reducing our function calls.
Note: keyword inline is just a suggestion to compiler, its not an instruction, compiler may or may not make function inline. If function is very large doing some input output
operation in that case replacing whole function won’t help.
Let us see this with help of example:
Int sum(int a, int b)
{
Here a, b are formal paramters.
Return a+b;
}
Int main()
{
Int x = 3,y = 5; x, y are actual paramters. Int output = Sum(x,y);
Return output;
}
Formal as name indicates, are just a placeholder or we can say variables present in function declaration/ definition and they receive their value from some function call.
Actual parameters as name says these are actual parameter which is having some value and some address. Here x and y are some value variable with value 3, 5 and some valid address.
A constructor is a member function that initialized object of class It has same name as that of class and no return type.
There are different types of the constructor:
- Default
Default contructor is one that doesn’t take any argument.
Class A
{
Private:
Int x; Int y; A()
{
x = 10;
y = 20;
}
};
- Parametrized
In Parameterized ctr, we pass paramters.
Class A
{
Private:
Int x;
Int y;
A(int a, int b)
{
x = a; y = b;
}
};
- Copy
o Used to Initialize new object of class using another object .
Class A
{
Private:
Int x;
Int y;
A(int a, int b)
{
x = a; y = b;
}
};
Int main()
{
A a(20,30); // object created using parametrized ctr A b = a; //copy ctr called
}
If we don’t define out own copy ctr compiler will create default copy ctr for us.
- Syntax of copy constructor? When it is called ? className(const className &obj)
copy conctructor is called
- when a new object from existing object of class.
- Object is returned by value.
- Compiler generates temporary object.
- Obj of class is passed to function by value as an argument.
className(const className &obj)
As we saw earlier in the example copy constructor is called when a new object is created from existing object.
Let us take an example
Class A
{
};
A fun()
{
}
A(){}
A a; Return a;
Int main()
{
A b = fun(); // fun function is called, it return an temporary object , thereby calls copy
//constructor. Now compiler created temporary object cant be modified. So its bound to
// const in copy constructor..
}
To avoid such scenarios const is added in copy constructor.
- Use of & in copy constructor? What will happen if & is removed?
& means we are passing by reference, which we already discussed in call by value and call by reference. If we pass by reference that means we are not creating new object, we are passing reference of existing object.
A (const A &obj);
If we remove & , it will be A(const A obj)
Copy constructor itself is a function, if we pass argument by value, it will again call copy constructor, thereby making a chain of calls. So compiler doesn’t allow to make call by value.
Function overloading is when two or more functions have the same name but a different number of parameters/types of parameters.
Class A
{
};
Int fun(int i );
Int fun(double f);
Above two function fun(int i), fun(double f) are overloaded functions.
Now below are some scenarios which aren’t overloaded function:
These functions are the same but differ by return type.
So these aren’t overloaded functions.
Both functions are the same, one is an array, the Other is *, both are equivalent.
Function overriding is the re-definition of a function from base class to derived class i.e it has the same return type as well as parameters.
Fun is overridden function in below classes A and B. Class A
{
Void fun()
{
Cout<<” A class fun is called”<<endl;
}
};
Class B: public A
{
Void fun()
{
Cout<<” B class fun is called”<<endl;
}
};
Int main()
{
B b;
b.fun(); // it wil print fun of B class
//now if we say we have reference of A class but object of dervived class B b2;
A &test = b2;
test.fun(); // base class fun will be called.
}
To overcome such a scenario we make the base class function which is overridden as virtual. My marking function is virtual. The compiler will resolve that call at run time.
Now what we mean by run time.
As compiler executes below piece of code if virtual isn’t added.
B b2; // creats object of B class.
A &test = b2; // when compiler reference of A , test is created
test.fun() // test is mapped to fun at compile-time, as a reference is of the base class, so base class fun is called
Now if mark function as virtual, compiler understands mapping need to be done at run time instead of compile time. So when object b2 is created. It sees object is of class B, it maps with the object of B class now if we mark a base class function as virtual instead of class base class fun it will call derived class fun.
Virtual functions is a member function defined in the base class and overridden in the derived class. We use the virtual keyword for that.
Explanation already did in above.
Class and struct both are except few difference.
- In Class, default access specifier is private, where default access specifier in struct is public.
- Struct aren’t secure as they cant hide implementation details from user. Class are more secure.
When an object is created for a class , each object contains its own copy of member variables and a unique copy of member functions.
Member variables contributes to size of object
Class B
{
}
Int x;
Char b;
Int main()
{
B obj;
Cout<<”size of obje”<<sizeof(obj)<<endl;
}
Size of class B = size of int(x) + size of char (b)
= 4 + 1
= 5
Padding is done , so compiler will return 8.
Class A
{
};
Int main()
{
A a;
A b;
}
By looking it may look, as it doesn’t contain any member variable so size should be 0. But it compiler doesn’t work this way.
To assign each object a unique copy of member variables a, bit should be allocated to a unique address.
Both a and b will have a unique address. Hence size should be 1.
A friend function is given special privilege to access private and protected members of the class.
We can make a function friend by adding a keyword friend in the beginning of the function. It can be a function of some other class or it can be global also.
Class A
{
Private: Public :
Int a;
friend void B::setVariable() ; // now this function can access private variable a.
though class B is independent of class A, still by making it friend it can access it, members.
};
Class B;
{
Void setVariable();
};
Friendship isn’t mutual. The function of class B can private/protected variables of A doesn’t
permit class A to access B class private variables.
The static keyword could be added with variables, function,s or objects.
When used with variables, it becomes a shared variable for all members of that scope.
Void fun()
{
Static int count = 0; // count isn’t initialized every time. Only once initialized and same
updated value is used .
Count+=1;
}
Int main()
{
Int I = 0;
While(I < 5)
{
Fun();
}
Return 0;
}
//at the end count will b 5.
When static is given with class variables, static variables belong to the class, instead of belonging it with the object. Only one copy will be shared across all objects.
When declared with function, they can be called with an object, directly with class names they can be called
Class A
{
Static int fun();
};
A::fun() // can be called lik this.
Yes, the constructor can private. If we have such scenarios where we want to make only one object per class
Class A
{
Private :
A *ptr; A();
Public :
};
Static Void fun();
Static void A:: fun()
{
If(!ptr)
Ptr = new A(); //public function can call private
Return ptr;
}
Int main()
{
A::fun(); // function is static so can be called without objects
}
The above case makes sure only one object is created.
- Destructor is a member function which is used to delete object.
- Similar to constructor it has same name as that of class, no return type
- It has no argumemt.
~A()
- Add a tilde symbol before class Name. destructor is called automatically when object leaves current scope.
- Only one destructor exists per class.
No, we cant make a constructor virtual.
Type of object is decided at compile time and virtual calls are resolved at run time. These conditions contradict each other.
If we make a constructor virtual, we wont be able to find out type of object at compile time, so compiler will generate an error.
- A pure virtual function is such virtual function which doesn’t have any definition.
- In declaration it is assigned 0 value. Virtual void fun() = 0;
- It is also called the abstract function.
A class having at least one pure virtual function, becomes abstract class, and its object cant be created. If a function is declared pure virtual in base class, it must be overridden in derived class. If not overridden in derived class, then derived class also becomes abstract class.
Class A
{
};
Public :
Virtual void fun() = 0; Void display();
Class B:public A
{
Public:
}
Void display();
Int main()
{
An obj; //error, as its abstract class, object cant be created. B obj2 // error, fun not overridden in derived class.
}
Instead, if we modify a class with below class Class B:public A
{
Public:
}
Void display(); void fun();
B obj // works fine.
We can allocate memory to object dynamically using new operator.
It requests memory allocation from free store, same way as malloc, calloc.
Dynamic creation of memory means rather than allocating memory at run time, memory is allocated to object at run time.
Int * p = new int;
A * ptr = new A();
When memory is allocated using a new operator, the compiler allocated one block of memory extra to denote how much memory needs to be allocated.
In the above example
Class A
{
};
Int a; Char b;
A * ptr = new A();
When memory is allocated to ptr, 8 bytes, at beginning compiler says how much memory to be allocated then add extra 8 byes to ptr.
As soon as we call delete(ptr), the compiler goes to the ptr location, checks how much memory needs to be freed, that corresponding blocks it frees and moves them back to free store.
As soon as the program is created, during the compilation phase, 1st phase is preprocessing, it’s done by the preprocessor.
Preprocessor handles preprocessor directives such as macros, file inclusion, conditional compilation. It replaces it with actual piece of code.
- During preprocessing, macros like #define sum 5
- Wherever sum is found in the program it’s replaced with 5.
- All calls of #include<iostream> are resolved. Preprocessor tells the program to add this file in the source program.
- Other directives like #pragma
- #ifdef is also resolved by the preprocessor.
When preprocessor sees file with <> , it instructs compiler to check file in standard library path. when preprocessor sees “ ” , it knows these are user defined files and instructs compiler to search in same directory. If program contains large piece of independent code. Its always a good practice to split code in different header file and include that header file separately.
Header files are used to call the build-in function into the particular class
Preprocessor directives begin with a # (hash). Preprocessor directives are the instructions given to the compiler.it used to call the build in function
The program starts running with the main function, so it’s special
Comments are used to understand the program flow and its explains the code written in the program
Numeric constant
Eg) int a=10;
Character constant
Eg) char s=’u’;
Use to create a new line
Specifiers in scanf are %c,%d,%s,%f,%x,etc..
We can initialize a string like
Eg) char data[]={‘h’,’e’,’l’,’l’,’o’};
- Read string in C using scanf() with %s.
- Read string in C using scanf() with %c.
normal variable—-
value=èeg) a=10
addressèeg) &a=12233
pointer variable—-
valueèeg *a=10
addressèeg) a=12233
- Used to allocate additional memory available space or to release the unwanted memory space at point of runtime
- Used to optimize the use of storage space
- The programmer can allocate memory whenever he decides and releases it after using the memory
build in functionè
malloc()
calloc()
realloc()
free()
header fileè
#include<alloc.h>
Ptr_name= (*cast type) malloc(int size);
free() is used to deallocate the memory created by allocation method
calloc() used to allocate multiple blocks of contiguous memory in bytes. All the blocks are of same size.
Syntax:
Ptr_name= (*cast type) calloc (No.of blocks,int size);
Binary file
Text file
‘r’ mode
Basic file operations in c
- Naming a file in c
- Opening a file in c
- Reading data from a file in c
- Writing data to a file in c
- Closing a file in c
Used to go to a particular position
Fprintfè used to print content in file
Fscanfè used to get data from file
Class,object,inheritance,polymorphism,abstraction.
CLASS IS A collection of data member and member function
The object is an entity, used to call the functions in a class
Used to call the predefined function
- OOP can also be used for design applications
- Codesharing possible in OOPs
- Errors can handle easily
Used to reduce the size of the variable
Variables should be declared anywhere within the program
Memory management Operators in c++ are new,delete.
Syntax:
Datatype var;
Store multiple lists of data in a single object
`:` used to declare the function outside of the class
Same function with different types of argument
C++ enables two or more functions with the same name but with different types of arguments or a different sequences of arguments or a different numbers of arguments. It is also called “Function Polymorphism”
Eg)
void display(char c, int n)
{for ( ;n>0;n–)
cout<<c<<” “;}
void display(int a, int b)
{for (;b>0;b–)
cout<<a<<” “;}
The concept behind the encapsulation and data hiding restrict the non-member function from accessing the private members of the class by using the friend keyword.
The private members of one class can be accessed from the member functions Of another class by making them friends.
Used to initialize the data members of a class with different values when they are created. This is achieved by passing arguments to the constructor functions when the objects are created.
- This constructor function designed to copy objects of the same class type.
- It accepts a single argument and returns a copy of an object
- It can also be called if you initialize a new object with another object of the same type
- Arguments cannot be passed by value
- provide a way to create an object by making a copy of an existing object
Operator Overloading refers to giving the normal C++ Operators, such as +,*,<= etc., additional meanings when they are applied to user-defined data types. Simply defined as to create new definitions for operators.
- A body-less virtual function is otherwise called. Simply defined as virtual functions with nobody
- we use the pointer of the base class to refer all the derived objects
- It is a normal practice to have a function in base class just for implementing virtual function but the actual coding will be done in derived class only and also the class cannot be used for creating objects.
A class that contains at least one pure virtual function is said to be an abstract class.
NOTE : you can use an abstract class only act as a base class for deriving other classes but does not create objects
Manipulator function is special stream functions that change certain characteristics of input and output. All the manipulator functions prototypes are defined in the
SYNTAX:
header file <iomanip.h.>
- endl (new line character)
- setbase(covert the base value in to another bases value)
- setw( set the width of the output)
- setfill(fills the given character in the unused field)
- setprecision(displays the number of digits after the decimal point in the floating numbers Etc..
It is a special pointer that exists for a class while a non-static Member function is executing. It is used to access the address of the Class itself and may return data items to the caller.
A Stream is generally referred to flow of data.
Each stream is associated with a particular class that contains member functions and definitions for dealing with that particular kind of data flow
Close()
Eof()