## Please Turn On Java Script To Access This Site.

C Institute | Questions

This section on C interview questions, tricky questions, and puzzles focuses on “Arithmetic operators”. One shall practice these questions and puzzles to improve their C programming skills needed for various interviews (campus interviews, walk-in interviews, viva exams and company interviews), placements, entrance exams and other competitive exams. These programming questions can be attempted by anyone focusing on learning C Programming language. They can be a beginner, fresher, engineering graduate, engineering student, bca student, mca student, mcs students or an experienced IT professional. Here is a listing of C questions and puzzles on “Arithmetic operators” along with answers and/or explanations.

```Q1: What will be the result of the following expression in c ?
2+3*4/3-1```
a)  5
b)  4
c)  5.33
d)  None of these
Explanation : First of all * is solved. Then / is solved. After Divide , + is solved, and at last - will be solved.

```Q2: What will be the result of the following expression?
2*3/5```
a)  1
b)  1.2
c)  0
d)  None of these
Explanation : In c precedence of * and / is same. In a expression if * appears before / , then * is solved before solving the /, and vice versa. So here 2*3/5 will result in 1. Second thing, division of two integers yields an integer value. e.g. 3/2 is 1, 10/3 is 3.

`Q3: Which arithmetic operator can not be applied on Real values in c?`
a)  % Remainder
b)  / Division
d)  - Subtraction
Explanation : In c, Remainder or Modulus can be applied on integers only, it can not be applied on real values.

`Q4: Which is not an arithmetic operator in c?`
a)  Remainder (%)
b)  Exponent (**)
c)  Subtract (-)
d)  Multiply or Product (*)
Explanation : In c, there is no operator for calculating power.

```Q5: What will be the output of following code snippet?
int main()
{

int x=10%3*4/2+1;

printf("%d ",x);
}```
a)  7
b)  6
c)  3
d)  5
Explanation : Check out the operator precedence table

```Q6: What is the precedence of arithmetic operators (highest to lowest)?
operator before comma should be considered as higher precedence operator than the operator on the right hand side of comma.
Two operators which are not separated by comma should be considered as same precedence operator, and will be solved using associativity.```
a)  /, * , %, + , -
b)  / + , * %, -
c)  % * / , + –
d)  / , %, * , + -
Explanation : The Multiply, Divide and Remainder have same precedence in c, but have higher precedence than Addition and Subtraction.
The Addition and Subtraction have same precedence.

`Q7: Which is not an arithmetic operation?`
a)  a+b
b)  a*b+2
c)  a/b-3
d)  a<b+4
Explanation : Arithmetic operations are those which involves only arithmetic operators.

`Q8: Which are the fundamental arithmetic operators. Fundamental arithmetic operators:  Operators from which we can perform all other arithmetic operations.`
a)  +, - ,* , / ,%
b)  +,-
c)  +, - , * , /
d)  + , - /
Explanation : All other arithmetic operations can be performed using the Addition and/or Subtraction.

`Q9: We can not apply Remainder (%) operator on which of the following datatype?`
a)  char
b)  int
c)  float
d)  long int
Explanation : In c, Remainder operator can not be applied on real values.

`Q10: Which is the arithmetic operator that is used for calculating power (exponent value)?`
a)  **
b)  ^
c)  both ** and ^
d)  None of these
Explanation : C provide only five arithmetic operators + , - , * ,/ , %. C does not have any inbuilt operator for calculating exponent value yet one can use pow() function from math.h header file.

```Q11: What will be the output of following c code?
#include<stdio.h>
int main()
{
int a=2*3/3%2+1.5;
printf("%d",a);
}```
a)  1
b)  2
c)  1.5
d)  Compile time error