Friday 27 September 2013

Top 10 C language interview question and answers

Leave a Comment
Here this article Top 10 C language interview question and answers is very helpful for the job seekers who are looking for the best question and answers regarding to C language. This article is very useful when you face any interviews on  C language in future. 




Introduction to C language

C is a programming language developed at AT & T's Bell Laboratories of USA in 1972.The C programming language is a consistent programming language developed in the early 1970s by Ken Thompson and Dennis Ritchie for use on the UNIX operating system. It has since extended to many other operating systems, and is one of the most widely used programming languages


1) What are the constants in c?

Ans: C constants can be divided into two Types :
  • Primary constants
  • Secondary constants


2) Mention the types of C instructions?

Ans: There are three types of instructions in C :
  •          Type Declaration Instruction
  •          Arithmetic Instruction
  •        Control Instruction



3) Define pointer?

Ans: Pointers are the variables which stores the address of another variable. That variable may be a scalar or an aggregate. The pointer to object may be part of a larger object, such as a field of a structure or an element in an array.



4) What are the uses of a pointer?
     
Ans: Uses of Pointer are as follows
  • It is used to access array elements.
  • It is used for dynamic memory allocation.
  • It is used in Call by reference.
  • It is used in data structures like trees, graph, linked list etc.


5) What are the types of storage classes in C?

Ans: There are four types of storage classes in C language. They are
  • Automatic
  • Extern
  • Regiter
  • Static


6) Define inheritance?

Ans: It is a process by which objects of one class obtain properties of objects from another class.



7) Define destructors?

Ans: Destructor is called for a class object when that object passes out of scope or is clearly 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 presided.



8) Define structure?

Ans: Structure constitutes a super data type which represents several different data types in a single unit. It can be initialized if it is fixed or global.



9) Explain message passing?

Ans: An object oriented program consists of a set of objects which communicate with each other. Message passing involves specifying the name of the object, the name of the function and the information to be sent.



10) Define Constructors?

Ans: Constructors are a member function with the same name as its class. It 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.
Read More...