KEMBAR78
C programming interview questions | PPTX
Q.1: What is C language
    in your opinion?
 Developed by Dennis Ritchie
 between 1969 & 1973.
 Developed at the Bell
 Laboratories, aimed to use with
 UNIX OS.
 Widely used for developing
 application software, though it
 was mainly invented for
 developing system software.
Q.2: What is a static
variable in context of C
      language?
 Declared inside a function.


 Declared for function name.


 Declared for Global parameters.
Q.3: Can you explain the
 difference between a
 normal variable and a
        pointer?
 A normal variable can have any value

 and can be changed throughout the
 length of the program.


 A pointer defines the address where

 another variable is stored and not any
 value.
Q.4: What is the
     difference
between calloc() and
     malloc()?
 malloc() will create single block of memory of
  size specified by the user.
 Example - p=(int*)malloc(sizeof(int)*5)


 calloc() takes two arguments and zero initializes
  the memory. It can assign multiple blocks of
  memory for a variable.
 Example - p=(int*)calloc(5,sizeof(int)*5)
Q.5: What is the
difference between printf()
       and sprint()?
 Printf() outputs the data to the standard

 output device which is usually the
 computer monitor.
 Sprint() outputs the data to a character

 array.
Q.6: Which is the fastest
sorting method you can
use while programming in
c language?
This is a question which falls into “There is no
one-size-fits-all answer” category. But few
options are-

 Quick sort.
 Radix sort.
 Merge sort.
Q.7: Is using functions or
  macros better when
  programming in C?
 Macros are generally more efficient and
 faster.

 Macros cannot handle complex programming
 constructs and in such cases functions are
 used

 We can choose macros or functions based on
 our priority - speed vs. size of program.
Q.8: What is a Stack?
 Stack is where information required to call

 and return function resides
 It also stores a functions local variable

 Stack follows a FIFO model
Q.9: What is the
difference between C and
           C++?
 C++ is an advanced version of C which
 introduced a lot of new features like
 classes and so on.

 It’s much more object oriented compared to
 the general purpose programming C was
 initially created for.
Q.10: Is it good to use
goto statement?
 goto statements are used to implement a
 local jump during program execution.

 It is not considered a good practice to use
 goto statements and should be avoided as
 much as possible.
For more C++ gyan, log on
           to-
    YourNextLeap.com

C programming interview questions

  • 2.
    Q.1: What isC language in your opinion?
  • 3.
     Developed byDennis Ritchie between 1969 & 1973.  Developed at the Bell Laboratories, aimed to use with UNIX OS.  Widely used for developing application software, though it was mainly invented for developing system software.
  • 4.
    Q.2: What isa static variable in context of C language?
  • 5.
     Declared insidea function.  Declared for function name.  Declared for Global parameters.
  • 6.
    Q.3: Can youexplain the difference between a normal variable and a pointer?
  • 7.
     A normalvariable can have any value and can be changed throughout the length of the program.  A pointer defines the address where another variable is stored and not any value.
  • 8.
    Q.4: What isthe difference between calloc() and malloc()?
  • 9.
     malloc() willcreate single block of memory of size specified by the user.  Example - p=(int*)malloc(sizeof(int)*5)  calloc() takes two arguments and zero initializes the memory. It can assign multiple blocks of memory for a variable.  Example - p=(int*)calloc(5,sizeof(int)*5)
  • 10.
    Q.5: What isthe difference between printf() and sprint()?
  • 11.
     Printf() outputsthe data to the standard output device which is usually the computer monitor.  Sprint() outputs the data to a character array.
  • 12.
    Q.6: Which isthe fastest sorting method you can use while programming in c language?
  • 13.
    This is aquestion which falls into “There is no one-size-fits-all answer” category. But few options are-  Quick sort.  Radix sort.  Merge sort.
  • 14.
    Q.7: Is usingfunctions or macros better when programming in C?
  • 15.
     Macros aregenerally more efficient and faster.  Macros cannot handle complex programming constructs and in such cases functions are used  We can choose macros or functions based on our priority - speed vs. size of program.
  • 16.
    Q.8: What isa Stack?
  • 17.
     Stack iswhere information required to call and return function resides  It also stores a functions local variable  Stack follows a FIFO model
  • 18.
    Q.9: What isthe difference between C and C++?
  • 19.
     C++ isan advanced version of C which introduced a lot of new features like classes and so on.  It’s much more object oriented compared to the general purpose programming C was initially created for.
  • 20.
    Q.10: Is itgood to use goto statement?
  • 21.
     goto statementsare used to implement a local jump during program execution.  It is not considered a good practice to use goto statements and should be avoided as much as possible.
  • 22.
    For more C++gyan, log on to- YourNextLeap.com