Arrays and String java MCQs
Quiz by Tamil selvi
Feel free to use or edit a copy
includes Teacher and Student dashboards
Measure skillsfrom any curriculum
Measure skills
from any curriculum
Tag the questions with any skills you have. Your dashboard will track each student's mastery of each skill.
With a free account, teachers can
- edit the questions
- save a copy for later
- start a class game
- automatically assign follow-up activities based on students’ scores
- assign as homework
- share a link with colleagues
- print as a bubble sheet
35 questions
Show answers
- Q1Which method in Java is used to find the length of a string?count()length()lengthsize()30s
- Q2Which method in Java is used to concatenate two strings?merge()append()concat()join()30s
- Q3Which method in Java is used to convert a string to lowercase?convertToLower()changeCase()toLowerCase()toUpperCase()30s
- Q4Which method in Java is used to replace a specific character or substring within a string?replaceAll()substring()insert()replace()30s
- Q5Which method is used to find the index of a specific character in a string in Java?indexOfsearchlocatefind30s
- Q6Which method is used to extract a substring from a string in Java?substringsplitsliceextract30s
- Q7Which method is used to compare two strings for equality in Java?comparecheckequalsequalTo30s
- Q8Which method is used to convert an integer to a string in Java?intToStringconvertToStringtoStringparse30s
- Q9Which of the following constructors is used to create an empty String object?String()String(null)None of the aboveString("")30s
- Q10What 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 abcabcbCompile Time Error30s
- Q11What 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)); }}PVOA30s
- Q12String object is ___________ in java.interfacemutableimmutablemethod30s
- Q13Which of the following String method removes beginning and ending spaces of the given string.intern()fork()join()trim()30s
- Q14What 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);}}Oswaalcompilation errorruntime errorOswaalPublication30s
- Q15What 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));}}truefalse1030s