adplus-dvertising

Welcome to the String Handling MCQs Page

Dive deep into the fascinating world of String Handling with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of String Handling, a crucial aspect of Java Programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of String Handling, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within Java Programming.

frame-decoration

Check out the MCQs below to embark on an enriching journey through String Handling. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of Java Programming.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of String Handling. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

String Handling MCQs | Page 2 of 6

Q11.
What is the output of this program?
    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);
        }
    }
Discuss
Answer: (d).llo i l
Q12.
What is the output of this program?
    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'));
        }
    }
Discuss
Answer: (a).6 4 6 9
Q13.
Which of these method of class String is used to compare two String objects for their equality?
Discuss
Answer: (a).equals()
Q14.
Which of these methods is used to compare a specific region inside a string with another specific region in another string?
Discuss
Answer: (d).regionMatches()
Q15.
Which of these methods of class String is used to check whether a given object starts with a particular string literal?
Discuss
Answer: (a).startsWith()
Q16.
Which of these data type value is returned by equals() method of String class?
Discuss
Answer: (c).boolean
Q17.
What is the output of this program?
    class output 
    {
        public static void main(String args[])
        { 
           String c = "Hello i love java";
           boolean var;
           var = c.startsWith("hello");
           System.out.println(var);
        }
    }
Discuss
Answer: (b).false
Q18.
What is the output of this program?
    class output 
    {
        public static void main(String args[])
        { 
           String s1 = "Hello i love java";
           String s2 = new String(s1);
           System.out.println((s1 == s2) + " " + s1.equals(s2));
        }
    }
Discuss
Answer: (d).false true
Q19.
Which of this method of class String is used to extract a substring from a String object?
Discuss
Answer: (a).substring()
Q20.
What will s2 contain after following lines of code?
 String s1 = "one";
String s2 = s1.concat("two")
Discuss
Answer: (c).onetwo
Page 2 of 6

Suggested Topics

Are you eager to expand your knowledge beyond Java Programming? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!