Q1medium
Trace the output:
set = new HashSet();
set.add("A");
set.add("B");
set.add("A");
print(set.size());
Topic-wise practice questions for Programming (C++ / Java / Python). Test your knowledge, check solutions on demand, and pace your preparation.
set = new HashSet();
set.add("A");
set.add("B");
set.add("A");
print(set.size());
int[] arr = new int[3];
print(arr[0]);
(In a language like Java where arrays are zero-initialized)
Stack s = new Stack();
s.push(10);
s.push(20);
s.pop();
s.push(30);
result = s.peek();