C Interview Questions

2) How you debug memory leaks?
3) Difference between kmalloc and vmalloc?
4) Can we find the size of memory after it was allocated?
6) What is binary search tree? 
10) Write a logic for inserting a node at the x location which can be at the start or middle or end 
      if the list?
11) Write a function to test how many bits are set in a 32 bit integer?
12) Implement logic to flip stream of 8-bit binary data and reason for selecting this method?
13) Given a double linked list and asked to WAP to sort it?
15) Write a logic for inserting a node at the x location which can be at the start or middle or end 
       if the list?
17) Setting nth bit?
18) Clearing nth bit?
19) How are enum and macro different in C?
20) Advantages of enum over macro, how are enum useful during debugging on target?
21) What is function pointer? Advantages of Function pointers? Where it is used?
22) Differentiate between new and malloc?
23) Differentiate between struct and union?
24) What is significance of union?
25) Recursive function? Advantages and disvantages?
26) Define binary tree?
27) Define data structure?
28) What is stack corruption?
29) What is stack overflow exception?
30) What is advantage of being taken static over global?
31) What is data memory? What type of data memory you know
33) Which of the above is faster /efficient (iterative or Recursion)
34) What is heap and stack? What are the variables that are stored on these?
36) In int *p, if p = 1000 then what is p++ =?
37) Pointers? How will you know the addresses of array/pointer array are word aligned?
38) Static functions in C, C++ How are they different and where do they stored in each 
       scenario.
39)Static variables in C, C++? Uses of Static variables?
40) Where a static variable stored in the following cases does: 
                     a. if declared inside a function,
                     b. If declared inside a file.
41) Differentiate b/w global and static variables? Where static and global variables stored?
42) What happens when functionA () calls functionB ()?
43) Difference between MACRO and “const”?
44) What is call back function?
45) How to write a value at particular address?
46)If we have two strings str1, str2, then how can we find that is str2 a permutation of str1?
47) Call by value function with case of swap function. Call swap function and then print the 
       variables, what is the o/p?
48) What is a static library and shared library?
49) If unsigned a and b are present. And if[(a-b)<0] then print good else print bad. What is o/p 
      and how to solve it?
50) What are the sections of an ELF, what is difference between BSS and DS?
51) What is Encapsulation and how to achieve in C?
52) Elaborate on Polymorphism and how to achieve in C?
53) What are Virtual Functions and How to obtain virtual functions behavior in C?
54) Call by value and reference; what is major usage difference in C, C++? 
55) How is base address of array different from const pointer?
56) How to use C function in C++? How to interface C function in C++?
57) Differentiate between new and malloc?
58) Differentiate between struct and union?
59) Order of double linked list.
60) Suppose there is a single linked list. How do you go to the nth element from the last node 
       by traversing the list only once from start?
61) What do you mean by const keyword?
62) What is size of character, integer, integer pointer, character pointer?
63) What is NULL pointer and what is its use?
65) Can structures be passed to the functions by value?
66) Why cannot arrays be passed by values to functions?
67) Advantages and disadvantages of using macro and inline functions?
68) What happens when recursion functions are declared inline?
69) #define cat(x,y) x##y concatenates x to y. But cat (cat (1, 2), 3) does not expand but gives 
      preprocessor warning. Why?
70) ++*ip increments what? It increments what ip points to?
71) Which way of writing infinite loops is more efficient than others?
72) What is a forward reference w.r.t. pointer in c?
73) How can you define a structure with bit field members?
74) How do you write a function which takes 2 arguments - a byte and a field in the byte and 
       returns the value of the field in that byte?
75) Which parameters decide the size of data type for a processor?
76) What is job of preprocessor, compiler, assembler and linker?
78) Explain about stack segment? How it grows? What are the ways to allocate memory other 
       than allocating in heap? 
79) Why stack uses LIFO’s and Queue uses FIFO’S? What is stored in stack? Differentiate 
       between stack and heap?
80) What is linked list? What is the difference between array and linked list? How to add and 
        remove the nodes in a linked list?
81)What are storage classes in C? What is Static storage class in C? How it is used (an 
        example)?
82)Differentiate between C and C++?
83)How do you relate Data Encapsulation in C++ with the static storage class in C?
84)Differentiate between Arrays and Linked Lists? When you will decide to use arrays and 
        linked lists?
85)Preprocessor commands used for debugging?
86)Hash tables explanation in c?
87)What is size of Struct {
                                            int m1;
                                            short int m2;
                                            int m3;
                                            char m4;
                                         }
88)What is int * const ptr?
89)What are the compile time and link time errors and how to solve those? 
90)What are the functions or properties of Make File?
91) What is data memory? What type of data memory you know
92) Implement a logic to flip stream of 8-bit binary data and reason for selecting this method
93) What is little endian and big endian?
94) Static variable is declared in 1.c file and need to edit the same static variable in 2.c file, 
          how to do this?
97) Difference between static and extern?
98) how to use static function defined in one file in another file

2 comments:

  1. Thank you so much for the post.The content is very useful.I always love your posts because of the information and knowledge one can gain by reading your post.Thanks for sharing and keep updating still more.
    Best Python Training in BTM Layout

    ReplyDelete