Saturday, June 19, 2021
Home interview preparation 50+ Most Asked C programming Question.

50+ Most Asked C programming Question.

Dear User,if you are preparing for interviews looking for most asked c interview question,so you landed on right platform
here we will provide you top 50+ question with answer which help you to crack any interviews easily.

1) What is C language?


C is very popular programming language which is used for both system programming like building operating system as well as Application programming like building a menu driven costumer bill system.

2) Who is the founder of C language?


Dennis Ritchie.

3) when it was developed?


it was developed in 1972 at bell laboratories of AT&T.

4) what are the key feature of C programming?


Feature of C programming language are as follow:

  • it is platform independent language.
  • it followed a structured approach which mean program can be splits into parts .
  • it is very fast to execute any operation .
  • it is extensive programming language which mean it have capability to adopt new feature.
  • it is midlevel programming language because it binds the lowlevel and high level language together.

5) What are the basic Datatypes supported in C Programming Language?


Basic Datatypes in C programming language are as follows:

  • int-it basically represent integers or number.
  • float-it represent decimal value.
  • double-it represent double precision of floating point value.
  • char-it represent character .

6) What is the use of printf() and scanf() functions?


These are the two most important term used more often while printing and taking input from user.

  • printf()-it is used to print the integer,character,float value on the computer screen.
  • scanf()-it is used to take input from the user.

7) What are the various Keywords used in C?


there are 32 keywords present in c programming language.


8) What are reserved words in c ?


Reserved words are those word which cannot be used as an is something which has no meaning.

9) what is variable


Variable is a name which is given to a memory location, the value of variable can be changed and reused multiple times.

10)what is local and global variable


Local variable-A variable that is declared inside a function or particular block is called as local variable.

Global Variable-A variable that is declared outside the block or function is called global variable.

11)what is constants


constant is a variable which value cannot be changed throughout the program.

it is represented using const keywords.

12)Difference between malloc() and calloc() functions?

1-malloc stands for memory allocation.1-calloc stands for contigous allocation.
2-malloc is faster than calloc2-calloc is faster than malloc
3-it allocate a single block of memory specific size.3-it allocates a multiple block of memory same size.
4-it is not safe as of calloc.4-it is safe as compare to malloc.

13)what is pointer


Pointer is a variable which store the address of another variable.The variable that store the address value is known as pointer.

14)how to use pointer in c?


To access the address of a variable we use &(ampersand) operator that return the address of variable.

15)list some pointer types?


There are various type of pointer in c programming which are as follow:

  • Null Pointer
  • Dangling Pointer
  • Void Pointer
  • wild Pointer

16)what is null pointer?


A pointer which point to nothing which mean pointing to a NULL value is called NULL pointer.if we assign a value ‘0’ to any kind of pointer that will become NULL pointer.

17)what is dangling pointer?


A pointer which point to a memory location that is already deleted by some other pointer is called dangling pointer.

18)what is void pointer?


A pointer which point to a memory location which does not have any specific type is called as void pointer.

19)what is wild pointer?


A pointer which is not pointing to anythings not even NULL is called Wild pointer.

20)what is scope of variable?


A scope of variable refer to the visibility of program .there are basically two type of scope of variables ,one is global scope variable which is accessed throughout the program. and another is local scope variabe which is accessed inside a particular block or function.

21)how will you print (“hello world”) without semicolon?


 int main()    
 if(printf("hello world"))
return 0;  

22)what is static variable?


Static variable are those variable who have ability to retain their value even when they are out of scope.

23)what is static function?


Static function are those function which can be called even when an object is not initialized can access only static variable.

24)What is difference between i++ and ++i?


The i++ statement first return the value then increment the value of i.

where the ++i first increment the value then return value of i.

25)what is difference between array and pointer?


Array is a data structure which store the values of similar data type where pointer is a variable which store the address of one variable.

26)what is difference between call by value and call by references?


