placeholder image to represent content

Arrays and String java MCQs

Quiz by Tamil selvi

Our brand new solo games combine with your quiz, on the same screen

Correct quiz answers unlock more play!

New Quizalize solo game modes
35 questions
Show answers
  • Q1
    Which method in Java is used to find the length of a string?
    count()
    length()
    length
    size()
    30s
  • Q2
    Which method in Java is used to concatenate two strings?
    merge()
    append()
    concat()
    join()
    30s
  • Q3
    Which method in Java is used to convert a string to lowercase?
    convertToLower()
    changeCase()
    toLowerCase()
    toUpperCase()
    30s
  • Q4
    Which method in Java is used to replace a specific character or substring within a string?
    replaceAll()
    substring()
    insert()
    replace()
    30s
  • Q5
    Which method is used to find the index of a specific character in a string in Java?
    indexOf
    search
    locate
    find
    30s
  • Q6
    Which method is used to extract a substring from a string in Java?
    substring
    split
    slice
    extract
    30s
  • Q7
    Which method is used to compare two strings for equality in Java?
    compare
    check
    equals
    equalTo
    30s
  • Q8
    Which method is used to convert an integer to a string in Java?
    intToString
    convertToString
    toString
    parse
    30s
  • Q9
    Which of the following constructors is used to create an empty String object?
    String()
    String(null)
    None of the above
    String("")
    30s
  • Q10
    What is the output of the following code? public class T{ public static void main(String []args) { char chars[] = {‘a’, ‘b’, ‘c’}; String str = new String(chars); System.out.println(str);}}
    c abc
    abc
    b
    Compile Time Error
    30s
  • Q11
    What is the output of the following code? public class Test{ public static void main(String []args) { String str = “JAVA IS A PROGRAMMING LANGUAGE”; System.out.println(str.charAt(10)); }}
    P
    V
    O
    A
    30s
  • Q12
    String object is ___________ in java.
    interface
    mutable
    immutable
    method
    30s
  • Q13
    Which of the following String method removes beginning and ending spaces of the given string.
    intern()
    fork()
    join()
    trim()
    30s
  • Q14
    What is the output of the following code segment? class StringTest{ public static void main(String args[]){ String name=”Oswaal”; name.concat(“Publication”); System. out.println(name);}}
    Oswaal
    compilation error
    runtime error
    OswaalPublication
    30s
  • Q15
    What is the output of the following code? public class Test{ public static void main(String [] args) { String str1 = “Eye”; String str2 = “Arm”; System.out.println(str1.charAt(0) > str2. charAt(0));}}
    true
    false
    1
    0
    30s

Teachers give this quiz to your class