C programming coding interview questions and answers

Q.Who developed C Programming Language?

 Dennis Ritchie at AT & T’s Bell Laboratories in 1972.

Q. What is that means of constant in C?

 Constant is an entity whose remains fixed.  

Q. What are the key points in the C programming language?  

Portability: It is a platform-independent language.

Modularity: Possibility to break down massive applications into small modules.

Flexibility: The opportunity of a programmer to manage the language.

Speed: C comes with aid for device programming and subsequently it compiles and executes with excessive pace when in contrast with different high-level languages.

Extensibility: Possibility to add new facets via the programmer

Q. What are the basics data type related to C?

Int – Represent the quantity (integer)

Float – Number with a fraction part.

Double – Double-precision floating-point value

Char – Single character

Void –  Special purpose type without any value.

Q. What is a variable in C?

 A Variable is an entity that acts as a storage area for a value.

ex. int a = 20;

here, a is variable 

Q. What is the description for syntax errors?

The mistakes/errors that manifest whilst growing an application are referred to as syntax errors. Misspelled instructions or mistaken case commands, a mistaken quantity of parameters in calling technique /function records kind mismatches can be recognized as frequent examples for syntax errors.

Q. What is the technique to create increment and decrement assertion in C?

There are two techniques to operate this task.

Use increment (++) and decrement (-) operator.

Example When x=4, x++ returns 5 and x- returns 3.

Use traditional + or – sign.

Example When x=4, use x+1 to get 5 and x-1 to get 3.

Q. What are reserved keywords with a programming language?

The keyword that is a phase of the popular C language library is referred to as reserved words. That reserved keyword has specific means and it is now not viable to use them for any exercise different than its supposed functionality.

Example: void, return int. 

Q. What is the explanation for the dangling pointer in C?

When there is a pointer pointing to a memory address of any variable, however after some time the variable used to be deleted from the memory address whilst maintaining the pointer pointing to that area is acknowledged as a dangling pointer in C.

Q. Describe static function with its usage?

A function, which has a function definition prefixed with a static key-word is described as a static function. The static feature must be referred to as inside the equal supply code. 

Q. What is the distinction between ++a and a++?

‘++a”  is known as prefixed increment and the increment will take place first on a variable. ‘a++’ is referred to as postfix increment and the increment takes place after the cost of a variable used for the operations.

Q. Describe the distinction between = and == symbols in C programming?

 ‘==’ is the comparison operator which is used to compare the value of the expression on the left-hand facet with the cost or expression on the right-hand side.

‘=’ is the task operator which is used to assign the value of the right-hand side to the variable on the left-hand side.

Q. What is a pointer on a pointer in the C programming language?

 A pointer variable that consists of the address of every other pointer variable is referred to as a pointer on a pointer. This idea de-refers twice to factor to the statistics held with the aid of a pointer variable.

In this instance **y returns the value of the variable a. 

Q. What is a sequential access file?

General applications save the information into archives and retrieve present records from files. With the sequential get right of entry to file, such statistics are saved in a sequential pattern. When retrieving information from such archives every statistic is examined with the aid of one till the required data is found. 

Q. What is the approach to store information in a stack data structure type?

 Data is saved in the Stack information shape kind the usage of the First In Last Out

(FILO) mechanism. Only the pinnacle of the stack is available at a given instance. Storing mechanism is referred to as a PUSH and retrieve is referred to as a POP. 

Q. Describe the modifier in C?

The modifier is a prefix to the primary information kind which is used to point out the change for storage space allocation to a variable.

Example– In a 32-bit processor, the storage area for the int records kind is 4.When we use it with modifier the storage space exchange as follows:

Long int: Storage space is 8 bit

Short int: Storage area is two-bit 

Q. Describe the newline break-out of the sequence with a pattern program?

The Newline getaway sequence is represented by way of n. This shows the factor that the new line starts to the compiler and the output is created accordingly. The following pattern application demonstrates the use of the new line break-out sequence.

Code:

/*

C Program to print string

*/

#include <stdio.h> #include <string.h>

int main(){

printf(“String 01 “);

printf(“String two “);

printf(“String three n”);

printf(“String 01 n”);

printf(“String two n”);

return 0;

}

</string.h></stdio.h> 

Q. Explain comments in C?

Comments are the consumer-described statements that ensure better

readability and make code greater understandable. Comments are ignored by the compiler. Comments can be a single line or even multi-line.

Q.What are Tokens?

 Token refers to the smallest lexical unit of a program. It may also be a

identifier, keyword, constant, etc. 

Q. What is a Pointer?

The pointer is a distinctive kind of variable that holds the memory address of another variable.

It is denoted as * (var_name) 

Q. Explain printf, sprintf, fprintf ?

printf : standard output stream (stdout)

fprintf : prints content in the file

sprintf : prints formatted output into a char array.

Q. What is an Array?

The array is a linear data structure having a collection of homogenous data items.

Leave a Reply

Your email address will not be published. Required fields are marked *