C Programming-Arithmetic Operators
Question 1
|
What is the output of this C code?
Compile time error
| |
-1
| |
1
| |
Implementation defined
|
Question 2
|
What is the output of this C code?
Compile time error
| |
-1 1
| |
1 -1
| |
Implementation defined
|
Question 3
|
What is the output of this C code?
Implementation defined
| |
1
| |
3
| |
Compile time error
|
Question 4
|
What is the output of this C code?
Implementation defined
| |
-1
| |
-3
| |
Compile time error
|
Question 5
|
What is the value of x in this C code?
3.75
| |
Depends on compiler
| |
24
| |
3
|
Question 6
|
What is the output of this C code?
Value of x is 2.3
| |
Value of x is 1
| |
Value of x is 0.3
| |
Compile time error
|
Question 7
|
What is the output of this C code?
Value of x is 1
| |
Value of x is 2
| |
Value of x is 3
| |
Compile time error
|
Question 8
|
What is the output of this C code?
Value of x is 12
| |
Value of x is 13
| |
Value of x is 10
| |
Undefined behaviour
|
Question 9
|
The precedence of arithmetic operators is (from highest to lowest)
%, *, /, +, -
| |
%, +, /, *, -
| |
+, -, %, *, /
| |
%, +, -, *, /
|
Question 10
|
Which of the following is not an arithmetic operation?
a *= 10;
| |
a /= 10;
| |
a != 10;
| |
a %= 10;
|
Question 11
|
Which of the following data type will throw an error on modulus operation(%)?
char
| |
short
| |
int
| |
float
|
Question 12
|
Which among the following are the fundamental arithmetic operators, ie, performing the desired operation can be done using that operator only?
+, -
| |
+, -, %
| |
+, -, *, /
| |
+, -, *, /, %
|
Question 13
|
What is the output of this C code?
15
| |
16
| |
15.6
| |
10
|
Question 14
|
What is the output of this C code?
Syntax error
| |
1
| |
10
| |
5
|
Check Your Answers:
1. B
2. B
3. B
4. B
5. C
6. D
7. A
8. D
9. A
10. C
11. D
12. A
13. A
14. B
0 comments:
Post a Comment