Read Also: MCQ Questions on C# with Answer
1. State whether the following statements about the collection classes are True or False.
i) Collection provides automatic memory management and capacity expansion.
ii) The System.Collection.Classes namespace provides various classes.
A) i-True, ii-False
B) i-True, ii-True
C) i-False, ii-True
D) i-False, ii-False
2. Which of the following are the most useful collection classes defined in C#.
i) ArrayList
ii) ByteArray
iii) Stack
iv) SortedList
A) i, ii and iii only
B) i, iii and iv only
C) ii, iii and iv only
D) All i, ii, iii and iv
3. … represents the ordered collection of an object that can be indexed individually.
A) ArrayList
B) BitArray
C) Stack
D) SortedList
4. Which of the following are the commonly used properties of the ArrayList class.
i) Capicity
ii) Count
iii) Key
iv) IsReadyOnly
A) i, ii and iii only
B) i, iii and iv only
C) i, ii and iv only
D) All i, ii, iii and iv
5. State whether the following statements about the Hashtable are True or False.
i) Hashtable uses key as well as an index to access the elements in the collection.
ii) Each item in the hash table has a key/value pair.
A) i-True, ii-False
B) i-True, ii-True
C) i-False, ii-True
D) i-False, ii-False
6. Which of the following are the commonly used properties of the SortedList class.
i) Capacity
ii) Count
iii) Item
iv) Length
A) i, ii and iii only
B) i, iii and iv only
C) i, ii and iv only
D) All i, ii, iii and iv
7. … is used when you need last-in, first-out access of items.
A) List
B) Stack
C) Array
D) Queue
8. … are the commonly used properties of the Hashtable class.
i) Count
ii) Item
iii) Values
iv) Keys
A) i, ii and iii only
B) i, iii and iv only
C) i, ii and iv only
D) All i, ii, iii and iv
9. State whether the following statements about SortedList are True or False.
i) SortedList is a combination of an array and a hash table.
ii) It contains a list of items that can be accessed using a key or an index.
A) i-True, ii-False
B) i-True, ii-True
C) i-False, ii-True
D) i-False, ii-False
10. The method … removes and returns the object at the top of the stack.
A) public virtual object delete();
B) public virtual void pop();
C) public virtual object clear();
D) public virtual object pop();
11. … is used when you need a first-in, first-out access of items.
A) Stack
B) List
C) Queue
D) Deque
12. The … property gets or sets the value of the bit at a specific position in the BitArray.
A) Item
B) ItemLength
C) Value
D) SetValue
13. The … property gets or sets the number of elements in the BitArray.
A) Number
B) Length
C) ItemLength
D) SetValue
14. The … property gets and sets the value associated with a specific key in the SortedList.
A) Values
B) KeyValues
C) Keys
D) Item
15. The … property gets or sets the number of elements that the ArrayList can contain.
A) Count
B) Item
C) Capacity
D) Length
16. The … method returns the zero-based index of the first occurance of a value in the ArrayList or in a portion of it.
A) public virtual int IndexOf(object);
B) public virtual int Index(object);
C) public virtual int IntexOf();
D) public virtual int FirstIndex();
17. The … method removes the element with the specified key from the Hashtable.
A) public virtual void Remove();
B) public virtual void Remove(object key);
C) public virtual void Clear(object key);
D) public virtual void Delete(object key);
18. The … method sets the capacity to the actual number of elements in the SortedList.
A) public virtual void Capacity();
B) public virtual void Size();
C) public virtual void TrimToSize();
D) public virtual void SetSize();
19. The … method removes and returns the object at the begining of the Queue.
A) public virtual void Dequeue();
B) public virtual void Delete();
C) public virtual void Clear();
D) public virtual object Dequeue();
20. The … method inverts all the bit values in the current BitArray so that elements set to True are changed to False, and elements set to False are changed to True.
A) public BitArray Not();
B) public BitArray Invert();
C) public BitArray Xor();
D) public BitArray SetInvert();
Answers:
- A) i-True, ii-False
- B) i, iii and iv only
- A) ArrayList
- C) i, ii and iv only
- C) i-False, ii-True
- A) i, ii and iii only
- B) Stack
- D) All i, ii, iii and iv
- B) i-True, ii-True
- D) public virtual object pop();
- C) Queue
- A) Item
- B) Length
- D) Item
- C) Capacity
- A) public virtual int IndexOf(object);
- B) public virtual void Remove(object key);
- C) public virtual void TrimToSize();
- D) public virtual object Dequeue();
- A) public BitArray Not();
Comments are closed.