C# Programming - Collection Classes - Discussion
Discussion Forum : Collection Classes - General Questions (Q.No. 6)
6.
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);
Discussion:
4 comments Page 1 of 1.
Syed said:
1 decade ago
Since Push method take parameter as object. Hence any data type can be stored in the Stack object.
Farhat said:
1 decade ago
At the very first line we can't declare stack like that we have to define the generic type of stack here.
Sridhar said:
7 years ago
Only value data type can stored stack. Then how option E is right?
Sangeetha.t said:
6 years ago
Implement collection namespace. So you can see a stack option. In which it accepts all data type because it requires only an object not a specific datatype.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers