Tuesday, July 3, 2018

Guess the programming language with array and dictionary addition

Guess the programming language with array and dictionary addition


Guess the programming language.

  1. In which programming language are all of these true?
    • [] + [] is an empty string.
    • [] + {} is a string describing the empty object.
    • {} + [] is 0.
    • {} + {} is not-a-number.
  2. In which programming language are all of these true?
    • [] + [] is an empty list.
    • [] + {} raises TypeError.
    • {} + [] raises TypeError
    • {} + {} raises TypeError.
  3. In which programming language are all of these true?
    • [] + [] is an empty list.
    • [] + {} raises TypeError.
    • {} + [] raises NoMethodError
    • {} + {} raises NoMethodError.
  4. In which programming language are all of these true?
    • [] + [] is a positive number, e.g. 19806432.
    • [] + {} is a positive number, e.g. 20142304.
    • {} + [] is a positive number, e.g. 58300640.
    • {} + {} is a positive number, e.g. 27597024.


go to link download

No comments:

Post a Comment