
Strings
Quiz
•
Computers
•
University
•
Practice Problem
•
Hard
sudha reddy
Used 1+ times
FREE Resource
Enhance your content in a minute
12 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following Java code?
class output
{
public static void main(String args[])
{
char ch;
ch = "hello".charAt(1);
System.out.println(ch);
}
}
h
e
l
o
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following Java code?
class output
{
public static void main(String args[])
{
char c[]={'a', '1', 'b' ,' ' ,'A' , '0'};
for (int i = 0; i < 5; ++i)
{
if(Character.isDigit(c[i]))
System.out.println(c[i]+" is a digit");
if(Character.isWhitespace(c[i]))
System.out.println(c[i]+" is a Whitespace character");
if(Character.isUpperCase(c[i]))
System.out.println(c[i]+" is an Upper case Letter");
if(Character.isLowerCase(c[i]))
System.out.println(c[i]+" is a lower case Letter");
i=i+3;
}
}
}
1.a is a lower case Letter
2. is White space character
1.b is a lower case Letter
2. is White space character
1.a is a lower case Letter
2.A is an upper case Letter
1.a is a lower case Letter
2.b is a lower case Letter
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following Java code?
class output
{
public static void main(String args[])
{
String a = "hello i love java";
System.out.println(a.indexOf('i')+" "+a.indexOf('o') +" "+a.lastIndexOf('i')+" "+a.lastIndexOf('o'));
}
}
6 4 6 9
5 4 5 9
7 8 8 9
4 3 6 9
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following Java code?
class output
{
public static void main(String args[])
{
String c = "Hello i love java";
int start = 2;
int end = 9;
char s[]=new char[end-start];
c.getChars(start,end,s,0);
System.out.println(s);
}
}
Hello, i love java
i love ja
lo i lo
llo i l
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of these methods can be used to convert all characters in a String into a character array?
charAt()
both getChars() & charAt()
both toCharArray() & getChars()
all of the mentioned
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following Java program?
class string_class
{
public static void main(String args[])
{
String obj = "I LIKE JAVA";
System.out.println(obj.length);
}
11
9
12
Error
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following statements are incorrect?
String is a class
Strings in java are mutable
Every string is an object of class String
Java defines a peer class of String, called StringBuffer, which allows string to be altered
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
15 questions
Introduction to Django Framework Quiz
Quiz
•
University
11 questions
SAINS KOMPUTER 1.3
Quiz
•
University
10 questions
CC 105 - Quiz 2 FINAL TERM
Quiz
•
University
15 questions
LATIHAN SOAL PEMROGRAMAN
Quiz
•
9th Grade - University
10 questions
INTRODUCCION A LA PROGRAMACION
Quiz
•
6th Grade - University
10 questions
Hyrje në SO
Quiz
•
University
17 questions
Lección1 - JavaScript
Quiz
•
1st Grade - Professio...
16 questions
IX SIMPOSIO INTERNACIONALIZACIÓN DE INGENIERÍA DE SISTEMAS
Quiz
•
University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
