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/35
Score 0
Which method in Java is used to find the length of a string?
30
count()
length()
length
size()
Q 2/35
Score 0
Which method in Java is used to concatenate two strings?
30
merge()
append()
concat()
join()
35 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 correct way to declare an array of integers in Java?
20
30 sec
Q.
How do you access the third element of an array named 'numbers' in Java?
21
30 sec
Q.
Which of the following is the correct way to find the length of an array named 'numbers' in Java?
22
30 sec
Q.
How do you assign a value of 10 to the first element of an array named 'numbers' in Java?
23
30 sec
Q.
Which of the following is the correct way to iterate over an array named 'numbers' in Java?
24
30 sec
Q.
What is the output of the following Java code snippet? int[] numbers = {1, 2, 3, 4, 5}; System.out.println(numbers[2]);
25
30 sec
Q.
What is the correct syntax to create a two-dimensional array named 'matrix' with 3 rows and 4 columns in Java?
26
30 sec
Q.
Which of the following is the correct way to access the element at row 2, column 3 in a two-dimensional array named 'matrix' in Java?
27
30 sec
Q.
Which of the following statements correctly initializes an array named `numbers` of type `int` with size 5?
28
30 sec
Q.
What is the index of the last element in an array named `arr` with a length of 10?
29
30 sec
Q.
What is the output of the following Java code?```int[] numbers = {3, 5, 7, 9, 11};System.out.println(numbers.length);```
30
30 sec
Q.
class Test1 {
public
static void main(String[] args)
{
int arr[] = { 11, 22, 33 };
for (int i = 0; i < arr.length; i++)
System.out.print(arr[i] + " ");
System.out.println();
int arr2[] = new int[3];
arr2[] = { 11, 22, 33 };
for (int i = 0; i < arr2.length; i++)
System.out.print(arr2[i] + " ");
}
}
31
30 sec
Q.
Which of the following is the correct syntax to initialize and assign values to an array named `grades` with the values 85, 90, 72, and 78 in Java?
32
30 sec
Q.
Which of the following statements correctly assigns the value 10 to the first element of an array named `numbers` of type `int`?
33
30 sec
Q.
class Test4 {
public
static void main(String[] args)
{
int number = 11;
int NUMBER = 22;
int Number = 33;
System.out.print(number + " ");
System.out.print(NUMBER + " ");
System.out.println(Number);
}
}
34
30 sec
Q.
What is the output of this question?
class Test5 {
public
static void main(String[] args)
{
String str[] = { "geeks", "for", "geeks" };
System.out.print(str[0] + str[1] + str[2]);
}
}