gs gs128 Java String Handling - StringBuffer Class in java - Quiz No.1
gs gs128 Java Quiz
This quiz belongs to book/course code gs gs128 Java of gs organization. We have 136 quizzes available related to the book/course Java. This quiz has a total of 10 multiple choice questions (MCQs) to prepare and belongs to topic Java String Handling. NVAEducation wants its users to help them learn in an easy way. For that purpose, you are free to prepare online MCQs and quizzes.
NVAEducation also facilitates users to contribute in online competitions with other students to make a challenging situation to learn in a creative way. You can create one to one, and group competition on an topic of a book/course code. Also on NVAEducation you can get certifications by passing the online quiz test.
Question 1: Which of these class is used to create an object whose character sequence is mutable?
String()
StringBuffer()
String() & StringBuffer()
None of the mentioned
Question 2: Which of this method of class StringBuffer is used to concatenate the string representation to the end of invoking string?
concat()
append()
join()
concatenate()
Question 3: Which of these method of class StringBuffer is used to find the length of current character sequence?
length()
Length()
capacity()
Capacity()
Question 5: Which of the following statement is correct?
reverse() method reverses all characters
reverseall() method reverses all characters
replace() method replaces first occurrence of a character in invoking string with another character
replace() method replaces last occurrence of a character in invoking string with another character
Question 10: What will be the output of the following Java program?
class output { class output { public static void main(String args[]) { char c[]={'A', '1', 'b' ,' ' ,'a' , '0'}; for (int i = 0; i < 5; ++i) { 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++; } } }
a is a lower case Letter is White space character
b is a lower case Letter is White space character
1 is a digit a is a lower case Letter
a is a lower case Letter 0 is a digit