- 2
Module 9 Quiz Q2
what is the answer to Q2 in the module 9 Quiz? ([] spaces for answers required) [] Temp [] { T x; public [] Func() { [] x; } } possible answers: <x>, T, x, class, <T>, static, return
7 Answers
+ 2
HashSet<int> hs = new HashSet<int>();
for(int x = 1; x <= 5; x++) {
hs.Add(x);
}
Console.Write(hs.Count);
+ 1
class Temp <T>{
T x;
public T Func() {
return x; }
}
+ 1
Answer:
Queue<int> q = new Queue<int>();
for (int x = 1; x <= 5; x++)
q.Enqueue(x);
foreach (int val in q)
Console.Write(val + " ");
- 1
Queue<int> q = new Queue<int>();
for (int x = 1; x <= 5; x++)
q.Enqueue(x);
foreach (int val in q)
Console.Write(val + " ");
- 1
Queue<int> q = new Queue<int>();
for (int x = 1; x <= 5; x++)
q.Enqueue(x);
foreach (int val in q)
Console.Write(val + " ");
- 1
Queue<int> q = new Queue<int>();
for (int x = 1; x <= 5; x++)
q.Enqueue(x);
foreach (int val in q)
Console.Write(val + " ");
- 3
Module 9 : Quiz
Question 3.
Reorder the code to declare a Queue of integers, add values 1 through 5 and print the contents of the Queue.
Queue<int> q = new Queue<int>();
q.Enqueue(x);
for (int x = 1; x <= 5; x++)
Console.Write(val + " ");
foreach (int val in q)