Presentation is loading. Please wait.

Presentation is loading. Please wait.

C Interview Questions Prepared By:.

Similar presentations


Presentation on theme: "C Interview Questions Prepared By:."— Presentation transcript:

1 C Interview Questions Prepared By:

2 What is C? C is a programming language developed at Bell Labs by Dennis M. Ritchie. In Most of the Unix kernels are written in C.

3 2. What are the features of C programming language?.
Simple Portable Mid level Structured Fast in speed Memory management Extensible

4 3. What is the use of printf() and scanf() functions?
The printf() function is used to print the output of the program on the standard output device i.e. monitor or any other display unit. The scanf() function is used to take input from the user from a standard input device i.e. the keyboard.

5 4. What is local and global variable?
A local variable can be defined as the variable which is defined inside a function. The lifetime of a local variable is only within the function. A global variable can be defined as the variable which is defined out side a function and inside a class. The lifetime of global variable is inside the whole program.

6 5. What is static variable in C?
A static variable in C is the variable which retains it’s value inside a function. If a static variable is called many times from inside a function then it will be retained.

7 6. What are arrays in C? An array in C is the group of elements. All the elements in array are homogeneous.

8 7. What are the advantages of C?
Code Optimization: Less code to the access the data Easy to traverse data: By using the for loop, we can retrieve the elements of an array easily. Easy to sort data: To sort the elements of array, we need a few lines of code only. Random Access: We can access any element randomly using the array.

9 8.  What is dangling pointer in C?
If a pointer is pointing to a memory location and meanwhile some other pointer deletes the memory occupied by the first pointer and after deletion also the first pointer is pointing to the memory location then the first pointer is called as dangling pointer and this problem is known as dangling pointer problem.

10 9. What is Dynamic Memory Allocation?
Dynamic memory allocation is a process of allocating the memory to the program at runtime.

11 10. What is structure? Structure is a user defined datatype that allows the user to store multiple data in a single unit element.

12 11.What is a null pointer? There are times when it's necessary to have a pointer that doesn't point to anything. The macro NULL, defined in <stddef.h>, has a value that's guaranteed to be different from any valid pointer. NULL is a literal zero, possibly cast to void* or char*. Some people, notably C++ programmers, prefer to use 0 rather than NULL.

13 12.When is a null pointer used?
The null pointer is used in three ways: 1. To stop indirection in a recursive data structure. 2. As an error value. 3. As a sentinel value. 1. Using a Null Pointer to Stop Indirection or Recursion

14 13.Is NULL always defined as 0(zero)?
NULL is defined as either 0 or (void*)0. These values are almost identical; either a literal zero or a void pointer is converted automatically to any kind of pointer, as necessary, whenever a pointer is needed (although the compiler can't always tell when a pointer is needed).

15 14.What is the difference between getch() and getche()?
The getch() function reads a single character from keyboard. It doesn't uses any buffer, so entered data is not displayed on the output screen. The getche() function reads a single character from keyword but data is displayed on the output screen. Press Alt+f5 to see the entered character.

16 15.What is auto keyword in C?
In C, every local variable of a function is known as automatic (auto) variable. Let's explain with an example: void f()   {   int i ;   auto int j;   }  

17 Thank You


Download ppt "C Interview Questions Prepared By:."

Similar presentations


Ads by Google