Top C Programming Interview Questions & Answers. last updated March .. The basic data types are int, char, and float. . Download PDF. C programming language was developed at Bell Laboratories in by Dennis Ritchie. C is structure/procedure oriented programming language whereas C++ is object oriented programming language. Polymorphism, virtual function, inheritance, Operator overloading, namespace concepts are. + Basic C Interview Questions and Answers, Question1: What are volatile systems etc offers individuals with great number of Basic C jobs for freshers as Look for Basic C jobs interview questions and answers page and understand the .

Basic C Interview Questions And Answers For Freshers Pdf

Language:English, Arabic, German
Genre:Personal Growth
Published (Last):27.04.2016
ePub File Size:29.35 MB
PDF File Size:19.61 MB
Distribution:Free* [*Sign up for free]
Uploaded by: SHERLYN

Frequently asked C interview questions with answers and detailed explanations for technical interviews in pdf. Download PDF to practice important C programs. The C programming language is a standardized programming language Visit for more Interview Questions with Answers. Page 2. C is the general and basic programming language that will create a base for other programming languages. Read Top C programming interview questions and answers. Download C programming interview questions PDF.

A linked list is composed of nodes that are connected with another.

C/ C++ Most Asked Questions in Interview for fresher 2019

In C programming, linked lists are created using pointers. Using linked lists is one efficient way of utilizing memory for storage. In C programming, there is a data structure known as queue. A queue represents a line wherein the first data that was stored will be the first one that is accessible as well. Binary trees are actually an extension of the concept of linked lists.

A binary tree has two pointers, a left one and a right one. Each side can further branch to form additional nodes, Explain Which each node having two pointers as well. All reserved words must be written in lowercase; otherwise the C compiler would interpret this as unidentified and invalid.

In the first expression, the increment would happen first on variable a, and the resulting value will be the one to be used. This is also known as a prefix increment.

In the second expression, the current value of variable a would the one to be used in an operation, before the value of a itself is incremented.

This is also known as postfix increment. C language is a case sensitive language. An endless loop can mean two things.

One is that it was designed to loop continuously until the condition within the loop is met, after Explain Which a break function would cause the program to step out of the loop.

Another idea of an endless loop is when an incorrect loop condition was written, causing the loop to run erroneously forever. Endless loops are oftentimes referred to as infinite loops.

A flowchart provides a visual representation of the step by step procedure towards solving a given problem. Flowcharts are made of symbols, with each symbol in the form of different shapes. You cannot use reserved words as a user-defined variable. One may think that INT is a reserved word and must not be used for other purposes.

Explain However, recall that reserved words are express in lowercase, so the C compiler will not interpret this as a reserved word. When you create and use functions that need to perform an action on some given values, you need to pass these given values to that function.

The values that are being passed into the called function are referred to as actual arguments. A newline escape sequence is represented by the n character.

This is used to insert a new line when displaying data in the output screen. More spaces can be added by inserting more n characters. For example, nn would insert two spaces.

A newline escape sequence can be placed before the actual output expression or after. It is the process of transferring data to an alternative output source other than the display screen. Output redirection allows a program to have its output saved to a file. These are errors that occur while the program is being executed.

One common instance wherein run-time errors can happen is when you are trying to divide a number by zero. When run-time errors occur, program execution will pause, sExplain Howing Explain Which program line caused the error. These 2 functions basically perform the same action, Explain Which is to get the absolute value of the given value. Abs is used for integer values, while fabs is used for floating type numbers.

Also, the prototype for abs is under , while fabs is under. In using functions in a C program, formal parameters contain the values that were passed by the calling function.

The values are substituted in these formal parameters and used in Explain Whatever operations as indicated within the main body of the called function. Control structures take charge at Explain Which instructions are to be performed in a program. Volatile variables get special attention from the compiler.

A variable declared with the volatile keyword may be modified externally from the declaring function. If the keyword volatile is not used, the compiler optimization algorithms might consider this to be a case of infinite loop. Declaring a variable volatile indicates to a compiler that there could be external processes that could possibly alter the value of that variable. Question 2. Explain The Meaning Of "segmentation Violation"?

A segmentation violation usually indicates an attempt to access memory which doesn't even exist.

The following code should create segmentation violation. When loading, the compiler places the string along with other constants in the read-only segment of the memory. And, compiler does not check for assigning read only locations at compile time. Question 3. What Is "bus Error"? A bus error indicates an attempt to access memory in an illegal way,perhaps due to an unaligned pointer. The cause for such error on a system could not be specified by the C language.

These errors caused by programs that generate undefined behavior which C language no longer specifies what can happen. Question 4. Define Recursion In C.? A programming technique in which a function may call itself. Any function can call any function including itself.

In this scenario, if it happens to invoke a function by itself, it is recursion. One of the instructions in the function is a call to the function itself, usually the last statement.

