R

Ram Sharma • 193.86K Points
Coach

Q. What will be the output of the following C# code?

Code:
using System;

class Program {
  static void Main(string[] args) {
    String str = "Hello";
    Console.WriteLine(str.IndexOf('h'));
  }
}
  • (A) 0
  • (B) 1
  • (C) -1
  • (D) Error
  • Correct Answer - Option(C)
  • Views: 168
  • Filed under category C#

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Related MCQs on C#

Q. Which of the following is the correct way to access all elements of the Queue collection created using the C#.NET code snippet given below? Queue q = new Queue(); q.Enqueue("Sachin"); q.Enqueue('A'); q.Enqueue(false); q.Enqueue(38); q.Enqueue(5.4);

Q. A class implements two interfaces each containing three methods. The class contains no instance data. Which of the following correctly indicate the size of the object created from this class?

Q. Which of the following statements are correct about an ArrayList collection that implements the IEnumerable interface? 1. The ArrayList class contains an inner class that implements the IEnumerator interface. 2. An ArrayList Collection cannot be accessed simultaneously by different threads. 3. The inner class of ArrayList can access ArrayList class's members. 4. To access members of ArrayList from the inner class, it is necessary to pass ArrayList class's reference to it. 5. Enumerator's of ArrayList Collection can manipulate the array.

Q. An instance of a reference type variable is allocated memory on_______.

Q. Select a convenient declaration and initialization of a floating point number:

Q. Which is the base class of the String() Constructor?

Q. How can you prevent inheritance from a class in C#.NET ?

Q. Which of the following is the correct way to access all elements of the Queue collection created using the C#.NET code snippet given below Queue q = new Queue(); q.Enqueue("Sachin"); q.Enqueue('A'); q.Enqueue(false); q.Enqueue(38); q.Enqueue(5.4);

Q. What will be the output of the following C# code?

Q. Which of the following statements correctly define .NET Framework?

Learn All C# MCQs


Question analytics