C interview Topic


C interview Topics:

  • linked list
  • pointer related
  • bitwise op
  • what are padding and packing?
    • packing means #pragram pack1, 
  • substring compare and linked list.
  • IRQ
Arm and MIPS difference. 
Intel:
CISC arch. 
complex instruction set computing. the philosophy behind CISC processors is that a single instruction can do multiple things; 
like add an immediate number with a register, 
store this value to an address computed using some other register and also set arithmetic flags.
complex instruction will take more power.
As it is having multiple operations is one instruction cycle, having a high performance
security:
Intel vPro 
ARM:
RISC processors, on the other hand, would have two separate instructions for this; one to add two numbers and the other to store the result
simple instruction will take less power. 
As it is having separate instruction for operations, it will take more power to come to CISC.
Security:
ARM trustzone is present. 
Mips:
Having the RISC architecture


why we need the make file system 
what we need  Userspace and Kernal space?
Can we declare a static variable in a header file?
    Yes we can...but when we are going to use .h file in another program the real problem arrises

C interview question:

  • What would malloc(0) return?
  • How will you write a Function which takes Two Arguments --> a Byte and field in the Byte and returns the value of a field in that Byte?
  • Declare a manifest constant that returns the number of seconds in a year using Preprocessor? Disregard Leap Years in your answer
  • Write standard "MIN" macro that is a macro that takes two arguments and returns smaller of the two arguments?
            #define Min(x,y)  ((x<y)?x:y)
  • What is the problem associated with the gets( ) function and how to avoid it?
  • How "Free" function knows the Size of memory on Heap to be de-allocated?
  • How to Call a function before main( )?
  • Create a function that accepts different types of Data arguments & returns an integer
  • What are various reasons for the "Segmentation Fault" in C?
  • How will you override an existing Macro in C?
  • How to print a string containing '%' in print?
    • printf("%s",ascii('%'));
  • What are Lvalues and Rvalues?
  • How is a signed negative number stored in memory?
    • as the 2's complete formate it will store.
  • Which is the best way to write Loops?
  • What is loop unrolling?
  • How does, taking the address of the local variable result in unoptimized code?
  • How does the global variable result in unoptimized code?
  • Which is better a char, short or int type for optimization?
  • Can structures be passed to the functions by value?
  • Why cannot arrays be passed by values to functions?
  • Advantages and disadvantages of using macro and inline functions?
  • What happens when recursion functions are declared inline?
  • Scope of static variables?
  • Which way of writing infinite loops is more efficient than others?
  • **Why we need multi line 
  • What is interrupt latency?
    • is the time taken by the generation of the device and service of the device with generated the interrupt.  (or)
    • Interrupt latency is the time required for an ISR to respond to an interrupt.
  • What are the different storage classes in C?
    • auto
      • By default, all the local variable are auto storage class.
      • lifetime: within the braces.
    • static 
      • static local variable retains its state between the function call. 
      • static function, the scope within the file.  
      • static global variable: the scope within the file.
    • register
      • the value will be  store in the CPU registers
    • extern
      • the variable is defined elsewhere and not within the same block where it is used.
  • What are the different qualifiers in C?
    • const
    • volatile 
  • What is the endian type? where we use it? 
    • little-endian 
      • The least segment byte (little end) is stored in the lowest address.  
    • big-endian
      • The most segment byte (big end )is stored in the lowest address. 
    • const int isBigEnd=1;
      #define is_bigendian() ((*(char*)&isBigEnd) == 0)
    • #define LITTLE_ENDIAN 0
      #define BIG_ENDIAN    1
      
      int endian() {
          int i = 1;
          char ∗p = (char ∗)&i;
      
          if (p[0] == 1)
              return LITTLE_ENDIAN;
          else
              return BIG_ENDIAN;
      }
    • typedef union
      {
          //integer variable
          uint32_t u32RawData;
          //array of character
          uint8_t  au8DataBuff[4];
      } RawData;
      int main(void)
      {
          RawData uCheckEndianess;
          //assign the value
          uCheckEndianess.u32RawData = 1;
          //check the array first index value
          if (uCheckEndianess.au8DataBuff[0] == 1)
          {
              printf("little-endian");
          }//check the array first index value
          else if (uCheckEndianess.au8DataBuff[0] == 0)
          {
              printf("big-endian");
          }
          return 0;
      }

