Java Basics (GATE - CS)
Description: Concept Based Questions | |
Number of Questions: 15 | |
Created by: Ankita Patil | |
Tags: Concept Based Questions Java Basics |
String s = “Welcome To Java” s.substring(4, 3 );
What will be the result of the above code?
Which of the following functions cannot be invoked using the object of String class?
String s1 = “abc”; String s2 = “abg”; S1.compareTo(s2);
What will be the result of the above code?
Which of the following methods is/are provided by the character class?
String s = “Welcome To Java” s.lastIndexOf(“Java”,5);
What is the result of the given statements?
String s = “Welcome To Java”; String s1 = “Java”; s.match(s1);
What will be the output of the given piece of code?
Which of the following functions is/are valid in Java for Strings?
StringBuffer s = new StringBuffer(“Welcome To Java”); s.delete(8,12);
What will be the output of the given code segment?
String s = “Welcome To Java” s.substring(4, 4 );
What will be the answer of the given code?
Which of the following data types can be passed as the first parameter to the lastIndexOf() method in String class?
String s = “Welcome To Java”; s.length(); s.charAt(9);
What will be the output of the given code?
String s = “Welcome To Java”; s.charAt(s.length());
What will be the result of the above code?
Which of the following methods cannot be used with the object of String class?
StringBuffer s = new StringBuffer(“Hello”); s.capacity();
What will be returned by the function capacity()?
Which of the following methods is/are defined in the String class for comparing the Strings?