250+ TOP MCQs on Arithmetic Operators and Answers

C test on “Arithmetic Operators”. One shall practice these test questions to improve their C programming skills needed for various interviews (campus interviews, walkin interviews, company interviews), placements, entrance exams and other competitive exams. These questions can be attempted by anyone focusing on learning C Programming language. They can be a beginner, fresher, engineering graduate or an experienced IT professional. Our C test questions come with detailed explanation of the answers which helps in better understanding of C concepts.

Here is a listing of C test questions on “Arithmetic Operators” along with answers, explanations and/or solutions:

1. What will be the output of the following C code?

  1.     #include 
  2.     int main()
  3.     {
  4.         int i = -3;
  5.         int k = i % 2;
  6.         printf("%dn", k);
  7.     }

a) Compile time error
b) -1
c) 1
d) Implementation defined
Answer: b
Clarification: None.

2. What will be the output of the following C code?

  1.     #include 
  2.     int main()
  3.     {
  4.         int i = 3;
  5.         int l = i / -2;
  6.         int k = i % -2;
  7.         printf("%d %dn", l, k);
  8.         return 0;
  9.     }

a) Compile time error
b) -1 1
c) 1 -1
d) Implementation defined
Answer: b
Clarification: None.

3. What will be the output of the following C code?

  1.     #include 
  2.     int main()
  3.     {
  4.         int i = 5;
  5.         i = i / 3;
  6.         printf("%dn", i);
  7.         return 0;
  8.     }

a) Implementation defined
b) 1
c) 3
d) Compile time error
Answer: b
Clarification: None.

4. What will be the output of the following C code?

  1.    #include 
  2.     int main()
  3.     {
  4.         int i = -5;
  5.         i = i / 3;
  6.         printf("%dn", i);
  7.         return 0;
  8.     }

a) Implementation defined
b) -1
c) -3
d) Compile time error
Answer: b
Clarification: None.

5. What will be the final value of x in the following C code?

  1.     #include 
  2.     void main()
  3.     {
  4.         int x = 5 * 9 / 3 + 9;
  5.     }

a) 3.75
b) Depends on compiler
c) 24
d) 3
Answer: c
Clarification: None.

6. What will be the output of the following C code?

  1.     #include 
  2.     void main()
  3.     {
  4.         int x = 5.3 % 2;
  5.         printf("Value of x is %d", x);
  6.     }

a) Value of x is 2.3
b) Value of x is 1
c) Value of x is 0.3
d) Compile time error
Answer: d
Clarification: None.

7. What will be the output of the following C code?

  1.     #include 
  2.     void main()
  3.     {
  4.         int y = 3;
  5.         int x = 5 % 2 * 3 / 2;
  6.         printf("Value of x is %d", x);
  7.     }

a) Value of x is 1
b) Value of x is 2
c) Value of x is 3
d) Compile time error
Answer: a
Clarification: None.

Leave a Reply

Your email address will not be published. Required fields are marked *