call by value call by references
1-original value will not modified when copy of function is passed to function.1-original value will be modified when copy of function is passed to function.
2-actual and formal argument store in different memory location.2-actual and formal argument store in same memory location.
3-copy of actual argument are passed to formal argument.3-memory address of actual argument are passed to formal argument.

27)What is the main difference between the Compiler and the Interpreter?


1-compiler takes whole program as input1-interpreter takes single instruction as input
2-memory requirement is more2-memory requirement is less.
3-Example:C compiler3-Example :BASIC

28)what is volatile keyword?


volatile keyword applies on variable,which tells the compiler that value may change at any time.

29)What is the difference between the = symbol and == symbol?


= symbol used to assign a value to the variable.where == symbol is used as comparison operator to compare values.

30)what is recursion in c?


when a function call itself is called recursion.and the corresponding function is called recursive function.

31)what is function in c?


Function is block of code which is used to perform a specfic task.we can acheive reusability by using function so that we can call the same block of code multiple times.

32)what is nested loop?


The loop inside another loop is called a nested loop.

33)what is array?


Array is a data structure which is used to store element in contigous manner of same data type.

34)what is pointer to pointer in c?


when first pointer point to memory location of variable and the second pointer point to the first pointer memory location.this process is called as pointer to pointer .

35)what is structure?


Structure is a group of one or more variable of same or diffrent data types bind together under a same name which create a new data type.

it is way of grouping variable of disimilar data type.

36)what is difference between structure and union?


1-keyword struct is used to declare a structure.1-keyword union is used to declare union.
2-individual member can be accessed at a time.2-only one memebr can be accessed at at a time.
3-it does not share their memory 3-element share their memory.
4-size of structure is equal to sum of sizeof each element. 4-size of union is equal to the size of largest element.

37)Can I use “int” data type to store the value 32768? Why?


No, int data type can only hold value between range of -32768 to hold value of 32768 we have to use long int data type.

38)what is major differences between for and while loop?


For loopWhile loop
1-when number of iteration is known we use for loop.1-when number of iteration is not known we use while loop.
2-if the condition is not specified ,it will be a infinite loop.2-if teh condition is not specified ,it will produce compilation error.
3-once the statement is executed ,then increment is done.3-increment can be done anytime before or after execution of statement.

39)what is memory leak in c?


memory leak happens when we forgot to remove a memory location which is not in use anymore.

40)what is difference between while(0) and while(1)?


while(1) refers to an infinite loop which mean program will run infinitely till any break statement appears. where while(0) refers to the condition which always be false and code will never going to execute .

41)How to create increment and decrement statement in C?


Increment statement mean incrementing variable by certain value where decrement statement mean decrementing variable by certain value.

42)How to swap two numbers without the use of the third variable?


By using xor operator.

using namespace std;
int main()
 int a,b;
 cout<<"before swapping"<<endl;
 cout<<"a: "<<a<<endl;
 cout<<"b: "<<b<<endl;
 cout<<"after swapping"<<endl;
 cout<<"a: "<<a<<endl;
 cout<<"b: "<<b<<endl;

43)what is auto keywords?


The keyword auto tells that the particular variable will not be accessible outside the function,all the local variables are called as auto variable because they are not accessible outside the block.

44)Can we compile a program without main() function?


Yes we can compile a program but cannot be executed

45)What is the difference between getch() and getche()?


getch() keyword reads a single character but doesnot display the the value.where getche() keyword reads a single character as well as display the value.

46)What is typecasting?


the process of conversion of a variable of one data type to another data type is called typecasting.

47)what are macros?


Macros is a segment of code that has assigned a is defined by #directives.

48)what is preprocessor?


Preprocessor is a macro processor which tells the compiler to preprocess the code before actual compilation.

49) When is the “void” keyword used in a function?


the void keyword tells us that the function is not going to return any value.

50)what is sequential file access?

Answer:In sequential file access we will access the record in an sequence order,one after the another .

51)What is Dynamic Memory allocation?.


When the size of memory is defined during runtime this kind of allocation of memory is called dynamic memory allocation.



Please enter your comment!
Please enter your name here

- Advertisment -

Most Popular

Recent Comments