Bird
0
0

Which of the following is the correct syntax for NOT operation in Ruby?

easy📝 Syntax Q3 of 15
Ruby - Operators and Expressions
Which of the following is the correct syntax for NOT operation in Ruby?
A!true
Bnot(true
C!!true
Dtrue!
Step-by-Step Solution
Solution:
  1. Step 1: Identify correct NOT syntax

    In Ruby, the NOT operator is written as an exclamation mark before the value.
  2. Step 2: Check options

    !true uses !true which is correct. not(true) is invalid syntax, C is double negation, D is invalid.
  3. Final Answer:

    !true is the correct NOT syntax -> Option A
  4. Quick Check:

    NOT operator is !value [OK]
Quick Trick: Use ! before a value for NOT in Ruby [OK]
Common Mistakes:
MISTAKES
  • Using not() as a function
  • Placing ! after value
  • Double negation confusion

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes