Top interview questions in c is the extensive list of questions we have created for students.
These questions are helpful for students who are looking for most common asked questions in language c with answers.
Question cover from basic level to advance level
These are theory questions which are also asked in examinations.
Find me on facebook https://www.facebook.com/iwpiww/
Find me on twitter https://twitter.com/seth_avinash
Subscribe me on youtube https://www.youtube.com/c/avinashsethwpnww?sub_confirmation=1
Your learning partner - visionard.com
9953330565 Low Rate Call Girls In Rohini Delhi NCR
Top interview questions in c
1.
Visionard
Humans + Technology = Great Combination
Top interview questions in C
Duration 1 Hour
Difficulty Level Beginner
Visionard, your learning partner
1
2.
Question 1
What are the features of C language?
Answer
C language has many inbuilt features such as
● It combines features of assembly language and high level language.
● Easy to program - C languages has data types and different operators, which makes
easier to write complex program
● Portable - Program written on C are portable, hence can be used in other computer with
no modification
● Easy to extends - You can easily create your own functions and libraries in C language.
● Very fast - Program written in c are very fast to run with no delay
● Rich set of libraries - C languages has rich set of libraries, which makes coding complex
program easier.
Question 2
What is the difference between source code and object code?
Answer
Source code is the code which is written by the programmer, it consists of all the functions,
conditional statements and libraries. Only a human being can read this code while computer
cannot read this code.
Source code extension in c language is .c
Object code when you compile the source code, you get the object code. The format of the code
is only computer readable.
Object code extension in language is .obj
Visionard, your learning partner
2
3.
Question 3
What is the difference between = and == ?
Answer
= is also known as assignment operator which is used to assign a value to the variable
== is also known as comparison operator which is used to compare two values in a conditional
statement.
Question 4
What is a header file and why we need header file in C program?
Answer
A header file are also known as library. They contain definition and prototype of the inbuilt
functions. Header files have .h as their file extension.
We need header files so, we can use functions which are inbuilt within the language.
Example
studio.h contains functions like printf()
Question 5
What is the difference between syntax error, run-time error and logical error?
Answer
Syntax error occurs when we make mistakes in the syntax of c program. This error is shown
when we try to compile our program, so it is also known as compile time error.
Example
● A missing semicolon
Visionard, your learning partner
3
4.
Run-time error occurs during the execution of our program after successful compilation. A
compiler cannot find them so they are very hard to find, as they only occur during the run time of
the program.
Example
● Dividing a number with 0
Logical Error occurs when you get different output based on the input. Major cause of this error
is logic created by the programmer. They are again hard to find and cannot be detected by the
compiler.
Example
● A sum of 2 number returning a negative value.
Question 6
Why C language is known as middle level language?
OR
What type of language is C language? Low level, middle level or high level?
Answer
C language is known as middle level language because it can access machine level(low level)
features like accessing structure of the memory just like assembly language.
But also acts as high level language in which you can use english language to write your
program.
Visionard, your learning partner
4
5.
Question 7
What is the difference between i++ and ++i?
OR
What is the difference between post increment operator and pre increment operator?
Answer
Post increment operator or i++
In this, we first assign the value and then increment the value by one
Pre increment operator or ++i
In this, we first increment the value by one and then assign the value.
Question 8
What is the difference between actual parameters and formal parameters?
Answer
Actual Parameters are passed when you call the function in your program.
Formal Parameters are parameters which are given in the prototype and definition of the
function.
Visionard, your learning partner
5
6.
Question 9
What are different data types in C language?
Answer
There are 4 basic data types in c
● Int - size 4 byte
● char - size 1 byte
● float - size 4 byte
● double - size 4 byte
Question 10
What are pointers in C?
Answer
Pointers are types of variables which are used to store address of another variable. They can
only store address of variables of similar data type
Question 11
What are modifiers in language c? Explain different types of modifiers?
Answer
Modifiers are used to increase or decrease the size in memory and range of a variable. They are
prefixed before the data type of the variable.
Different types of modifiers in language c are
● short
● long
● signed
● Unsigned
Visionard, your learning partner
6
7.
Example
● short int age = 5;
● long int value = 10000;
Question 12
What are arrays? Why we need array? Explain different types of array!
Answer
An array are collection of similar data types.
We need array for the following reason
● Allocates contiguous block of memory
● Makes our program efficient
● Good to use when we have more than 1 variable of similar data types
Types of array
● Single dimension array or 1D array - they consists of just 1 row of similar data types
● Multidimensional array consists of x rows and y columns of similar data types.
Question 13
What is the difference between call by value and call by reference? Explain with example!
Answer
Call by Value when you pass the copy of variable in the function call, it is known as call by
value. In this method, any modification whatsoever are done in the duplicate copy of the
variable.
Visionard, your learning partner
7
8.
Call by reference when you pass original value of the variable in the function call, it is also
known as call by reference. In this method, any modification whatsoever are done in the original
variable hence the changes are reflected in the original variable.
Question 14
What is stack?
Answer
Stack is a type of data structure which works on the principle of Last in first out(LIFO). Storing
the data inside a stack is known as push while removing the data from stack is pop.
Question 15
What is queue?
Answer
A queue is the type of data structure which works on the principle of First in first out(FIFO). The
order of data insertion and deletions is on FIFO.
Question 16
What are linked list?
Answer
A linked list is type of data structure where current node is connected to the previous node. A
basic linked list block consists of 2 part
1) Previous address - this part contains the address of previous node
2) Value - this part stores the value in the current node.
Linked list are of 2 types
Visionard, your learning partner
8
9.
1. Singly Linked List
2. Doubly Linked List
Singly Linked list - It consists of only 2 part, previous address part to store address of previous
block and data part to store the data.
Doubly Linked List - It consists of 3 parts, previous address part to store address of previous
block, data part to store the data and next address part to store the address of next block.
Question 17
What is dynamic memory allocation?
Answer
When you allocate memory during the run time of the program, it is known as dynamic memory
allocation. There are 4 basic functions for dynamic memory allocation
● malloc()
● calloc()
● free
● Realloc
These functions can be found in stdlib.h header file
Question 18
What is the difference between a structure and union?
Answer
Union is user defined data type, which combines more than one data types as a single entity.
The size of union is the size of the biggest data type inside that union
Structure is a user defined data type, which combines more than one data types as a single
entity.
The size of structure is equal to the sum of all data types inside the structure.
Visionard, your learning partner
9
10.
Question 19
Explain why c language is a case sensitive language with an example!
Answer
C language is a case sensitive language because variable names with different cases are
different from each other. Example of different variables with same name but capital letter and
small letters combination
● Age is different from
● aGE which is different from
● AGe which is different from
● agE which is different from
● aGe which is different from
● AgE which is different from
● age which is different from AGE
Question 20
What is the difference between local variables and global variables?
Answer
Local variable are variables with scope limited to the block of code, if a variable is declared
inside the function, you can only access it inside the function. You cannot access local variables
from outside the function.
Global variable are variables with scope throughout the program. You can access the variable
from any function or any block of code within the program.
Visionard, your learning partner
10