Friday 16 December 2011

38.Which of the following statements are correct about the C#.NET code snippet given below?

Stack st = new Stack();
st.Push("hello");
st.Push(8.2);
st.Push(5);
st.Push('b');
st.Push(true);
A.Dissimilar elements like "hello", 8.2, 5 cannot be stored in the sameStack collection.
B.Boolean values can never be stored in Stack collection.
C.In the fourth call to Push(), we should write "b" in place of 'b'.
D.To store dissimilar elements in a Stack collection, a method PushAnyType()should be used in place of Push().
E.This is a perfectly workable code.
Answer: Option E