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

Explore more Topics under C# programming

Q71.
What is output of the given set of Code?
class Program
 {
     static void Main(string[] args)
     { 
         String []chars = {"z", "x", "y", "z", "y"};
         for (int i = 0; i < chars.Length; ++i)
         for (int j = i + 1; j < chars.Length; ++j)
         if(chars[i].CompareTo(chars[j]) == 0)
         Console.WriteLine(chars[j]);
         Console.ReadLine();
     }
 }
Discuss
Answer: (c).zy
Q72.
What will be the output for the given set of code ?
String a = "Csharp";
String b = "CSHARP";
int c;
c = a.CompareTo(b);
Console.WriteLine(c);
Discuss
Answer: (d).-1
Q73.
Which of these methods of class String is used to separate a substring from a String object?
Discuss
Answer: (b).Substring()
Q74.
What will be the output for the given set of code?
static void Main(string[] args)
 {
     String a = "Ilove";
     String b = "CSHARP";
     b = string.Concat(a, '  ', b);
     Console.WriteLine(b);
     Console.ReadLine();
 }
Discuss
Answer: (d).Ilove CSHARP
Q75.
Which of these methods of class are used to remove the leading and backward whitespaces?
Discuss
Answer: (c).Trim()
Q76.
What will be the output for the given set of code?
static void Main(string[] args)
  {
      String a = "Ilove";
      String b = "CSHARP";
      b = string.Concat(a,' ',b);
      string d = b.TrimStart('I', 'l', 'o', 'H');
      Console.WriteLine(d);
      Console.ReadLine();
  }
Discuss
Answer: (c).ve CSHARP
Q77.
What will be the output for the given set of code?
static void Main(string[] args)
 {
     String c = "  Hello Computer ";
     String a = c.Trim();
     Console.WriteLine("\"" + s + "\"");
 }
Discuss
Answer: (c).β€œHello Computer”
Q78.
What will be the output for the given set of code?
static void Main(string[] args)
 {
     String c = "Hello";
     String a = c + "Bye";
     Console.WriteLine(a);
     Console.ReadLine();
 }
Discuss
Answer: (d).HelloBye
Q79.
What will be the output for the given set of code?
static void Main(string[] args)
{
    String c = "Hello";
    String a ;
    a = c.Replace('l', 'w');
    Console.WriteLine(a);
    Console.ReadLine();
}
Discuss
Answer: (d).Hewwo
Discuss
Answer: (c).replace() method replaces all occurrences of one character in invoking strings with another character

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!