C Interview Questions and Answers

What is C language?

C is a high-level programming language and first developed in 1972 by Dennis Ritchie and Ken Thompson at AT& T Bell Labs.

Why C is sometimes called a mid-level programming language?

C supports both low-level (machine) and high level programing that is why it is also known as a mid-level programming language.

What are the advantages and disadvantages of C language?

Advantage and disadvantage of C are
Advantages
It is a high-level programming languages that is closer to human languages, especially English.
C programs can be reused, by saving into a library file and invoking simply by including the library file.
C allows to access computer hardware and peripherals. 
It used compiler, so once program become executable code then we can run it without interacting the compiler.

Disadvantages 
It used complier so complied code not portable on different machine.
C is a procedural language, become difficult to maintain for large application.
Less support to GUI.

What is a variable?

A variable is a name representation of memory storage location and that value can change between program execution.

What is the difference between variable declaration and variable definition?

Declaration associates type to the variable whereas definition is value assignment of the variable.

What is a constant?

When variables are declared with the const keywordcalled constant. The value ofconstant never changed.

What is the difference between local variable and global variable in C?

Local variable: A variable which is declared inside function or block is known as local variable.
Global variable: A variable which is declared outside function or block is known as global variable.

What is Storage Class in C and types of it?

The storage class represent scope and storage type in memory of variable in C.
There are four types of storage cases: Auto,Extern,Static and Register

What is auto keyword in C?

The auto keyword indicate that the memory location of a variable is temporary. Whereas by default every local variable of the function and block is automatic (auto). 

What is the use of static variable in C?

A variable declared with static keyword, is known as static variable. The static variable retains its value between multiple function calls and has permanent scope.

What are register variables? What are the advantages of using register variables? 

A variable is declared with a register storage class, known as register variable. The register variable is stored in the CPU register instead of main memory. 

Storing of frequently used variable in register might be speed up the code as variable access is faster from register in compare from memory. 

What is the purpose of type declarations? Or use of typedef?

The type declaration allow to create a name synonym for the existing data types that can help to simplify the complex declaration.

Syntax
typedef type identifier; 

How do you know the size of a data type or variable?

The sizeof operator can measure the data type size.

What is type casting?

Converting one data type into another is known as type casting.

What is a function and advantages of it? 

A function is a block of set of instruction that perform specific task.
Advantages
Reusability: function can be reuse in different place to perform same task
Code reduction: repeated code can move into function and can call function in place 
Modularity: task can be simplify by dividing that in modularity, that also increase readability

When is the void keyword used in a function?

When declare functions with void then it will not require return a value.

Latest Updates

Indian Geography

What is the approximate distance between earth and the moon?

Indian History

In which year was the battle of ‘Koregaon Bhima’ fought?

The approach that is very useful in organizing the content in history is.

General Knowledge of India

NITI Aayog stands for _____.

General Knowledge of MP

India’s first Ramayan art museum was established at?

Errors Identification

Read the sentence carefully and choose the option that has an error in it:
The management’s trusted employee was suspected of stealing large sum of money.

Read the sentence carefully and choose the option that has an error in it:
The teacher asked the child to repeat again because he spoke feebly.

Fill in the blank

Fill in the blank with the most appropriate preposition in the given sentence.
Let’s sit _________ the shade of this beautiful tree.

Choose the most appropriate determiner for the given sentence.
________of what he said was very sensible.

Substitution

Choose the option that substitutes the given phrase appropriately.
A work of art made by carving

Correct sentence

Choose the option that best transforms the sentence into its Indirect form:
‘What country do you come from?’ said the police officer.

Alternative Phrase

Choose the option that best explains the highlighted expression:
All human beings have feet of clay.

Fill in the blank

Choose an appropriate modal for the given sentence:
My doctor said that I_____ stop smoking as one of my lungs got infected.

Choose the appropriate prepositions for the given sentence:
My parents have been married ________ forty-nine years, but you can still see the love ________ their eyes.

Choose the appropriate conjunction for the given sentence:
______ it rains, the college will declare the holiday.

Antonyms

Choose the appropriate antonym for the highlighted word in the given sentence.
The family protracted their visit by several days.

Tenses

Choose the appropriate tenses to fill in the blanks in the given sentence:
Please _________ a noise. Ritu __________ to sleep.

Synonyms

Choose the appropriate synonym for the highlighted word in the given sentence.
Does he really expect us to believe such a flimsy excuse?