| Column 1 | Column 2 | ||
| (p) | First In First Out | (i) | Stacks |
| (q) | Lookup Operation | (ii) | Queues |
| (r) | Last In First Out | (iii) | Hash Tables |
def append_to_lst(val, lst=[]):
lst.append(val)
return lst
print(append_to_lst(1))
print(append_to_lst(2))
print(append_to_lst(3, []))
Which of the following is the correct output of this program?def mystery(n):
if n <= 0:
return 1
else:
return mystery(n-1) + mystery(n-2)
Now, consider the following function call: mystery(4) mystery(4)?
def outer():
x = []
def inner(val):
x.append(val)
return x
return inner
f1 = outer()
f2 = outer()
print(f1(10)) # Line P
print(f1(20)) # Line Q
print(f2(30)) # Line R
print(f1(40)) # Line S
Which of the following options is/are correct?| Column 1 | Column 2 | ||
| (p) | First In First Out | (i) | Stacks |
| (q) | Lookup Operation | (ii) | Queues |
| (r) | Last In First Out | (iii) | Hash Tables |