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

while loop - 1

while loop - 2

do while loop - 1

do while loop - 2

break and continue - 1

break and continue - 2

pointer - 1

pointer - 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 output of the following C code?

#include <stdio.h>

void main()

{

int a = 10.0 % 4;

printf("Value of a is %d", a);

}

a) 0.0

b) 2.0

c) 2

d) Compilation Error

b) 2.0

c) 2

d) Compilation Error

Correct Answer : d

Explanation : Compilation error because Remainder operator can not be applied on real values.

Explanation : Compilation error because Remainder operator can not be applied on real values.

Q2:An expression contains relational, assignment and arithmetic operators. If parenthesis are not specified, the order of evaluation of the operators would be -

a) Assignment , Relational , Arithmetic

b) Arithmetic, Relational, Assignment

c) Relational, Assignment, Arithmetic

d) Relational, Arithmetic, Assignment

b) Arithmetic, Relational, Assignment

c) Relational, Assignment, Arithmetic

d) Relational, Arithmetic, Assignment

Correct Answer : b

Explanation : Precedence of Arithmetic is higher than relational, and precedence of relational is higher than assignment, so arithmetic will be solved first, relational second, and assignment at last.

Explanation : Precedence of Arithmetic is higher than relational, and precedence of relational is higher than assignment, so arithmetic will be solved first, relational second, and assignment at last.