There are the collection of some imperative questions that have been asked during an interview, therefore we've decided to also share these with you. Hope you will like these, if you have any query feel free to contact us. We will be happy to know.
Interview Questions related to c, c++ and oops.
All these questions are provided by Anupam Karan.
Q1.What is C language?
C is a programming language developed at AT & T's Bell Laboratories of USA in 1972.The C programming language is a standardized programming language developed in the early 1970s by Ken Thompson and Dennis Ritchie for use on the UNIX operating system. It has since spread to many other operating systems, and is one of the most widely used programming languages.
Q2.What are the types of constants in c?
C constants can be divided into two categories :
1. Primary constants
2. Secondary constants
Q3. What are the types of C instructions?
Now that we have written a few programs let us look at the instructions that we used in these programs. There are basically three types of instructions in C :
1. Type Declaration Instruction
2. Arithmetic Instruction
3. Control Instruction
Q4. What is a pointer?
Pointers are variables which stores the address of another variable. That variable may be a scalar (including another pointer), or an aggregate (array or structure). The pointed-to object may be part of a larger object, such as a field of a structure or an element in an array.
Q5. What is the difference between arrays and pointers?Pointers
Pointers are used to manipulate data using the address. Pointers use • operator toaccess the data pointed to by them.Arrays
Arrays is a collection of similar datatype. Array use sub-scripted variables to access and manipulate data. Array variables can be Equivalently written using pointer.
Q6. What is "this"s pointer?
The this pointer is a pointer accessible only within the member functions of a class, struct, or union type. It points to the object for which the member function is called.
Static member functions do not have a this pointer.
Q7.What are the uses of a pointer?
Pointer is used in the following casesIt is used to access array elements.
1. It is used for dynamic memory allocation.
2. It is used in Call by reference.
3. It is used in data structures like trees, graph, linked list etc.
Q8. What is the purpose of main() function?
The function main() invokes other functions within it.It is the first function to be called when the program starts execution.
1. It is the starting function.
2. It returns an int value to the environment that called the program.
3. Recursive call is allowed for main( ) also.
4. It is a user-defined function.
Q9.What are the different storage classes in C?
There are four types of storage classes.
1. Automatic 2. Extern 3. Regiter 4. Static
Q10. Define inheritance?
Inheritance is the process by which objects of one class acquire properties of objects of another class.
A destructor is called for a class object when that object passes out of scope or is explicitly deleted.A destructors as the name implies is used to destroy the objects that have been created by a constructors.Like a constructor , the destructor is a member function whose name is the same as the class name but is precided by a tilde.
Q12.What is a structure?
Structure constitutes a super data type which represents several different data types in a single unit. A structure can be initialized if it is static or global.
Q13. What is message passing?
An object oriented program consists of a set of objects that communicate with each other. Message passing involves specifying the name of the object, the name of the function and the information to be sent.
Q14. Define Constructors?
A constructor is a member function with the same name as its class. The constructor is invoked whenever an object of its associated class is created.It is called constructor because it constructs the values of data members of the class.
Q15. What is dynamic binding?
Dynamic binding (also known as late binding) means that the code associated with a given procedure call is not known until the time of the call at run time.It is associated with polymorphism and inheritance.