Home / CSE MCQs / Ruby Programming MCQs :: Ruby Programming Ruby Basics

CSE MCQs :: Ruby Programming MCQs

  1. Which of the following is supported by Ruby?
  2. A.
    Multiple Programming Paradigms
    B.
    Dynamic Type System
    C.
    Automatic Memory Management
    D.
    All of the Mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. Which of the following are valid floating point literal?
  4. A.
    5
    B.
    2
    C.
    0.5
    D.
    None of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  5. What is the output of the given code?

    "Ruby.length #to find the length of given string
  6. A.
    4 to find the length of given string
    B.
    4
    C.
    To find the length of given string
    D.
    Ruby

    View Answer

    Workspace

    Discuss Discuss in Forum


  7. Why do we use =begin and =end?
  8. A.
    To mark the start and end of multiline comment
    B.
    To comment multiple lines
    C.
    To avoid the use of # again and again
    D.
    All of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  9. Why can not we use quotation marks (' or ") with boolean?
  10. A.
    It indicates that we are talking about a string
    B.
    It indicates that we are assining a value
    C.
    It indicates that that we are replacing boolean data type with string data type
    D.
    None of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  11. What is the output of the given code?

    boolean_1 = 77 less than 78
    puts(boolean_1)
  12. A.
    Nil
    B.
    True
    C.
    False
    D.
    Error

    View Answer

    Workspace

    Discuss Discuss in Forum


  13. What is the role of ! at the end of the capitalize method?
  14. A.
    It is the syntax for using capitalize method
    B.
    It modifies the value stored in the variable
    C.
    It indicates the termination of string
    D.
    None of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  15. What is the output of the given code?

    print "Hey"
       puts "Everyone!"
       print "We are learning Ruby"
  16. A.
    Error
    B.
    Hey everyone we are learning Ruby
    C.
    Hey everyone
    D.
    Hey Everyone

    View Answer

    Workspace

    Discuss Discuss in Forum


  17. Which sequence can be used to substitute the value of any ruby expression in a string?
  18. A.
    #(expr)
    B.
    #{expr}
    C.
    #expr
    D.
    None of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  19. What will be the output of the following?

    "Eric".irreverse
  20. A.
    Eric
    B.
    cirE
    C.
    undefined method
    D.
    None of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum