MCQOPTIONS
Saved Bookmarks
This section includes 11 Mcqs, each offering curated multiple-choice questions to sharpen your C Sharp Programming knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Which among the following is the correct way to access all the elements of the Stack collection created using the C#.NET code snippet given below? |
| A. | IEnumerable e;e = st.GetEnumerator();while (e.MoveNext())Console.WriteLine(e.Current); |
| B. | IEnumerator e;e = st.GetEnumerator();while(e.MoveNext())Console.WriteLine(e.Current); |
| C. | IEnumerable e;e = st.GetEnumerable();while(e.MoveNext())Console.WriteLine(e.Current); |
| D. | None of the mentioned |
| Answer» C. IEnumerable e;e = st.GetEnumerable();while(e.MoveNext())Console.WriteLine(e.Current); | |
| 2. |
The correct code to access all the elements of the queue collection created using the C#.NET code snippets given below is? |
| A. | IEnumerator e;e = q.GetEnumerator();while(e.MoveNext())Console.WriteLine(e.Current); |
| B. | IEnumerable e;e = q.GetEnumerator();while(e.MoveNext()) |
| C. | IEnumerable ee = q.GetEnumerable();while(e.MoveNext())Console.WriteLine(e.Current); |
| D. | All of the mentioned |
| Answer» B. IEnumerable e;e = q.GetEnumerator();while(e.MoveNext()) | |
| 3. |
Which of the following is an ordered collection class?1. Map2. Stack3. Queue4. BitArray5. HashTable |
| A. | 1 only |
| B. | 2 and 3 only |
| C. | 4 and 5 only |
| D. | All of the above |
| Answer» C. 4 and 5 only | |
| 4. |
Which of the following statements are correct about a HashTable collection?1. It is a keyed collection.2. It is a ordered collection.3. It is an indexed collection.4. It implements a IDictionaryEnumerator interface in its inner class.5. The key - value pairs present in a HashTable can be accessed using the Keys and Values properties of the inner class that implements the IDictionaryEnumerator interface. |
| A. | 1 and 2 only |
| B. | 1, 2 and 3 only |
| C. | 4 and 5 only |
| D. | 1, 4 and 5 only |
| Answer» E. | |
| 5. |
Which statement is correct about the C#.NET code snippet given below? |
| A. | Unsimilar elements like “Csharp”,7.3,8 cannot be stored in the same stack collection. |
| B. | Boolean values can never be stored in Stack collection |
| C. | Perfectly workable code |
| D. | All of the mentioned |
| Answer» D. All of the mentioned | |
| 6. |
A HashTable t maintains a collection of names of states and capital city of each state.Which among the following finds out whether “New delhi” state is present in the collection or not? |
| A. | t.HasValue(“New delhi”); |
| B. | t.ContainsKey(“New delhi”); |
| C. | t.HasKey(“New delhi”); |
| D. | t.ContainsValue(“New delhi”); |
| Answer» C. t.HasKey(“New delhi”); | |
| 7. |
What is the value of double constant ‘E’ defined in Math class? |
| A. | approximately 3 |
| B. | approximately 3.14 |
| C. | approximately 2.72 |
| D. | approximately 0 |
| Answer» D. approximately 0 | |
| 8. |
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 |
| Answer» D. All of the above | |
| 9. |
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. |
| A. | 1 and 2 only |
| B. | 1 and 3 and 4 only |
| C. | 2 and 5 only |
| D. | All of the above |
| Answer» C. 2 and 5 only | |
| 10. |
In which of the following collections is the Input/Output index-based?1. Stack2. Queue3. BitArray4. ArrayList5. HashTable |
| A. | 1 and 2 only |
| B. | 3 and 4 only |
| C. | 5 only |
| D. | 1, 2 and 5 only |
| Answer» C. 5 only | |
| 11. |
In which of the following collections is the Input/Output based on a key?1. Map2. Stack3. BitArray4. HashTable5. SortedList |
| A. | 1 and 2 only |
| B. | 2 and 3 only |
| C. | 1, 2 and 3 only |
| D. | 4 and 5 only |
| Answer» E. | |