Thursday, 26 July 2012

C interview Questions


 C Interview Questions 

















                                        






















































  

































  







  







 111.  How to perform matrix multiplication using Double linked lists? 

 
112.  what is pointer? 

 
113.  x) main(){ printf("%x",-1 

 
114.  ix) main(){ int i=3; switch(i) { default:printf("zero"); case 1: printf("one"); break;  

 115.  viii) main(){ char *p; printf("%d %d ",sizeof(*p),sizeof(p));} 

 116.  vii)7. main(){ int i=-1,j=-1,k=0,l=2,m; m=i++&&j++&&k++||l++; printf("%d %d %d %d %d",i,j,k,l,m);} 

117.  vi) main(){ extern int i; i=20;printf("%d",i);} 

118.  v) main(){ int c[ ]={2.8,3.4,4,6.7,5}; int j,*p=c,*q=c; for(j=0;j 

119.  iv) main() { static int var = 5; printf("%d ",var--); if(var) main(); } 

120.  iii) main(){ float me = 1.1; double you = 1.1; if(me==you)printf("I love U");else printf("I hate U") 

121.  ii) main(){ char s[ ]="man"; int i; for(i=0;s[ i ];i++) printf("\n%c%c%c%c",s[ i ],*(s+i),*(i+s),i[s]) 

 122.  All the programs are tested under Turbo C/C++ compilers. It is assumed that, Programs run under 

123.  Can a variable be both const and volatile?  

124.  What is #line used for?  
 
125.  Difference between Funtion to pointer and pointer to function 
  
126.   Can static variables be declared in a header file?  

127.  How many levels deep can include files be nested? 

128.  Which expression always return true? Which always return false? 
  
129.  When is a switch statement better than multiple if statements?  

130.  What is the difference between goto and longjmp() and setjmp()?  

131.  What is an lvalue?  

132.  Array is an lvalue or not?  
 
133.  What is page thrashing?  
 
134.  What is a const pointer?  

135.  When should the register modifier be used? Does it really help?  
 
136.  when should the volatile modifier be used?  
 
137.  How reliable are floating-point comparisons? 
  
138.  How can you determine the maximum value that a numeric variable can hold?  

139.  When should a type cast be used?  
  
140.  When should a type cast not be used?

141.  Is it acceptable to declare/define a variable in a C header?  
 
142.   What is the difference between declaring a variable and defining a variable?  

143.  What is the benefit of using const for declaring constants?  

144.  What is the easiest sorting method to use?  

145.  What is the quickest sorting method to use?  
   
146.  How can I sort things that are too large to bring into memory?  
  
147.  What is the easiest searching method to use?  
 
148.  What is the quickest searching method to use?  
 
149.  What is hashing?  

150.  How can I sort a linked list?   
 
151.  How can I search for data in a linked list?  
 
152.  How do you redirect a standard stream?  
  
153.  How can you restore a redirected standard stream?  
 
154.  What is the difference between text and binary modes?  

155.  How do you determine whether to use a stream function or a low-level function?  
  
156.  How can I open a file so that other programs can update it at the same time?  

157.  How can I make sure that my program is the only one accessing a file?  
  
158.  What is Preprocessor?  
 
159.  What is a macro, and how do you use it?  
 
160.  What will the preprocessor do for a program?  

161.  How can you avoid including a header more than once?  
 
162.  Can a file other than a .h file be included with #include?  
 
163.  What is the benefit of using #define to declare a constant?  
 
164.  What is the benefit of using an enum rather than a #define constant?  

165.  How are portions of a program disabled in demo versions?  
  
166.  Is it better to use a macro or a function?  
  
167.  What is the difference between #include <file> and #include “file”?  
 
168.  Can you define which header file to include at compile time?  
 
169.  Can include files be nested?  
  
170.  How can type-insensitive macros be created?  

171.  What are the standard predefined macros?  
 
172.  What is a pragma?  
   
173.  How do you override a defined macro?  
 
174.  How can you check to see whether a symbol is defined?  
 
175.  What is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be 
 
176.  How can I convert a number to a string?  
 
177.  How can I convert a string to a number?  
 
178.  How do you print only part of a string?  
 
179.  What is indirection?  
 
180.  How many levels of pointers can you have?  

181.  What is a null pointer?  

182.  What is a void pointer?  
 
183.  Is NULL always defined as 0?  
 
184.  What does it mean when a pointer is used in an if statement?  
 
185.  Can you add pointers together? Why would you?  
 
186.  How do you use a pointer to a function?  
 
187.  When would you use a pointer to a function?  

188.  Why should we assign NULL to the elements (pointer) after freeing them?   
 
189.  Is it better to use malloc() or calloc()?  


190.  What is the difference between far and near?  
 
191.  When should a far pointer be used?  
 
192.  What is the stack?  
  
193.  Can the size of an array be declared at runtime?  
  
194.  What is the heap?  
 
195.  What is the difference between NULL and NUL?  
 
196.  What is a “null pointer assignment” error? What are bus errors, memory faults, and core dumps?  
 
197.  How can you determine the size of an allocated portion of memory?  
 
198.  Can math operations be performed on a void pointer?  
 
199.  How do you print an address?  
 
200.  Why should I prototype a function?  

201.  What is a static function?  
 
202.  Is it possible to execute code even after the program exits the main() function?  
 
203.  Is using exit() the same as using return?  
 
204.  Can the sizeof operator be used to tell the size of an array passed to a function?  
 
205.  Is it better to use a pointer to navigate an array of values,or is it better to use a subscripted array 
 
206.  What is the difference between a string and an array?  
 
207.  what is a modulus operator? What are the restrictions of a modulus operator? 
 
208.  why n++ executes faster than n+1? 
 
209.  Write the equivalent expression for x%8? 
 
210.  What is storage class and what are storage variable ? 

211.  What are the advantages of auto variables? 
 
212.  Diffenentiate between an internal static and external static variable? 

213.  What are advantages and disadvantages of external storage class? 
 
214.  Differentiate between an external variable definition and external variable declaration  S.No   
   
215.  Differentiate between a linker and linkage?  
 
216.  What are the characteristics of arrays in C?  
 
217.  When does the compiler not implicitly generate the address of the first element of an array? 
 
218.      What is modular programming?  
 
219.  What is a function and built-in function?  
 
220.  What is an argument ? differentiate between formal arguments and actual arguments?  
 
221.  What is the purpose of main( ) function? 
 
222.  What are the advantages of the functions?  
 
223.  what is a method? 
 
224.  What is a pointer value and address?  
 
225.  What is a pointer variable? 
 
226.  Are pointers integers? 
 
227.  How are pointer variables initialized?  
 
228.  What is static memory allocation and dynamic memory allocation?  
 
229.   What is the purpose of realloc( )? 
 
230.  Difference arrays and  pointers?    

1 comment:

  1. ӏt's very straightforward to find out any topic on net as compared to books, as I found this paragraph at this site.

    Also visit my blog post; tabletki na odchudzanie

    ReplyDelete

Write your openion about my blog spot..To get automatic facebook updates like my Pagehttps://www.facebook.com/shivashankar4u ..It takes only 1 min to write the comment and to like the page.. Thanks.