Header Ads Widget

Trending

6/recent/ticker-posts

C Programming Interview Questions and Answer


C programming Interview Questions

Here in this blog, you will get C programming Interview questions and answers. C is the general-purpose, procedural programming language. It is compatible with all platforms and is one of the best programming languages for beginners in 2021. It is one of the most widely used programming languages. here are the most frequently asked C programming interview questions.


C Programming Interview Questions and Answer

 Although new languages with the Oops concept have become more common now a day yet use of C had not decreased. here is the most Frequently Asked Interview question on C programming Langauge. C Programming Interview Questions and Answer are as follows :

Frequently Asked C Programming Interview Questions and Answer




1. Who developed C Langauge?


Answer: Dennis Ritchie in 1972 at Bell labs.

2. Why C is called Structured Programming Langauge?


Answer:  C language is called Structured Programming Langauge because c performs the task in small modules called functions. The program can be divided into small logical functions for execution.


3.  Define  Keyword in C programming language?

Answer :
The keyword is the reserved words that have special meaning to the compiler. 
Example --  Int, char, float, etc.


4. Which of the following is not a Keyword in C?


  • Auto
  • Volatile
  • enum
  • Intern

Answer: Intern


5. What will happen if we include the header file two times in a C program?


Answer: The compiler will process the content twice and return an error.


6.Which of the following is an invalid variable name?

  
  • Int 
  • #num
  • $hello-world
  • sum%
  • salary
  • _courpedia

Answer : Int, #sum, $hello-world, sum%, _courpedia

Reason for the above Answer : 

(I)  A variable name cannot start with #and $ sign.
(II) Variable name cannot be the same as Keywords(int).


7. What is the difference between call By value and call By reference?

Answer :
Call By Reference: When an address of a variable(variable itself) is passed in the function then it is called Call by Reference.

Call By Value: When the Copy of a variable is passed through the function or value of the actual parameter is being copied to function ten this method of Calling is called the Call by value.


8. What is Recursion?


Answer:  Recursion is the process of calling of function Itself within that same function is called Recursion.

9.  C compiler Detects which Type of error?

  • Syntax Error
  • Run time error
  • logical error
  • semantic error

Answer: Syntax Error


10. What will be OutPut for the following Code?



#include<stdio.h>
int main()
{
    for(;;)
    {
printf(" Courpedia.com  is the best website");
break;
printf("Learn Programming with Courpedia");

    }
    return 0;
}


Output: Courpedia.com is the best website. 


11. What are the Features of the C preprocessor?


Answer: The use of a preprocessor expands the source code as per directives used in the source code.
Features of C Preprocessor are as follow:

(I) Macro Expansion
(II)  Conditional Operation
(III) Line Control
(IV) File Inclusion

12. What is the error in the following C code?



#include<stdio.h>
int main()
{
   int a=5;
   int b=2;
    if(a>b)
        printf(" A is greater "); 
        printf(" Good ");
        else
            printf(" a is not greater");
            printf(" Nice ");
        
    return 0;
}


Answer: There should be a {} in if and else statement  or remove " printf("Good"); ".


13. What is an Array?


Answer: Array is the data structure that stores the elements of the same datatype. It stores the data statically in the contiguous memory location.


14. What is the output of the following code?


#include<stdio.h>
#include<math.h>
int main()
{
  int a=2;
  int bpow(a,5);

  printf("%d"printf("%d",b));
}


Output: 322


15. What is Typecasting?


 Answer: The process of converting Varivale of one data type to the variable of another datatype is called Typecasting. As we use typecasting is we want to store float data in an int variable.

Download C Interview Questions PDF


                    These are the most common C programming Interview Question You can Try some more questions to ace your Interview. 

Best of Luck!