## 1. What is the result of the expression 5 + 3 * 2 in C?

a) 16
b) 11
c) 13
d) 10

b) 11

### Explanation:

According to operator precedence in C, multiplication is performed before addition. Hence, 3 * 2 is evaluated first, making the expression 5 + 6, which equals 11.

## 2. What does the '++' operator do in C?

b) Subtraction
c) Increment by 1
d) Increment by 2

c) Increment by 1

### Explanation:

The '++' operator increments the value of a variable by 1.

## 3. Which of the following is a logical operator in C?

a) &
b) |
c) !
d) %

c) !

### Explanation:

The '!' operator is a logical NOT operator in C. The '&' and '|' are bitwise operators, and '%' is the modulo operator.

## 4. What is the purpose of the bitwise AND operator '&' in C?

a) To compare two values
c) To perform a logical AND operation
d) To perform a bitwise AND operation

d) To perform a bitwise AND operation

### Explanation:

The '&' operator performs a bitwise AND operation, comparing each bit of its first operand to the corresponding bit of its second operand.

## 5. Which operator is used for division in C?

a) /
b) DIV
c) %
d) *

a) /

### Explanation:

The '/' operator is used for division in C.

## 6. What does the '==' operator do in C?

a) Assigns a value to a variable
b) Compares two values for equality
d) Subtracts one value from another

b) Compares two values for equality

### Explanation:

The '==' operator is used to compare two values to determine if they are equal.

## 7. What is the result of the expression 8 % 3 in C?

a) 2.67
b) 2
c) 5
d) 3

b) 2

### Explanation:

The '%' operator returns the remainder of the division of 8 by 3, which is 2.

## 8. What is the output of the following C code?

``````   int a = 5, b = 10;
printf("%d", a > b && a != b);
``````
a) 0
b) 1
c) 5
d) 10

a) 0

### Explanation:

The expression evaluates to false (0) because a is not greater than b, even though a is not equal to b.

## 9. Which operator is used to check if two variables are not equal in C?

a) =
b) !=
c) ===
d) =!

b) !=

### Explanation:

The '!=' operator checks if two variables are not equal.

## 10. What is the purpose of the conditional (ternary) operator '?:' in C?

a) To execute a function based on a condition
b) To assign a value based on a condition
c) To compare three values
d) To concatenate strings

b) To assign a value based on a condition

### Explanation:

The ternary operator '?:' is used to assign a value to a variable based on a condition. It's a shorthand for the if-else statement.

## 11. How does the bitwise OR operator '|' work in C?

a) It sets a bit if it is set in either operand
b) It sets a bit if it is set in both operands
c) It inverts each bit of its operand
d) It shifts the bits of the first operand

a) It sets a bit if it is set in either operand

### Explanation:

The '|' operator performs a bitwise OR operation, where a bit is set to 1 if it is set in either operand.

## 12. What is the result of the expression 5 << 2 in C?

a) 10
b) 20
c) 25
d) 7

b) 20

### Explanation:

The '<<' operator is the left shift operator. It shifts the bits of 5 (which is 0101 in binary) 2 places to the left, resulting in 10100, which is 20 in decimal.

## 13. What is the precedence of the '+' and '*' operators in C?

a) '+' has higher precedence than '*'
b) '*' has higher precedence than '+'
c) Both have the same precedence
d) Depends on the compiler

b) '*' has higher precedence than '+'

### Explanation:

In C, the '*' (multiplication) operator has higher precedence than the '+' (addition) operator.

## 14. What does the 'sizeof' operator return in C?

a) The size of a variable in bits
b) The size of a variable in bytes
c) The length of an array
d) The number of elements in an array

b) The size of a variable in bytes

### Explanation:

The 'sizeof' operator returns the size of a variable or data type in bytes.

## 15. What is the output of the following C code?

``````  int x = 9, y = 4;
printf("%d", x & y);
``````
a) 0
b) 1
c) 5
d) 13

c) 5

### Explanation:

The '&' operator performs a bitwise AND operation. In binary, 9 is 1001 and 4 is 0100. The AND operation of these gives 0001, which is 5 in decimal.

## 16. What is the result of the expression 5 | 3 in C?

a) 8
b) 7
c) 6
d) 5

b) 7

### Explanation:

The '|' operator performs a bitwise OR operation. In binary, 5 is 0101 and 3 is 0011. The OR operation of these gives 0111, which is 7 in decimal.

## 17. What is the output of the following C code?

``````int a = 10;
printf("%d", !a);
``````
a) 0
b) 1
c) 10
d) -10

a) 0

### Explanation:

The '!' operator is the logical NOT operator. It inverts the truthiness of a, and since a is non-zero, !a is 0.

## 18. What does the '->' operator do in C?

a) Accesses a member of a structure through a pointer
b) Accesses a member of an array
c) Performs a bitwise operation
d) Compares two pointers

a) Accesses a member of a structure through a pointer

### Explanation:

The '->' operator is used to access a member of a structure or a union through a pointer.

## 19. What is the result of the expression '5 == 5' in C?

a) True
b) False
c) 5
d) Error

a) True

### Explanation:

The '==' operator compares two values for equality. Since 5 is equal to 5, the expression evaluates to true (1).

## 20. What is the output of the following C code?

``````int a = 5;
int b = a++;
printf("%d %d", a, b);
``````
a) 5 6
b) 6 5
c) 6 6
d) 5 5