C Programming Interview Questions PDF Download

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Courpedia courpedia courpedia courpedia courpedia

C Programming Interview Question and Answers

Here is the list of Frequently asked Interview questions on C


programming language.
courpedia
1. Who developed C Language?
Answer: Dennis Ritchie in 1972 at Bell labs.

2. Why C is called Structured Programming Language?


Answer: C language is called Structured Programming language
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

Courpedia courpedia courpedia courpedia courpedia


Courpedia courpedia courpedia courpedia courpedia

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.

C programming interview questions pdf

Courpedia courpedia courpedia courpedia courpedia


Courpedia courpedia courpedia courpedia courpedia

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
• C programming interview questions pdf

Answer: Syntax Error

10. What will be Output for the following Code?


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

}
return 0;

Courpedia courpedia courpedia courpedia courpedia


Courpedia courpedia courpedia courpedia courpedia
}

Output: 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;
}

Courpedia courpedia courpedia courpedia courpedia


Courpedia courpedia courpedia courpedia courpedia

Answer: There should be a {} in if and else statement or remove "


printf("Good"); ".

C programming interview questions pdf

C programming interview questions pdf

C programming interview questions pdf


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 b= pow(a,5);

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

Output: 322

15. What is Typecasting?

Courpedia courpedia courpedia courpedia courpedia


Courpedia courpedia courpedia courpedia courpedia

Answer: The process of converting Variable 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.

These are the most common C programming Interview


Question You Can Try some more questions to ace your Interview.

C programming interview questions pdf

C programming interview questions pdf

C programming interview questions pdf

C programming interview questions pdf

C programming interview questions pdf

C programming interview questions pdf

C programming interview questions pdf

C programming interview questions pdf

C programming interview questions pdf

C programming interview questions pdf

C programming interview questions pdf

C programming interview questions pdf

C programming interview questions pdf

C programming interview questions pdf

C programming interview questions pdf

Courpedia courpedia courpedia courpedia courpedia

You might also like