Home / CSE MCQs / JAVA MCQs :: Strings - Java

CSE MCQs :: JAVA MCQs

  1. Which of these class is superclass of String and StringBuffer class?
  2. A.
    java.util
    B.
    java.lang
    C.
    ArrayList
    D.
    None of the mentioned

  3. Which of these operators can be used to concatenate two or more String objects?
  4. A.
    +
    B.
    +=
    C.
    &
    D.
    ||

  5. Which of these method of class String is used to obtain length of String object?
  6. A.
    get()
    B.
    Sizeof()
    C.
    lengthof()
    D.
    length()

  7. Which of these method of class String is used to extract a single character from a String object?
  8. A.
    CHARAT()
    B.
    charat()
    C.
    charAt()
    D.
    ChatAt()

  9. Which of these constructors is used to create an empty String object?
  10. A.
    String()
    B.
    String(void)
    C.
    String(0)
    D.
    None of the mentioned

  11. Which of these is an oncorrect statement?
  12. A.
    String objects are immutable, they cannot be changed.
    B.
    String object can point to some other reference of String variable.
    C.
    StringBuffer class is used to store string in a buffer for later use.
    D.
    None of the mentioned

  13. Which of these method of class String is used to compare two String objects for their equality?
  14. A.
    equals()
    B.
    Equals()
    C.
    isequal()
    D.
    Isequal()

  15. Which of these methods is used to compare a specific region inside a string with another specific region in another string?
  16. A.
    regionMatch()
    B.
    match()
    C.
    RegionMatches()
    D.
    regionMatches()

  17. Which of these method of class String is used to check weather a given object starts with a particular string literal?
  18. A.
    startsWith()
    B.
    endsWith()
    C.
    Starts()
    D.
    ends()

  19. What is the value returned by unction compareTo() if the invoking string is less than the string compared?
  20. A.
    zero
    B.
    value less than zero
    C.
    value greater than zero
    D.
    None of the mentioned