adplus-dvertising

Welcome to the Arrays and Strings MCQs Page

Dive deep into the fascinating world of Arrays and Strings with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Arrays and Strings, a crucial aspect of C# programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of Arrays and Strings, 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 C# programming.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Arrays and Strings. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of C# programming.

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

Arrays and Strings MCQs | Page 7 of 16

Q61.
What is output for the set of code?
static void Main(string[] args)
 {
     String obj = "hello";
     String obj1 = "world";   
     String obj2 = obj;
     string s = obj + "  " + obj1;
     Console.WriteLine(s.Substring(6 ,5));
     Console.ReadLine();
 }
Discuss
Answer: (c).world
Q62.
What will be the output for the set of given code?
static void Main(string[] args)
 {
     String obj = "hello";
     String obj1 = "worn";   
     String obj2 = obj;
     Console.WriteLine(obj + "  " + (obj1.Replace('w' ,'c')));
     Console.ReadLine();
 }
Discuss
Answer: (c).hello corn
Q63.
Which of these methods of class String is used to compare two String objects for their equality?
Discuss
Answer: (a).equals()
Q64.
Which of these methods is used to compare two strings such that after comparison output returns different integer values as ( 0 for false, 1 for true)?
Discuss
Answer: (c).Compare()
Q65.
Which of these methods of class String is used to check whether a substring exists at the beginning of the particular string?
Discuss
Answer: (a).StartsWith()
Q66.
Which of these methods returns the string such that some characters which are specified to be removed from the end of strings are removed from string by mentioning the number of characters to be removed?
Discuss
Answer: (a).Trim()
Q67.
What is the value returned by function compareTo() if the invoking string is less than the string compared?
Discuss
Answer: (b).value less than zero
Q68.
Which of these data type values is returned by equals() method of String class?
Discuss
Answer: (c).boolean
Q69.
What is output of the given set of Code?
class Program
 {
     static void Main(string[] args)
     { 
         String c = "i love Csharp";
         bool a;
         a = c.StartsWith("I");
         Console.WriteLine(a);
         Console.ReadLine();
     }
 }
Discuss
Answer: (b).false
Q70.
What is the output of the given set of Code?
class Program
{
    static void Main(string[] args)
    { 
        String s1 = "I love You";
        String s2 = s1;
        Console.WriteLine((s1 == s2) + " " + s1.Equals(s2));
        Console.ReadLine();
    }
}
Discuss
Answer: (a).true true

Suggested Topics

Are you eager to expand your knowledge beyond C# 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!