Pointer

  • An array of function pointers?
    •  void (*fun_ptr[])(void,void
    • or 
    • typedef void (*fun_ptr) (int);
    • fun_ptr fun_ptr_arry[5];

EMbedded C 

  • What is the Significance of "Watchdog Timer" in Embedded Systems?
  • Explain Read Modify Write technique?
  • Explain LCALL
  • What is the Advantage of "ACALL" over "LCALL"?
  • What is Virtual Memory?
    • is the illusion to process, that they are having a large memory  access area
  • What is "Interrupt Latency" & how we can reduce it?
    • Interrupt latency is the time required for an ISR to respond to an interrupt.
  • What are the different activities which a STARTUP Code performs?
  • Explain the Boot Process of a Microcontroller
  • What is the function of the DMA Controller in Embedded Systems?
  • How is a program executed "Bit by bit" or "Byte by Byte?
  • Difference between Memory Mapped I/O and I/O mapped I/O
  • How "Interrupts" are handled in a Microcontroller?
  • What is the Role of a "Bootloader" in Embedded Systems?
  • Difference between "Bit Rate" and "Baud Rate"
  • What is lst File?
  • What is EQU?
  • What is the function of Simple Thread Poll in Embedded Systems?
  • What are the different types of customizations that are used with the "Volatile" Keyword?
  •  What is the use of __IO and static keywords in c?
    •  __IO is not a C keyword. __IO is a macro for volatile - defined in STM32 standard peripheral library header files. E.g., in core_cm4.h (might be in a CMSIS sub-folder), you will find
    • #define     __IO    volatile
    • (If you use gcc's -E option to use only the pre-processor stage, you can see the macro's expansion.)
    • ForMoreinfo

ARRAYS:

  • How do you find the missing number in a given integer array of 1 to 100?
    • int getMissingNo(int a[], int n)
    • {
    •     int i, total;
    •     total = (n + 1) * (n + 2) / 2;
    •     for (i = 0; i < n; i++)
    •         total -= a[i];
    •     return total;
    • }

                • Find the Duplicate number on a given integer array?
                  • void printRepeating(int arr[], int size)
                  • {
                  •   int i, j;
                  •   printf(" Repeating elements are ");
                  •   for(i = 0; i < size; i++)
                  •     for(j = i+1; j < size; j++)
                  •       if(arr[i] == arr[j])
                  •         printf(" %d ", arr[i]);
                  • }

                • All pairs of Integer array whose sum is equal to a given number
                • Find How do you Find the Largest and smallest number in an unsorted Integer Array
                • Find Duplicate numbers in an array if it contains multiple duplicates
                • Remove Duplicates from an Array in a given place
                • Find multiple missing numbers in a given Integer Array with duplicates
                • How to rotate an Array Left and Right by a given number K?
                • Given an Array of Integers sorted in Ascending Order, Find the Starting and Ending position of a given value
                Write a program prints multiple for 2.5 without using arithmetic operations? 

                How the floating number is storing in a memory? 

                Linux boot sequence?
                what is the role of the 2nd stage bootloader?
                what is the size of the SRAM?
                what is the 1st process load in the kernel?
                what is the in-tree driver and the out- tree driver?
                how you load the in-tree driver and out-tree driver?
                IPC types?
                two threads communication?
                have u created any kernel threads? what is API used for Kthread?
                on the userspace thread what is the build command, we are using?
                what are Static libraries and dynamic libraries?
                what is NAND flash and Nor flash?
                socket?
                diff b/w SPI and I2C?
                explain flow on writing new kernel driver code? for example. driver for Rtc1234chip. 
                what are diff b/w RTOS and normal os?


                Other interview Question:

                Comments

                Popular posts from this blog

                Cryptography and Encryption Basics - I

                Overview of ISO/SAE 21434 Standard

                UDS Protocol Interview Question