C Interview Questions and Answers - 15 Minutes - Free - Live Webinar

Register

To receive Webinar materials Register here

 

C Interview Questions and Answers



1. Pick out the odd one out of the following malloc() ,calloc() ,free() ,realloc() ?

Answer : free()..



2. What is the main difference between c and c++ ?

Answer : The main difference between c and c++ is...



3. Find the output of C Program ?

 main()
{
int x=20,y=35;
x = y++ + x++;
y = ++y + ++x;
printf("%d %d\n",x,y);
} ? 
Answer : While calculating the y value, x & y values are preincremtned, so x & y values are incremented...



4. What is the output ?

main () 
             {
             char *p1="Name"; 
             char *p2; 
             p2=(char *)malloc(20); 
             while(*p2++=*p1++); 
             printf("%s\n",p2); 
             } 
Answer : NULL...



5 . How to convert hexadecimal to binary using c language ?

Answer : To convert hexadecimal to binary using c language...



6. How to count alphabets, numeric and special characters ?

Answer : In this example, we have to count digits, spaces, special...

7. Difference between data structure and data base ?

Answer : Data Structure is about storing data...



8. Pattern programs in C ?

Answer : Pattern programs in C print various patterns of numbers and stars...



9. Write a program without using library functions ?

Answer : C Standard library functions are inbuilt functions in C programming...



10. Explain Call by Value in C language ?

Answer : In call by value, original value is not modified...



11. Explain Call by Reference in C language ?

Answer : In call by reference, original value is modified...



12. Write a C Program to Copy One String into Other Without Using Library Function ?

Answer : Copy String Manually Without Using strcpy()...



13. How to find LCM of two Numbers in C ?

Answer : The LCM of two numbers a and b is the smallest positive integer that is perfectly divisible...



14. How to check wheather the number is Palindrome or not in C ?

Answer : If we reverse a numbers, the number remains the same it is said to be the palindrome number...



15. How to check a Number is Prime or not in C ?

Answer : A Prime Number can be divided only by 1, or itself...



16. How to write a Fibonacci Series program in C ?

Answer : The Fibonacci sequence is a set of numbers that starts with a 1 or 0, followed by a 1...



17. How to find the Greatest Common Divisor(GCD) in C ?

Answer : GCD(Greatest Common Divisor) of two or more numbers, which are not all zero...



18. How to write a program to reverse a string in C ?

Answer : This program reverses a string that a user inputs...



19. How to check if a number is palindrome or not ?

Answer : If we reverse a numbers, the number remains the same...



20. How to find two element whose sum is closet to zero ?

Answer : Element whose sum is closet to zero is also called minimum absolute sum pair...



21. What is the output of this C code ?

Function main() {
  integer a = 5, b = 7
  Switch(a) {
    Case 5: print "I am 5"
    Break
    Case b: print "I am not 5"
    Break
    Default: print "I am different"
  }
}

A. I am 5

B. I am not 5

C. I am different

D. Error

E. None of these

Answer : D. Error




22. What is the output of this C code ?

Function main() {
  Integer i = 0.7 Static float m = 0.7
  If(m equals i)
  Print(“We are equal”)
  Else
  If(m > i)
  Print(“I am greater”)
  Else
  Print(“I am lesser”)
}

A. We are equal.

B. I am greater.

C. I am lesser.

D. This code will generate an error.

Answer : D. This code will generate an error




23. Find the output :

Function modify (a , b) 
{
      Integer c , d = 2 
      c= a * d + b 
      return c 
}

Function calculate () 
{
     Integer a = 5, b = 20, c 
     Integer d = 10 
     c = modify (a, b); 
     c = c + d 
     Print c
 }

A . 80

B . 40

C . 32

D . 72

Answer : B . 40





Related Searches to C Interview Questions and Answers