Each question below shows the correct answer with a full explanation. Use these to build conceptual understanding before attempting a timed quiz.
Operators & ExpressionsEasy
Q1. What does the + operator do with two integers?
- A.Concatenates them together
- B.Compares their values
- C.Multiplies them together
- D.Adds them arithmetically✓ Correct
Explanation
The + operator performs arithmetic addition when used with integer operands.
Report an error in this question
Operators & ExpressionsEasy
Q2. What is the result of 10 % 3?
- A.10
- B.0
- C.3
- D.1✓ Correct
Explanation
The modulus operator % returns the remainder of division: 10 divided by 3 leaves a remainder of 1.
Report an error in this question
Operators & ExpressionsEasy
Q3. Which operator is used for assignment in most programming languages?
- A.:=
- B.!=
- C.=✓ Correct
- D.==
Explanation
The single equals sign (=) is the assignment operator in most languages like C, Java, and Python.
Report an error in this question
Operators & ExpressionsEasy
Q4. What does the == operator do?
- A.Declares a new variable in scope
- B.Assigns a value to a variable
- C.Performs addition of two values
- D.Checks if two values are equal✓ Correct
Explanation
The == operator compares two values and returns true if they are equal.
Report an error in this question
Operators & ExpressionsEasy
Q5. What is the result of 5 > 3?
- A.true✓ Correct
- B.3
- C.false
- D.5
Explanation
The expression 5 > 3 evaluates to true because 5 is greater than 3.
Report an error in this question
Operators & ExpressionsEasy
Q6. Which operator performs integer division in Python 3?
- A.//✓ Correct
- B.%
- C.**
- D./
Explanation
In Python 3, the // operator performs floor (integer) division, discarding the decimal part.
Report an error in this question
Operators & ExpressionsEasy
Q7. What does the NOT (!) operator do?
- A.Reverses a boolean value✓ Correct
- B.Adds two values together
- C.Multiplies two operands
- D.Assigns a new value
Explanation
The NOT operator (!) reverses a boolean value: true becomes false and vice versa.
Report an error in this question
Operators & ExpressionsEasy
Q8. What is the result of true AND false?
- A.false✓ Correct
- B.error
- C.true
- D.null
Explanation
Logical AND returns true only when both operands are true; since one is false, the result is false.
Report an error in this question
Operators & ExpressionsEasy
Q9. What does the ++ operator do?
- A.Adds two variables
- B.Doubles the value
- C.Increments the value by 1✓ Correct
- D.Concatenates strings
Explanation
The ++ operator (increment) increases the value of a variable by 1.
Report an error in this question
Operators & ExpressionsEasy
Q10. Which operator is used for string concatenation in Java?
- A.+✓ Correct
- B.&
- C..
- D.,
Explanation
In Java, the + operator is overloaded to concatenate strings.
Report an error in this question
Operators & ExpressionsMedium
Q11. What is the difference between ++i and i++?
- A.++i always executes faster than i++ does overall
- B.++i increments before use; i++ increments after✓ Correct
- C.There is no difference between them at all
- D.i++ increments the value by two instead of one
Explanation
++i (pre-increment) increments the value before it is used in the expression; i++ (post-increment) uses the value first, then increments.
Report an error in this question
Operators & ExpressionsMedium
Q12. What is short-circuit evaluation?
- A.Stopping evaluation once result is known✓ Correct
- B.A hardware feature of modern processors
- C.Evaluating all conditions in every case
- D.A compiler optimization for loop bodies
Explanation
Short-circuit evaluation stops evaluating a logical expression as soon as the final result can be determined (e.g., false AND x skips x).
Report an error in this question
Operators & ExpressionsMedium
Q13. What is the ternary operator?
- A.An operator that takes a single operand only
- B.A conditional operator with three operands✓ Correct
- C.A bitwise operator for binary manipulation
- D.An operator that takes exactly two operands
Explanation
The ternary operator (? :) takes three operands: a condition, a value if true, and a value if false.
Report an error in this question
Operators & ExpressionsMedium
Q14. What does the << operator do in C/Java?
- A.Reads input from the console
- B.Performs a left bitwise shift✓ Correct
- C.Compares two values for equality
- D.Performs string stream insertion
Explanation
The << operator shifts the bits of a number to the left by a specified number of positions, effectively multiplying by powers of 2.
Report an error in this question
Operators & ExpressionsMedium
Q15. What is operator precedence?
- A.The order in which operators are defined in code
- B.The rules determining operator evaluation order✓ Correct
- C.The execution speed of a particular operator
- D.The data type returned by a given operator
Explanation
Operator precedence defines the order in which different operators are evaluated, e.g., * before +.
Report an error in this question
Operators & ExpressionsMedium
Q16. What is the result of 5 & 3 (bitwise AND)?
- A.5
- B.15
- C.8
- D.1✓ Correct
Explanation
5 in binary is 101, 3 is 011. Bitwise AND: 101 & 011 = 001, which is 1.
Report an error in this question
Operators & ExpressionsMedium
Q17. What is the difference between == and === in JavaScript?
- A.There is no difference between them
- B.== checks value; === checks value and type✓ Correct
- C.=== is used for variable assignment
- D.== checks type without value comparison
Explanation
== performs type coercion before comparison, while === (strict equality) checks both value and type without coercion.
Report an error in this question
Operators & ExpressionsMedium
Q18. What does the XOR (^) operator return?
- A.True when the operands are different✓ Correct
- B.Always false regardless of the operands
- C.True when both operands are the same
- D.Always true regardless of the operands
Explanation
XOR returns true when exactly one of the operands is true (i.e., when they differ).
Report an error in this question
Operators & ExpressionsMedium
Q19. What is the null coalescing operator (??) in JavaScript?
- A.It checks the code for syntax errors at compile time
- B.It returns the right operand if the left is null✓ Correct
- C.It always returns a null value to the caller
- D.It performs integer division on two operands
Explanation
The ?? operator returns the right-hand operand when the left-hand operand is null or undefined, otherwise returns the left-hand operand.
Report an error in this question
Operators & ExpressionsMedium
Q20. What is operator associativity?
- A.How operators are stored internally within the memory
- B.The direction operators of same precedence are evaluated✓ Correct
- C.The underlying data type of an operator in the language
- D.The execution speed of evaluating a given expression
Explanation
Associativity determines the evaluation direction for operators of equal precedence, e.g., assignment is right-to-left, addition is left-to-right.
Report an error in this question
Operators & ExpressionsHard
Q21. What is operator overloading?
- A.Defining custom behavior for user-defined types✓ Correct
- B.An error caused by incorrect operator usage
- C.Increasing the default operator precedence level
- D.Using too many operators in one expression
Explanation
Operator overloading allows programmers to redefine the behavior of operators for custom types, e.g., defining + for a Complex number class.
Report an error in this question
Operators & ExpressionsHard
Q22. What is the result of ~5 in a system using 32-bit signed integers?
- A.5
- B.-5
- C.6
- D.-6✓ Correct
Explanation
The bitwise NOT (~) inverts all bits. For 32-bit signed int, ~5 gives -6 because ~n = -(n+1) in two's complement representation.
Report an error in this question
Operators & ExpressionsHard
Q23. What is the spaceship operator (<=>)?
- A.An assignment operator for setting variables
- B.A comparison operator returning -1, 0, or 1✓ Correct
- C.A bitwise shift operator for binary values
- D.A logical operator for boolean expressions
Explanation
The spaceship operator (<=>) performs a three-way comparison, returning negative, zero, or positive based on the ordering of operands.
Report an error in this question
Operators & ExpressionsHard
Q24. What is the difference between arithmetic right shift (>>) and logical right shift (>>>)?
- A.There is no difference between them at all
- B.>>> preserves the sign bit; >> fills with zeros
- C.>> preserves the sign bit; >>> fills with zeros✓ Correct
- D.>> always fills the vacant bit positions with zeros
Explanation
Arithmetic right shift (>>) preserves the sign bit for signed numbers, while logical right shift (>>>) always fills vacant bits with zeros.
Report an error in this question
Operators & ExpressionsHard
Q25. What is the Elvis operator (?:) in Kotlin?
- A.Returns left if non-null, otherwise right✓ Correct
- B.A type-checking operator for null safety
- C.A standard ternary conditional operator
- D.A bitwise operator for binary operations
Explanation
The Elvis operator (?:) in Kotlin returns the left expression if it is non-null, otherwise evaluates and returns the right expression.
Report an error in this question
Operators & ExpressionsHard
Q26. How does Python's 'is' operator differ from '=='?
- A.is runs faster but produces less accurate results
- B.is checks identity; == checks value equality✓ Correct
- C.They are functionally identical in all cases
- D.== checks identity while is checks equality
Explanation
'is' checks if two references point to the same object in memory (identity), while '==' checks if the values are equal (equality).
Report an error in this question
Operators & ExpressionsHard
Q27. What is the safe navigation operator (?.) in Kotlin/TypeScript?
- A.It forces a null pointer exception to be thrown immediately
- B.It converts any null value to the integer zero automatically
- C.It always returns a null value regardless of the receiver
- D.It accesses a member only if the receiver is non-null✓ Correct
Explanation
The safe navigation (optional chaining) operator returns null if the receiver is null instead of throwing a NullPointerException.
Report an error in this question
Operators & ExpressionsHard
Q28. What does the >>> operator do in Java that >> does not?
- A.It fills leftmost bits with 0, ignoring the sign✓ Correct
- B.It operates more slowly than the >> operator
- C.It works on floating-point numbers unlike >>
- D.Nothing different from the >> operator at all
Explanation
>>> (unsigned right shift) always fills the highest bits with zeros, while >> (signed right shift) fills with the sign bit, preserving negative values.
Report an error in this question
Operators & ExpressionsHard
Q29. What is destructuring assignment?
- A.A type of memory deallocation for objects
- B.Deleting variables from the current scope
- C.Unpacking values from arrays or objects into variables✓ Correct
- D.Assigning null to multiple variables at once
Explanation
Destructuring assignment allows extracting values from arrays or objects into separate variables in a concise syntax.
Report an error in this question
Operators & ExpressionsHard
Q30. What is the pipeline operator (|>) proposed for JavaScript?
- A.A bitwise OR operation on binary values
- B.A comparison operator for ordering two values
- C.It passes left result as argument to right function✓ Correct
- D.A type conversion operator between data types
Explanation
The pipeline operator passes the value on the left as the first argument to the function on the right, enabling readable function chaining.
Report an error in this question