-
What is the purpose of arithmetic operators in C?
A) To perform mathematical calculations on numeric data
B) To compare two values and return a Boolean result
C) To control the flow of program execution
D) To print output to the console
Answer: A) To perform mathematical calculations on numeric data
-
Which operator is used for addition in C?
A) + (Plus)
B) - (Minus)
C) * (Multiplication)
D) / (Division)
Answer: A) + (Plus)
-
What will be the result of the expression `5 - 3` using subtraction operator?
A) 2
B) 8
C) 15
D) 0
Answer: A) 2
-
Which operator is used for multiplication in C?
A) + (Plus)
B) - (Minus)
C) * (Multiplication)
D) / (Division)
Answer: C) * (Multiplication)
-
What will be the result of the expression `10 / 2` using division operator?
A) 5
B) 8
C) 2.5
D) 0
Answer: A) 5
-
Which operator is used for finding the remainder in C?
A) % (Modulus)
B) / (Division)
C) * (Multiplication)
D) + (Plus)
Answer: A) % (Modulus)
-
What will be the result of the expression `15 % 4` using modulus operator?
A) 3
B) 0
C) 4
D) 1
Answer: A) 3
-
Which operator is used for incrementing a variable by 1 in C?
A) ++ (Increment)
B) -- (Decrement)
C) + (Plus)
D) - (Minus)
Answer: A) ++ (Increment)
-
Which operator is used for decrementing a variable by 1 in C?
A) ++ (Increment)
B) -- (Decrement)
C) + (Plus)
D) - (Minus)
Answer: B) -- (Decrement)
-
What is the result of the expression `x = 5; y = x++;` where x initially holds the value 5?
A) x is 6, y is 5
B) x is 5, y is 6
C) x is 5, y is 5
D) x is 6, y is 6
Answer: A) x is 6, y is 5
-
What is the purpose of assignment operators in C?
A) To perform mathematical calculations
B) To compare two values
C) To assign a value to a variable
D) To print output to the console
Answer: C) To assign a value to a variable
-
Which assignment operator is used to assign a value to a variable in C?
A) = (Equal)
B) == (Double Equal)
C) := (Colon Equal)
D) -> (Arrow)
Answer: A) = (Equal)
-
What is the value of the variable `x` after the following assignment: `x = 10;`?
A) 0
B) 1
C) 10
D) 100
Answer: C) 10
-
Which of the following assignment operators is used for addition and assignment?
A) = (Equal)
B) += (Plus Equal)
C) -= (Minus Equal)
D) *= (Multiply Equal)
Answer: B) += (Plus Equal)
-
What will be the value of the variable `y` after the following assignment: `y += 5;` if `y` initially holds the value 7?
A) 2
B) 7
C) 12
D) 5
Answer: C) 12
-
Which assignment operator is used for subtraction and assignment?
A) = (Equal)
B) += (Plus Equal)
C) -= (Minus Equal)
D) *= (Multiply Equal)
Answer: C) -= (Minus Equal)
-
What will be the value of the variable `z` after the following assignment: `z -= 3;` if `z` initially holds the value 9?
A) 6
B) 3
C) 9
D) -3
Answer: A) 6
-
Which assignment operator is used for multiplication and assignment?
A) = (Equal)
B) += (Plus Equal)
C) -= (Minus Equal)
D) *= (Multiply Equal)
Answer: D) *= (Multiply Equal)
-
What will be the value of the variable `w` after the following assignment: `w *= 4;` if `w` initially holds the value 3?
A) 7
B) 12
C) 3
D) 0
Answer: B) 12
-
Which assignment operator is used for division and assignment?
A) = (Equal)
B) += (Plus Equal)
C) /= (Divide Equal)
D) *= (Multiply Equal)
Answer: C) /= (Divide Equal)
-
What is the purpose of relational operators in C?
A) To perform mathematical calculations
B) To assign values to variables
C) To compare values and return a Boolean result
D) To control the flow of program execution
Answer: C) To compare values and return a Boolean result
-
Which relational operator is used to check if two values are equal in C?
A) == (Equal to)
B) != (Not equal to)
C) < (Less than)
D) > (Greater than)
Answer: A) == (Equal to)
-
What will be the result of the expression `5 == 5` using the equal to operator?
A) True
B) False
C) 10
D) Error
Answer: A) True
-
Which relational operator is used to check if two values are not equal in C?
A) == (Equal to)
B) != (Not equal to)
C) < (Less than)
D) > (Greater than)
Answer: B) != (Not equal to)
-
What will be the result of the expression `8 != 5` using the not equal to operator?
A) True
B) False
C) 3
D) Error
Answer: A) True
-
Which relational operator is used to check if a value is less than another value in C?
A) == (Equal to)
B) != (Not equal to)
C) < (Less than)
D) > (Greater than)
Answer: C) < (Less than)
-
What will be the result of the expression `10 < 15` using the less than operator?
A) True
B) False
C) 25
D) Error
Answer: A) True
-
Which relational operator is used to check if a value is greater than another value in C?
A) == (Equal to)
B) != (Not equal to)
C) < (Less than)
D) > (Greater than)
Answer: D) > (Greater than)
-
What will be the result of the expression `20 > 10` using the greater than operator?
A) True
B) False
C) 10
D) Error
Answer: A) True
-
Which relational operator is used to check if a value is less than or equal to another value in C?
A) <= (Less than or equal to)
B) >= (Greater than or equal to)
C) == (Equal to)
D) != (Not equal to)
Answer: A) <= (Less than or equal to)
-
What is the purpose of logical operators in C?
A) To perform mathematical calculations
B) To assign values to variables
C) To combine and manipulate Boolean values
D) To control the flow of program execution
Answer: C) To combine and manipulate Boolean values
-
Which logical operator in C represents logical AND?
A) && (Double Ampersand)
B) || (Double Pipe)
C) ! (Exclamation Mark)
D) & (Ampersand)
Answer: A) && (Double Ampersand)
-
What is the result of the logical AND operation `true && false` in C?
A) true
B) false
C) 1
D) 0
Answer: B) false
-
Which logical operator in C represents logical OR?
A) && (Double Ampersand)
B) || (Double Pipe)
C) ! (Exclamation Mark)
D) | (Pipe)
Answer: B) || (Double Pipe)
-
What is the result of the logical OR operation `true || false` in C?
A) true
B) false
C) 1
D) 0
Answer: A) true
-
Which logical operator in C represents logical NOT?
A) && (Double Ampersand)
B) || (Double Pipe)
C) ! (Exclamation Mark)
D) ~ (Tilde)
Answer: C) ! (Exclamation Mark)
-
What is the result of the logical NOT operation `!true` in C?
A) true
B) false
C) 1
D) 0
Answer: B) false
-
What is the result of the expression `true && (false || true)` in C?
A) true
B) false
C) 1
D) 0
Answer: A) true
-
What is the result of the expression `(true && false) || (false && true)` in C?
A) true
B) false
C) 1
D) 0
Answer: B) false
-
Which logical operator in C has the highest precedence?
A) &&
B) ||
C) !
D) &
Answer: C) ! (Exclamation Mark)
-
What is the purpose of the increment operator (++) in C?
A) To subtract 1 from a variable
B) To add 1 to a variable
C) To multiply a variable by 2
D) To divide a variable by 2
Answer: B) To add 1 to a variable
-
Which operator is used to increment a variable by 1 in C?
A) -- (Double Minus)
B) + (Plus)
C) * (Multiplication)
D) ++ (Double Plus)
Answer: D) ++ (Double Plus)
-
What is the result of `x = 5; y = x++;` in C, where `x` starts with a value of 5?
A) `x` becomes 6, `y` becomes 6
B) `x` remains 5, `y` becomes 5
C) `x` becomes 6, `y` remains 5
D) `x` remains 5, `y` remains 6
Answer: C) `x` becomes 6, `y` remains 5
-
Which operator is used to decrement a variable by 1 in C?
A) -- (Double Minus)
B) + (Plus)
C) * (Multiplication)
D) ++ (Double Plus)
Answer: A) -- (Double Minus)
-
What is the result of `x = 8; y = --x;` in C, where `x` starts with a value of 8?
A) `x` becomes 7, `y` becomes 7
B) `x` remains 8, `y` becomes 7
C) `x` becomes 7, `y` becomes 8
D) `x` remains 8, `y` becomes 6
Answer: A) `x` becomes 7, `y` becomes 7
-
What is the difference between the postfix increment `x++` and the prefix increment `++x` in C?
A) There is no difference; they both increase `x` by 1.
B) Postfix increment increases `x` first, while prefix increment increases `x` after the current value is used.
C) Postfix increment increases `x` after the current value is used, while prefix increment increases `x` first.
D) Postfix increment doubles the value of `x`, while prefix increment adds 1.
Answer: B) Postfix increment increases `x` first, while prefix increment increases `x` after the current value is used.
-
What is the purpose of the decrement operator (--) in C?
A) To add 1 to a variable
B) To subtract 1 from a variable
C) To multiply a variable by 2
D) To divide a variable by 2
Answer: B) To subtract 1 from a variable
-
What is the result of `x = 10; y = x--;` in C, where `x` starts with a value of 10?
A) `x` becomes 9, `y` becomes 10
B) `x` remains 10, `y` becomes 9
C) `x` becomes 9, `y` becomes 9
D) `x` remains 10, `y` becomes 10
Answer: A) `x` becomes 9, `y` becomes 10
-
Which operator is used to increment a variable by a specific value in C?
A) ++
B) --
C) +=
D) *=
Answer: C) += (Increment by a specific value)
-
Which operator is used to decrement a variable by a specific value in C?
A) ++
B) --
C) +=
D) *=
Answer: B) --= (Decrement by a specific value)