Quiz

puts belongs to the ____ data type.

String Nil Boolean puts doesn't belong to a data type. puts is a method, not an object; therefore, puts doesn't belong to a data type.

puts is a ____.

String Data Type Method Program puts "hello" is a very small program; puts itself is a method.

Which of the following will not cause an error?

puts "dog" puts dog puts ____ puts error The Ruby interpreter is able to parse "dog" because it is a string. Every other choice uses puts with an undefined variable or method.

What is the Ruby interpreter?

Me right now A program that parses and executes Ruby code The stack trace A data type The Ruby interpreter is by definition a program that parses and executes Ruby code.
undefined local variable or method 'dog' for main:Object
(repl):5:in '<main>'

Which section of the above error message corresponds to the stack trace?

(repl):5:in '<main>' undefined local variable or method 'dog' for main:Object main:Object dog (repl):5:in '<main>' is the stack trace: a list of code location whence an error originates.

Why would puts dog cause an error? You may select more than one answer.

dog doesn't belong to a data type. dog is not a defined variable. dog is not a defined method. Because dog is not an object (it does not belong to a data type), a defined variable, a defined method, or any other meaningful entity, the Ruby interpreter cannot parse it.

results matching ""

    No results matching ""