Home / MCQ Bank / Computer
Computer Miscellaneous In C Sharp

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? Stack st = new Stack(); st.Push(10); st.Push(20); st.Push(-5); st.Push(30); st.Push(6);

Select the best option to verify your answer:
Show Correct Answer
Correct Answer: Option B • IEnumerator e; e = st.GetEnumerator(); while(e.MoveNext()) Console.WriteLine(e.Current)

Related Computer Questions

We can dump() R objects to a file by passing ______ Which of the following is not a valid variable name declaration? What is the purpose of method overriding in Ruby? What will be the output of the following R code? > x <- c(1, 2, NaN, NA, 4) > is.na(x) An electrical inter-connection that permit 8 or more bits of data to be moved in the same instant of time is called