Ask Question         Q & A         Articles        
Skip Navigation LinksHome > Articles > Article Detail

C Questions for Campus Placement Preparation - 2

 By : Sourabh Khanna   |  Views : 68359
0 0 0 0 0

Question: What is a structure?

Ans:  Structure is a collection of heterogeneous (i.e. related data items which can be of different types) held together to a single unit. The data items enclosed within a structure are called its members which may be of data type int, float, char, array etc. 

Question : What is a pointer?

Ans:  Pointer is a variable that contains address of another variable in the memory. Pointers are quite useful in creation of linked data structures (such as linked lst, trees graphs), managing object allocated memory dynamically, optimize the program to execute faster and use less memory. 

Question: What are the different types of Storage classes?

Ans:  There are four types of storage cases:

(i)  Extern

(ii) Static

(iii) Register

(iv) Auto

Question: What are the techniques you use for debugging? 

Ans:  Major techniques used for debugging are:

(i)  Using compiler’s features

(ii)  Read The Fine Module

(iii)  printf( ) debugging

(iv) Code grinding

(v)  Assertion

Question: What are macros? What are its advantages and disadvantages?

Ans:  Macro is a Pre-processor.Major advantage of using the macro is to increase the speed of the execution of the program.

Major disadvantage of the macros are:

(i) No type checking is performed in macro. This may cause error.

(ii)  A macro call may cause unexpected results. 

Question: Does mentioning the array name gives the base address in all the contexts?

Ans. No 

Question: Can a Structure contain a pointer to itself?

Ans. Yes, a structure may contain a pointer to itself. 

Question: Is it mandatory to make Function Declarations global?

Ans :  No 

Question: What are library Functions?

Ans: Library Functions are predefined functions and stored in .lib files. 

Question: What is difference between Structure and Unions?

Ans:  Major differences between structure and union are:

(i)    In structure every member has its own memory whereas in union its members share the same member space.

(ii)  In structure, it is possible to initialize all the members at the same time which is not possible in case of union.

(iii) A structure requires more space than union(for the same type of members).

(iv) In union different interpretations of the same memory space are possible which is not so in case of structures.

Question: What are the advantages of using Unions?

Ans:  Major advantages of using unions are:

(i) Efficient use of memory as it it does not demand memory space for its all members rather it require memory space for its largest member only.

(ii) Same memory space can be interpreted differently for different members of the union. 

Liked this Article? Share with your Friends.
Related Content
arrow  C++ Questions for Campus Placement Preparation - 2  
arrow  Important C Interview Questions with Answers - 1  
arrow  Important C Interview Questions with Answers - 2  
arrow  Important C Interview Questions with Answers - 3  
arrow  C++ Questions for Campus Placement Preparation - 1  
arrow  C Questions for Campus Placement Preparation - 1  
Comments
Post Comment
Ask a Question