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 15 of 16

Explore more Topics under C# programming

Q141.
What will be the output of give code snippet?
class Program
{
    static void Main(string[] args)
    {
        String s1 = "Hello i love Csharp";
        StringBuilder s2 = new  StringBuilder(s1);
        Console.WriteLine(s1.Equals(s2));
        Console.ReadLine();
    }
}
Discuss
Answer: (b).False
Q142.
Which of these methods of class String is used to check whether a given string starts with a particular substring or not?
Discuss
Answer: (a).StartsWith()
Q143.
Which of these methods of class String is used to extract a substring from a String object?
Discuss
Answer: (b).Substring()
Q144.
What is the output for the given code snippet?
class Program
{
    static void Main(string[] args)
    {
        String s1 = "one";
        String s2 = string.Concat(s1 + " " + "two");
        Console.WriteLine(s2);
        Console.ReadLine();
    }
}
Discuss
Answer: (c).one two
Q145.
Which of these methods of class String is used to remove leading and trailing whitespaces?
Discuss
Answer: (c).Trim()
Q146.
What will be the output of the given code snippet?
class Program
{
    static void Main(string[] args)
    {
        String c = "  Hello World  ";
        String s = c.Trim();
        Console.WriteLine("""+s+""");
        Console.ReadLine();
    }
}
Discuss
Answer: (c).β€œHello World”
Q147.
What will be the output of the code snippet?
class Program
 {
     static void Main(string[] args)
     {
         String s1 = "CSHARP";
         String s2 = s1.Replace('H','L');
         Console.WriteLine(s2);
         Console.ReadLine();
     }
 }
Discuss
Answer: (c).CSHALP
Q148.
What will be the output of the code snippet?
class Program
 {
     static void Main(string[] args)
     {
         String s1 = "Hello World";
         String s2 = s1.Substring(0, 4);
         Console.WriteLine(s2);
         Console.ReadLine();
     }
 }
Discuss
Answer: (b).Hell
Q149.
What will be the output of the given code snippet?
class Program
 {
     static void Main(string[] args)
     {
         String s = "Hello World";
         int i = s.IndexOf('o');
         int j = s.LastIndexOf('l');
         Console.WriteLine(i + " " + j);
         Console.ReadLine();
     }
 }
Discuss
Answer: (b).4 9
Q150.
What will be the output of the given code snippet?
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

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!