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

Q81.
What will be the output of the given code snippet?
static void Main(string[] args)
  {
      String c = "Hello i love you";
      String a ;
      a = c.Substring(12, 3);
      Console.WriteLine(a);
      Console.ReadLine();
  }
Discuss
Answer: (c).yo
Q82.
Which among the following is the correct way to find out the index of second ‘s’ in the string “She sold her beauty in one night to someone else”?
a) 
   String a = "She sold her beauty in one night to someone else";
   int i;
   i = a.SecondIndexOf("s");

b) 
   String a = "She sold her beauty in one night to someone else";
   int i, j;
   i = a.FirstIndexOf("s");
   j = a.IndexOf("s", i + 1);

c) 
   String a = "She sold her beauty in one night to someone else";
   int i, j;
   i = a.IndexOf("s");
   j = a.IndexOf("s", i + 1);
Discuss
Answer: (c).c
Q83.
Which of these methods of the class String is used to obtain length of String object?
Discuss
Answer: (d).length()
Q84.
Which of these methods is an alternative to getChars() that stores the characters in an array of bytes?
Discuss
Answer: (a).getBytes()
Q85.
Which of these methods can be used to convert all characters in a String into a character array?
Discuss
Answer: (c).TocharArray()
Q86.
What will be the output of the given code snippet?
static void main(String args[])
 {
     char chars[] = {'x', 'y', 'z'};
     String s = new String(chars);
     Console.WriteLine(s);
 }
Discuss
Answer: (d).xyz
Q87.
Choose the effective stringBuilder method which helps in producing output for the given code?
static void Main(string[] args)
 {
     StringBuilder s = new StringBuilder("object");
     s./*______*/("Oriented Language");
     Console.WriteLine(s);
     Console.ReadLine();
 }
Output : objectOriented Language
Discuss
Answer: (c).Append()
Q88.
What will be the output for the given code snippet?
static void Main(string[] args)
  {
      string s = " i love you";
      Console.WriteLine(s.IndexOf('l') + "  " + s.lastIndexOf('o') + "  " + s.IndexOf('e'));
      Console.ReadLine();
  }
Discuss
Answer: (c).3 9 6
Q89.
Which of these methods of class String is used to extract all the characters from a String object?
Discuss
Answer: (b).Remove()
Q90.
What will be the output of the given code snippet?
static void Main(string[] args)
 {
     string c = "hello";
     string  c1 = c.Remove(1);
     Console.WriteLine(c1);
     Console.ReadLine();
 }
Discuss
Answer: (b).h

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!