12/15/22, 9:38 AM Arithmetic Operators - C Programming Questions and Answers - Sanfoundry
C Programming Questions and Answers –
Arithmetic Operators – 1
« Prev Next »
This set of C Multiple Choice Questions & Answers (MCQs) focuses on “Arithmetic Operators – 1”.
Pre-requisite for this C MCQ set: Advanced C Programming Video Tutorial.
1. What will be the output of the following C code?
1. #include <stdio.h>
2. int main()
3. {
4. int i = -3;
5. int k = i % 2;
6. printf("%d\n", k);
7. }
a) Compile time error
b) -1
c) 1
d) Implementation defined
View Answer
Answer: b
Explanation: None.
Note: Join free Sanfoundry classes at Telegram or Youtube
advertisement
https://www.sanfoundry.com/advanced-c-programming-questions-arithmetic-operators/ 1/8
12/15/22, 9:38 AM Arithmetic Operators - C Programming Questions and Answers - Sanfoundry
2. What will be the output of the following C code?
Take C Programming Practice Tests - Chapterwise!
Start the Test Now: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
1. #include <stdio.h>
2. int main()
3. {
4. int i = 3;
5. int l = i / -2;
6. int k = i % -2;
7. printf("%d %d\n", l, k);
8. return 0;
9. }
a) Compile time error
b) -1 1
c) 1 -1
d) Implementation defined
View Answer
Answer: b
Explanation: None.
advertisement
https://www.sanfoundry.com/advanced-c-programming-questions-arithmetic-operators/ 2/8
12/15/22, 9:38 AM Arithmetic Operators - C Programming Questions and Answers - Sanfoundry
3. What will be the output of the following C code?
1. #include <stdio.h>
2. int main()
3. {
4. int i = 5;
5. i = i / 3;
6. printf("%d\n", i);
7. return 0;
8. }
a) Implementation defined
b) 1
c) 3
d) Compile time error
View Answer
Answer: b
Explanation: None.
advertisement
4. What will be the output of the following C code?
1. #include <stdio.h>
2. int main()
https://www.sanfoundry.com/advanced-c-programming-questions-arithmetic-operators/ 3/8
12/15/22, 9:38 AM Arithmetic Operators - C Programming Questions and Answers - Sanfoundry
3. {
4. int i = -5;
5. i = i / 3;
6. printf("%d\n", i);
7. return 0;
8. }
a) Implementation defined
b) -1
c) -3
d) Compile time error
View Answer
Answer: b
Explanation: None.
5. What will be the final value of x in the following C code?
1. #include <stdio.h>
2. void main()
3. {
4. int x = 5 * 9 / 3 + 9;
5. }
a) 3.75
b) Depends on compiler
c) 24
d) 3
View Answer
Answer: c
Explanation: None.
6. What will be the output of the following C code?
1. #include <stdio.h>
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
https://www.sanfoundry.com/advanced-c-programming-questions-arithmetic-operators/ 4/8
12/15/22, 9:38 AM Arithmetic Operators - C Programming Questions and Answers - Sanfoundry
d) Compile time error
View Answer
Answer: d
Explanation: None.
7. What will be the output of the following C code?
1. #include <stdio.h>
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
View Answer
Answer: a
Explanation: None.
Sanfoundry Global Education & Learning Series – C Programming Language.
To practice all areas of C language, here is complete set of 1000+ Multiple Choice Questions and
Answers.
« Prev - C Programming Questions and » Next - C Programming Questions and Answers
Answers – Declarations – 2 – Arithmetic Operators – 2
Next Steps:
Get Free Certificate of Merit in C Programming
Participate in C Programming Certification Contest
Become a Top Ranker in C Programming
Take C Programming Tests
Chapterwise Practice Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
Chapterwise Mock Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
https://www.sanfoundry.com/advanced-c-programming-questions-arithmetic-operators/ 5/8