In some ways it is similar to looping. The process of calling a function by itself is known as recursion. Recursion is generally used when the result of the current function call is the input to the successive call of itself.

By definition, the factorial of the current digit is the factorial of its previous digit and the digit. In order to get the factorial of the previous digit, the same function should return the factorial. Thus the result of the previous execution of the function is one of the inputs of the current execution. The process continues until an exit condition returns true.

Top FREE Training Tutorials

Question 5. Static variable is available to a C application, throughout the life time. At the time of starting the program execution, static variables allocations takes place first.

In a scenario where one variable is to be used by all the functions which is accessed by main function , then the variable need to be declared as static in a C program. The value of the variable is persisted between successive calls to functions. One more significant feature of static variable is that, the address of the variable can be passed to modules and functions which are not in the same C file. This means a static variable is one that is not seen outside the function in which it is declared but which remains until the program terminates.

It also means that the value of the variable persists between successive calls to a function. The value of such a variable will remain and may be seen even after calls to a function. One more thing is that a declaration statement of such a variable inside a function will be executed only once. Question 6. The following are the differences between structures and arrays: Question 7.

Define Macros. A macro is a name given to a block of C statements as a pre-processor directive. Being a pre-processor, the block of code is communicated to the compiler before entering into the actual coding main function. A macro is defined with the preprocessor directive, define.

The advantage of using macro is the execution speed of the program fragment. When the actual code snippet is to be used, it can be substituted by the name of the macro. The same block of statements, on the other hand, need to be repeatedly hard coded as and when required. The disadvantage of the macro is the size of the program. The reason is, the pre-processor will replace all the macros in the program by its real definition prior to the compilation process of the program. Question 8. This value is passed as a constant or a variable with value.

The function can update the value available in the memory location by referencing the pointer. Question 9. Define Static Identifier In C?

This value can be used between function calls. The default value of an uninitialized static variable is zero. A function can also be defined as a static function, which has the same scope of the static variable.

Question What Are The Auto Variables? Where Are They Stored? The auto variables are stored in the main memory of the system. The keyword 'auto' is optional. Many of the variables used by the program or application are 'auto' variables, being the main memory is faster.

These variables are stored in the memory runtime stack. It is de-allocated at the completion of its block execution. It is a local variable which is allocated and deallocated automatically when the program flow enters and leaves the variable's scope. The difference between arrays and linked lists are: A set of named integer constants is known as an enumeration.

The enumeration type declaration includes the name of the enumeration tag and the definition of a set of named integers. Variables of enumeration type persists one of the existing values of the enumeration set.

The enum type variables could be utilized in indexing expressions, as operands of all arithmetic and relational operators. ANSI C enum expressions are always have int type, which occupies the memory space that occupied by the int type. The identifier sunday is explicitly assigned with 0. The remaining identifiers are given values 1 through 5 by default. The scope of a variable is specified by its storage allocation.

This is specified by the keywords — auto, extern, static and register.


The keyword typedef is used for defining user defined data types. A new definition of existing data types is created by using typedef.

It is used to define user defined identifiers which can be used in substitution of type specifiers such as int, float etc. It does not reserve memory space. The names defined by typedef are synonyms for the data types.

If Possible How? The fgets function is safer to use. It checks the bounds, i. The gets function does not check the bounds. The gets function is an insecure and careless use can lead to errors.

The function strcpy will not allocate the memory space to copy. A pointer to the string to copy and a pointer to place to copy it to should be given.

This memory space needs to be freed up later when it is of no use anymore. For char[] array, such size is not accepted by the compiler. Define Void Pointer? A void pointer is pointer which has no specified data type.

It is also known as a generic pointer.

The void pointer can be pointed to any type. If needed, the type can be cast. A void pointer is generally used as function parameters, when the parameter or return type is unknown. What Is A Const Pointer? A const pointer is not the pointer to constant, it is the constant. In the above example it is not, Hence it is not the pointer to constant.

The ptr can not be used to point to another integer. The integer pointed by ptr can be changed. The const pointer can not be changed to point to other memory location, because the pointer is constant. Explain Memory Leak?

C Interview Questions PDF and Answers Freshers Experienced

An unwanted increase in programs is referred to as a memory leak is C language. The intake of the program increases in the memory by an unintentional consumption of the memory. If the program is getting corrupted and results in errors, it means the memory leak. In case there is a leak by any program, the function of the system may stop and violate operating system files.You can then use it as PI in the program, instead of having to write 3.

Note that this function will only convert a single character, and not an entire string. It is the responsibility of the compiler to allow register variables. How to design your resume? Assuming that INT is a variable of type float, this statement is valid. The same block of statements, on the other hand, need to be repeatedly hard coded as and when required.

These variables are stored in the registers, so the speed of processing is become more than the normal variables.