Tag the questions with any skills you have. Your dashboard will track each student's mastery of each skill.
Give this quiz to my class
Q 1/38
Score 0
Which method in Java is used to find the length of a string?
30
count()
length()
length
size()
Q 2/38
Score 0
Which method in Java is used to concatenate two strings?
30
merge()
append()
concat()
join()
38 questions
Q.
Which method in Java is used to find the length of a string?
1
30 sec
Q.
Which method in Java is used to concatenate two strings?
2
30 sec
Q.
Which method in Java is used to convert a string to lowercase?
3
30 sec
Q.
Which method in Java is used to replace a specific character or substring within a string?
4
30 sec
Q.
Which method is used to find the index of a specific character in a string in Java?
5
30 sec
Q.
Which method is used to extract a substring from a string in Java?
6
30 sec
Q.
Which method is used to compare two strings for equality in Java?
7
30 sec
Q.
Which method is used to convert an integer to a string in Java?
8
30 sec
Q.
Which of the following constructors is used to create an empty String object?
9
30 sec
Q.
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);}}
10
30 sec
Q.
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)); }}
11
30 sec
Q.
String object is ___________ in java.
12
30 sec
Q.
Which of the following String method removes beginning and ending spaces of the given string.
13
30 sec
Q.
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);}}
14
30 sec
Q.
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));}}
15
30 sec
Q.
What will be the output of the following Java program?
class string_test {
public static void main(String args[]) {
String obj = âmateâ;
String obj1 = âhandâ;
String obj2 = âmateâ;
System.out.println(obj. equals(obj1) + â â + obj.equals(obj2));}}
16
30 sec
Q.
What will be the output of the following code segment?String str1 = âoswaalâ;System.out. println(str1.substring(1,4));
17
30 sec
Q.
What will be the output of the following code segment?String str1 = âSchoolâ;System.out. println(str1.indexOf(âAâ));
18
30 sec
Q.
What will be the output of the following code segment?
public class Test {public static void main(String[] args) {
String S1 = âS1 =â+ â123â + â456â;
String S2 = âS2 =â+(123+456);
System.out. println(S1);System.out.println(S2);}}
19
30 sec
Q.
What is the Output Of the following Program
class demo9 {
public static void main(String args[])
{
String str = "Java Programming";
String str1 = "Java";
if (str.startsWith("J"))
System.out.println("Start Same");
if (str.endsWith("T"))
System.out.println("End Same");
}
}
20
30 sec
Q.
Which method is used to find the length of a string in Java?
21
30 sec
Q.
What method is used to convert a string to lowercase in Java?
22
30 sec
Q.
Which method is used to concatenate two strings in Java?
23
30 sec
Q.
What does the 'substring' method do in Java?
24
30 sec
Q.
What will be the output of the following code: String str = "Hello"; System.out.println(str.charAt(1));
25
30 sec
Q.
How do you check if a string is empty in Java?
26
30 sec
Q.
Which method would you use to split a string into an array based on a delimiter in Java?
27
30 sec
Q.
What will be the result of the following code: String str = "Java"; str += " Programming"; System.out.println(str);
28
30 sec
Q.
Which method is used to compare two strings for equality in Java?
29
30 sec
Q.
What will the following code print: String str = "Hello, World!"; System.out.println(str.indexOf('W'));
30
30 sec
Q.
Which of the following is used to concatenate two Strings in Java?
31
30 sec
Q.
Which method would you use to convert a String to uppercase in Java?
32
30 sec
Q.
Which method is used to check if a String starts with a specific prefix in Java?
33
30 sec
Q.
What method would you use to remove whitespace from both ends of a String in Java?
34
30 sec
Q.
What is the return type of the String method indexOf() in Java?
35
30 sec
Q.
Which method in Java is used to check if a String contains a specific sequence of characters?
36
30 sec
Q.
What is the result of comparing two Strings with == in Java?
37
30 sec
Q.
What will be the output of the following code: String s = "Hello"; System.out.println(s.charAt(1)); ?