Professional Documents
Culture Documents
Answer D
Explanation:
k=65, 27, 50, 9, 36, 43, 20
65%8=1
27%8=3
50%8=2
9%8=1
36%8=4
43%8=3
20%8=4
1: 65, 9
2: 50
3: 27,43
4: 36,20
Answer B
Explanation:
All the nodes are checked for the values to be a multiple of 2 and when
they are not a value of the stack is popped and added to them and the
previous values are overwritten.
def function(input_queue):
output_queue=Queue (18)
while(not input_queue. is_empty()):
var=input queue.dequeue()
if var<=5:
output_queue. enquebb(input_queue.dequeue()+1)
else:
output_queue. enqueue
(output_queue.dequeue()+input_queue.dequeue())
return output_queue
Answer B
input_queue(front to rear): 3, 7, 6, 2, 5, 6, 3, 2
output_queue: 10,7,3
Answer C
if(element<num_list[mid]): low=mid+1
if(element>num_list[mid]): high=mid-1
a) Graph
b) Tree
c) Stack
Answer A
Explanation: Graphs are awesome data structures that you use every
day through Google Search, Google Maps, GPS, and social media. They
are used to represent elements that share connections. The elements
in the graph are called Nodes and the connections between them are
called Edges. This is a similar instance.
stack1(top to 14 35 22 10 5 20
bottom)
def stack_function(stack1):
stack2=Stack(5)
while not stack1.is_empty():
if (stack1.pop()%5==0):
break
else:
if (not stack1.is_empty()):
stack2.push(stack1.pop()*2)
if stack2.is empty():
stack1.pop()
else:
stack2.push(10)
return stack2
What will be the content of stack2 from top to bottom after the
©Talentio Solutions India Private Limited
5th Floor, Mayfair Building, SP Road, Begumpet, Hyderabad – 500 003
www.talentio.in
execution of the above function when stack 1 is passed as input
parameter.
a) 10 20 10 70
b) 70 10 20 10
c) 50 20 10 70
d) 10 70 10 70
Answer A
stack1(top to bottom): 14, 35, 22, 10,5,20
stack2(top to bottom): 10 20 10 70
elif previous_year_percentage>95:
scholarship=10000
else:
scholarship=0
Answer C
Explanation:
Logic corresponds to the internal structure of the code and this testing
is adopted for safety-critical applications such as software used in the
aviation industry. This Test verifies the subset of the total number of
truth assignments to the expressions.
Basically, you would be testing all the conditional statements for their
respective True and False inputs. Here option C and option D provide
logic coverage but the efficient one among them would be option C.
Answer B
4%5=4
7%5=2
16%5=1
8%5=3
18%5=3
Answer: c
Answer c
def vegetables(veggies):
veggies.push(“Eggplant”)
veggies.push(“Carrot”)
veggies.push(“Beetroot”)
eaten=Stack(7)
while not veggies.is_empty():
#”find”method returns -1 if passed substring is not
found
if veggies.pop().find(‘r’)!=-1:
eaten.push(veggies.pop())
else:
Answer b
a)H(key) = key968
b)H(key) = key9610
Answer D
Explaianation:
k=2, 4, 6, 18, 84, 90
k%2: 0,0,0,0,0,0
k%3: 2,1,0,0,0,0
k%4: 2,0,2,2,0,2
k%5: 2,4,1,3,4,0
collisions are less in k%5