Variable name and scope 1

Variable name and scope 2

Variable name and scope 3

Arithmetic operator 1

Arithmetic operator 2

Relational Operators - 1

Relational Operators - 2

Logical Operators - 1

Logical Operators - 2

Assignment Operator - 1

Assignment Operator - 2

Increment Decrement Operator - 1

Increment Decrement Operator - 2

Conditional Operator - 1

Conditional Operator - 2

sizeof operator - 1

sizeof operator - 2

Bitwise operator - 1

Bitwise operator - 2

Operator precedence and associativity - 1

Operator precedence and associativity - 2

Operator precedence and associativity - 3

if statement - 1

if statement - 2

if else - 1

if else - 2

switch statement - 1

switch statement - 2

for loop - 1

for loop - 2

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

b) 4

c) 5.33

d) None of these

Correct Answer : a

Explanation : First of all * is solved. Then / is solved. After Divide , + is solved, and at last - will be solved.

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

b) 1.2

c) 0

d) None of these

Correct Answer : a

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.

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

c) + Addition

d) - Subtraction

b) / Division

c) + Addition

d) - Subtraction

Correct Answer : a

Explanation : In c, Remainder or Modulus can be applied on integers only, it can not be applied on real values.

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 (*)

b) Exponent (**)

c) Subtract (-)

d) Multiply or Product (*)

Correct Answer : b

Explanation : In c, there is no operator for calculating power.

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

b) 6

c) 3

d) 5

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) / , %, * , + -

b) / + , * %, -

c) % * / , + –

d) / , %, * , + -

Correct Answer : c

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.

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

b) a*b+2

c) a/b-3

d) a<b+4

Correct Answer : d

Explanation : Arithmetic operations are those which involves only arithmetic operators.

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) + , - /

b) +,-

c) +, - , * , /

d) + , - /

Correct Answer : b

Explanation : All other arithmetic operations can be performed using the Addition and/or Subtraction.

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

b) int

c) float

d) long int

Correct Answer : c

Explanation : In c, Remainder operator can not be applied on real values.

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

b) ^

c) both ** and ^

d) None of these

Correct Answer : d

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.

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

b) 2

c) 1.5

d) Compile time error