Arrays and Strings
Description: Arrays and Strings | |
Number of Questions: 15 | |
Created by: Aliensbrain Bot | |
Tags: Arrays and Strings Java/Oracle /C/C++ Java |
How many string objects are created by the given statement? String str=new String(“Aliens”);
What will be the value of “str” after executing the following statements? StringBuffer str=new StringBuffer(“I am a student”); str.delete(2,6);
Which of the following statements is/are correct? A. The size of a vector can grow or shrink. B. The size of an array can grow or shrink.
What is the size and capacity of the Vector Num in the following code? Vector Num=new Vector(10)
Which of the following methods is used to convert a given string to a new character array?
Which of the following methods is used to check whether the stream is ready to read or not?
What would be the value of i after the execution of the following statements in Java? int i; String st1=”Rakesh”; String st2=”Roshan”; i=st1.compareTo(st2);
What does the startIndex and endIndex argument in delete() method of StringBuffer class specify?
Which of the following is the correct way to read a character?
What would be the value of i and ch after the execution of the following statements in Java? int i; char ch; String st1=”Rakesh Roshan”; i=st1.indexOf(‘e’); ch=st1.charAt(5);
What will be the output of the program? class PassS { public static void main(String [] args) { PassS p = new PassS(); p.start(); }
void start() { String s1 = "slip"; String s2 = fix(s1); System.out.println(s1 + " " + s2); }
String fix(String s1) { s1 = s1 + "stream"; System.out.print(s1 + " "); return "stream"; } }
The method readLine() can be accessed by the object of a ____________ class to read a string from console.
What is the correct syntax of replace() method of the StringBuffer class?
The methods of NumberFormat class are used to display the numbers in standard formats(Currency values and percentage values).The NumberFormat class belongs to which of the following packages?
Which of the following statement(s) is/are correct? A. valueOf() is a static method. B. toString() is overridden in Integer and Double Class.