Top 150+ Solved C# Programming MCQ Questions Answer
Q. Which of the following statements is correct about constructors in C#.NET?
a. A constructor cannot be declared as private
b. A constructor cannot be overloaded
c. A constructor can be a static constructor
d. None of the mentioned
Q. Which method have same name as that of its class?
a. delete
b. class
c. constructor
d. None of mentioned
Q. Which of following statement are correct about functions?
a. C# allows a function to have arguments with default values
b. Redefining a method parameter in the method’s body causes an exception
c. C# allows function to have arguments of private type
d. Omitting the return type in method definition results into exception
Q. Which of the following statements are correct about an ArrayList collection thatimplements 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.
a. 1 and 2 only
b. 1,3 and 4 only
c. 2 and 5 only
d. None of the above
Q. In which of the following collections is the Input/Output index-based? 1. Stack 2. Queue 3. BitArray 4. ArrayList 5. HashTable
a. 1 and 2 only
b. 3 and 4 only
c. 5 only
d. 1, 2 and 5 only
Q. Which of the following statements are correct about the Stack collection? 1. It can be used for evaluation of expressions. 2. All elements in the Stack collection can be accessed using an enumerator. 3. It is used to maintain a FIFO list. 4. All elements stored in a Stack collection must be of similar type. 5. Top-most element of the Stack collection can be accessed using the Peek() method.
a. 1 and 2 only
b. 3 and 4 only
c. 1, 2 and 5 only
d. All of the above
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);
a. IEnumerator e; e = q.GetEnumerator(); while (e.MoveNext()) Console.WriteLine(e.Current);
b. IEnumerable e; e = q.GetEnumerator(); while (e.MoveNext()) Console.WriteLine(e.Current);
c. IEnumerator e; e = q.GetEnumerable(); while (e.MoveNext()) Console.WriteLine(e.Current);
d. IEnumerator e; e = Queue.GetEnumerator(); while (e.MoveNext()) Console.WriteLine(e.Current);
Q. Which of the following statements is incorrect about delegate?
a. Delegates are reference types.
b. Delegates are object oriented.
c. Delegates are type-safe.
d. Only one method can be called using a delegate.
Q. Which of the following statements are correct about the delegate declaration given below? delegate void del(int i); 1. On declaring the delegate a class called del will get created. 2. The signature of del need not be same as the signature of the method that we intend to call using it. 3. The del class will be derived from the MulticastDelegate class. 4. The method that can be called using del should not be a static method. 5. The del class will contain a one-argument constructor and an lnvoke() method.
a. 1, 2 and 3 only
b. 1, 3 and 5 only
c. 2 and 4 only
d. 4 only
Q. What is a delegate?
a. A strongly typed function pointer.
b. A light weight thread or process that can call a single method.
c. A reference to an object in a different process.
d. An inter-process message channel.
Q. Which of the following is included in Visual Studio IDE?
a. Form Designer
b. Code Editor
c. Solution Explorer
d. All of the above
Q. Which of the following is true about dispose() method?
a. This method is protected.
b. Its return type is int.
c. It accepts a float parameter.
d. All of the above.