C Interview Questions and Answers For Freshers/ Experienced
Posted by Raj
C Interview Questions and Answers For Freshers / Experienced - Important Quiz
In this section, I have selected Basic and Important C interview questions and answers for all levels of candidates(Fresher level, advanced level,experienced level).
Last few months I have been working to select best question and answer set for C interview questions.
Here is some Important C Interview Questions and Answers for freshers and experienced:
1.Can we have a pointer to a pointer in C?
Answer: Yes
char *a; - Pointer to a character
char **a; - Pointer to a pointer
2.How to convert strings in c to corresponding Integer?
Answer:
atoi() function convert a string into corresponding integer value.use stdlib.h header file.
3. C Data types?
Answer :Int, char, float, void etc. are predefined basic primitive data types.Structures and Unions are user defined data types.
4.Find the output of the following program?
#include
main()
{
int i=10;
printf("%d",++i);
printf("%d",i++);
printf("%d",(i++*i++))
}
5.Octal literal in C?
#include
main()
{
int i=020;
printf("i is %d",i);
}
Output:16
Answer :
In c and c ++ language 0 (zero) is the octel literal so it will print its Octel representation of 16.
6.Whats is difference between file descriptor and file pointer?
7.Two forms of #include directive?
Answer :
1.#include”filename”
2.#include
8.Find the output of the following program?
#include
main()
{
int str=0;
if(str==0)
printf("True");
printf("False");
}
Answer :
True
False
9.Find the output of the following program?
#include
main()
{
int x=0;
if(x==0)
printf("True");
else
printf("False");
}
Answer :
True
10.What will be the Output of the following program?
#include
main()
{
int i=50, j=100;
i = j++;
j = ++j;
printf("%d %dn",i,j);
}
Answer :
51, 101
11.What will be the Output of the following program?
#include
main()
{
int i = 10;
printf("%d", main||i);
}
Answer :
1
12. Write a Program to convert decimal to binary number?
Answer :
#include
main()
{
int x,y,n,arr[50];
clrscr();
printf("Enter the decimal number");
scanf("%d",n);
for(x=0;x
{
arr[x]=n%2;
n=n/2;
}
for(y=n;y>0;y--)
{
printf("%d",arr[y]);
}
getch();
}
In this section, I have selected Basic and Important C interview questions and answers for all levels of candidates(Fresher level, advanced level,experienced level).
Last few months I have been working to select best question and answer set for C interview questions.
Here is some Important C Interview Questions and Answers for freshers and experienced:
1.Can we have a pointer to a pointer in C?
Answer: Yes
char *a; - Pointer to a character
char **a; - Pointer to a pointer
2.How to convert strings in c to corresponding Integer?
Answer:
atoi() function convert a string into corresponding integer value.use stdlib.h header file.
3. C Data types?
Answer :Int, char, float, void etc. are predefined basic primitive data types.Structures and Unions are user defined data types.
4.Find the output of the following program?
#include
main()
{
int i=10;
printf("%d",++i);
printf("%d",i++);
printf("%d",(i++*i++))
}
5.Octal literal in C?
#include
main()
{
int i=020;
printf("i is %d",i);
}
Output:16
Answer :
In c and c ++ language 0 (zero) is the octel literal so it will print its Octel representation of 16.
6.Whats is difference between file descriptor and file pointer?
7.Two forms of #include directive?
Answer :
1.#include”filename”
2.#include
8.Find the output of the following program?
#include
main()
{
int str=0;
if(str==0)
printf("True");
printf("False");
}
Answer :
True
False
9.Find the output of the following program?
#include
main()
{
int x=0;
if(x==0)
printf("True");
else
printf("False");
}
Answer :
True
10.What will be the Output of the following program?
#include
main()
{
int i=50, j=100;
i = j++;
j = ++j;
printf("%d %dn",i,j);
}
Answer :
51, 101
11.What will be the Output of the following program?
#include
main()
{
int i = 10;
printf("%d", main||i);
}
Answer :
1
12. Write a Program to convert decimal to binary number?
Answer :
#include
main()
{
int x,y,n,arr[50];
clrscr();
printf("Enter the decimal number");
scanf("%d",n);
for(x=0;x
{
arr[x]=n%2;
n=n/2;
}
for(y=n;y>0;y--)
{
printf("%d",arr[y]);
}
getch();
}
Top Important C FAQs and Interview Questions
- What is the difference between strings and character arrays?
- Differences between pass by reference and pass by value?
- What does static variable mean?
- What is the use of semicolon at the end of every statement?
- What is a null pointer?
- What is a pointer?
- When would you use a pointer to a function?
- What are the uses of a pointer?
- In header files whether functions are declared or defined?
- What are the differences between malloc () and calloc ()?
- What is the heap?
- What is the stack?
- Difference between const char* p and char const* p?
- What is a structure?
- What is a union?
- What is Operator overloading ?
- What is a void pointer?
- What is hashing?
- What are the different storage classes in C?
- What are the differences between structures and union?
- What is the difference between calloc() and malloc()?
- What are the differences between structures and arrays?
- What is the difference between printf() and sprintf()?
- What is static memory allocation and dynamic memory allocation?
- Define recursion in C?
- What is the use of typedef?
- How are pointer variables initialized?
- What are the advantages of auto variables?
This entry was posted on October 4, 2009 at 12:14 pm, and is filed under
Basic,
C interview questions,
C Languages interview questions,
C Quiz,
important,
Mostly asked C interview questions list,
Multiple Choice
.You can leave a response, or trackback from your own site.