List of all C interview questions in this blog


bug

All the Material available on this site is absolutely Free! Please support us by subscribing via email.

Enter your email below

We do not sell your email or spam.

Go to Downloads Page to download all the C interview question and answers as a pdf.

  1. What does a static variable mean?
  2. What is a pointer?
  3. What is a structure?
  4. How to print a pattern as shown below?
     1
     2 3
     4 5 6
     7 8 9 10
  5. How to swap two numbers using bitwise operators?
  6. What is recursion? Write a program using recursion (factorial)?
  7. To which numbering system, can the binary number 1101100100111100 be easily converted to?
  8. What are the differences between structures and unions?
  9. What are the advantages of using unions?
  10. What is scope & storage allocation of global and extern variables? Explain with an example.
  11. What is scope & storage allocation of static, local and register variables? Explain with an example.
  12. What is Pass by Value? Write a C program showing this concept.
  13. What is Pass by Reference? Write a C program showing this concept.
  14. What is an Enumeration?
  15. What is the use of typedef?
  16. What are register variables? What are advantages of using register variables?
  17. What are storage memory, default value, scope and life of Automatic and Register storage class?
  18. What are storage memory, default value, scope and life of Static and External storage class?
  19. What are the advantages of using pointers in a program?
  20. Which bitwise operator is suitable for checking whether a particular bit is ON or OFF?
  21. Which bit wise operator is suitable for turning OFF a particular bit in a number?
  22. What do the ‘c’ and ‘ v ‘ in argc and argv stand for? Explain their purpose?
  23. What are the differences between malloc() and calloc()?
  24. Where are the auto variables stored?
  25. Out of fgets( ) and gets( ) which function is safer to use and why?
  26. How can you increase the size of a dynamically allocated array?
  27. Write a program to check whether a given number is even or odd.
  28. Write a program to find the greatest of three numbers.
  29. Write a program to check whether a given number is a prime.
  30. Write a program to find the greatest among ten numbers.
  31. Write a program to swap two numbers using a temporary variable.
  32. Write a program to swap two numbers without using a temporary variable.
  33. How to swap two numbers using bitwise operators?
  34. Write a program to check whether a given number is a palindromic number.
  35. Write a program to check whether a given string is a palindrome.
  36. Write a program in C to print “Hello World” without using semicolon anywhere in the code.
  37. Write a program in C to print a semicolon without using a semicolon anywhere in the code.
  38. Write a program in C to delete a specific line from a text file.
  39. Write a program in C to replace a specified line in a text file.
  40. Write a program in C to find the number of lines in a text file.
  41. (i)What are the differences between the C statements below: char *str = “Hello”;char arr[] = “Hello”;

    (ii)Whether following statements get complied or not? Explain each statement.

    arr++;

    *(arr + 1) = ‘s’;

    printf(“%s”,arr);

  42. Explain the variable assignment in the declaration int *(*p[10])(char *, char *);
  43. What is the value of sizeof(a) /sizeof(char *) in C code snippet below char *a[4]={“sridhar”,”raghava”,”shashi”,”srikanth”}; explain
  44. Write a program in C that returns 3 numbers from a function.
  45. In below code snippet:
    struct Date

    {

    int yr;

    int day;

    int month;

    } date1,date2;

    date1.yr = 2004;

    date1.day = 4;

    date1.month = 12;

    Write a function in C that assign values to date2. Arguments to the function must be pointers to the structure Date and integer variables date, month, year.

  46. What are header files? Are functions declared or defined in header files ?
  47. What is the difference between the functions strdup and strcpy in C?
  48. What is difference between for loop and while loop in C language?
  49. Write down the equivalent pointer expression for referring the same element as a[i][j][k][l].
  50. Which one is equivalent to multiplying an unsigned int by 2, left shifting by 1 or right shifting by 1?
  51. Declare an array of three function pointers where each function receives two integers and returns float.
  52. Write a program to compare two strings without using strcmp() function.
  53. Write a function to concatenate two strings without using strcat function.
  54. Write a program to generate the fibonacci series

  55. Write a C program which asks the user for a number between 1 to 9 and shows the number. If the user inputs a number out of the specified range, the program should show an error and prompt the user for a valid input.
  56. Write a program to display the multiplication table of a given number.
  57. Write C program to print the following pattern:
             1
            2 2
           3 3 3
          4 4 4 4
         5 5 5 5 5
    
  58. Write C program to print the following pattern:
             1
           1 2 1
         1 2 3 2 1
       1 2 3 4 3 2 1
     1 2 3 4 5 4 3 2 1
    

  59. Write a C program to display the following format:
     ------
      a b
     ------
      1 5
      2 4
      3 3
      4 2
      5 1
     ------
    
  60. Write a C program to display the following format:
     --------
     no. sum
     --------
      1  1
      2  3
      3  6
      4  10
      5  15
     --------
    
  61. What is the purpose of main() function?
  62. What is the difference
    between declaring a variable and defining a variable?
  63. What are the differences
    between formal arguments and actual arguments?
  64. What is difference between
    getchar and scanf functions for reading strings?
  65. What is difference between
    ‘break’ and ‘continue’ statements?

C Interview Questions with solutions ebook as a pdf/doc/html


About the Author:  Sridhar Jammalamadaka is the Editor of Interview Mantra. He's a typically non-typical Software Engineer from Pune, India. He likes entrepreneurship, web technologies and Micro Controller programming. He enjoys playing cricket and piano (but rarely does these activities). Through this website, he wishes to gather a large community of aspiring engineers, entrepreneurs and professionals from all parts of the globe. You can connect with him on Facebook - http://www.facebook.com/sridhar.j



All comments of post - "List of all C interview questions in this blog":

:Haha! I'am the first! Yeh~

Thank you!

Add a Comment / Trackback url

  1. #4  MayaNo Gravatar

    Loved your questions ! thanks for putting them together.

    10/05/21 07:09
  2. #3  adminNo Gravatar

    @Ashok,
    The value returned from the main() is sent to the host environment or the parent process that calls your program. The parent might need to follow different paths depending on the success or failure of your program. Hence, one must always return a value from the program that returns its status back to the callee.

    return 0 means that the program was executed successfully, return 1 means that the program was terminated abruptly. 1 is returned when something goes wrong in the program execution.

    return 2 is same as return 1. For that matter, any non-zero value.

    Does this answer your question? Feel free to ask.

    10/03/06 23:05
  3. #2  AshokNo Gravatar

    there are 2 cases : 1. return 0; & return 1; at a time OR
    2.return 1,0;
    these are valid ! then please give me difference between both and when are they used?

    10/02/18 22:31
  4. #1  ShraddhaNo Gravatar

    I was asked at the TCS interview:
    How will you write a macro for declaring a 4byte number while using an 8bit processor?
    I do know there’s typecasting involved but I stumbled while writing the syntax.
    Please ans this if u know Sridhar.

    Regards,
    Shraddha

    09/12/24 11:33

Show all Show 5 so far Close all

Comment begin from here or jump up!


All trackbacks / pingbacks of the post "List of all C interview questions in this blog":

http://www.interviewmantra.net/2008/11/list-of-all-c-interview-questions-in.html/trackback