Computational Thinking, Quiz 2
Consider the procedure given below.
1 Procedure eliminate(L1, L2) 2 L3 = [], Found = False 3 foreach i in L1{ 4 foreach j in L2{ 5 if(i == j){ 6 Found == True 7 } 8 } 9 if(not Found){10 L3 = L3 ++ [i]11 }12 Found = False13 }14 return(L3)15 End eliminateIf L1 and L2 are two lists, and L = eliminate(L1, L2), choose the correct option.
Consider the procedure given below. 1 Procedure eliminate(L1, L2) 2 L3 = [], Found = False 3 foreach i in L1{ 4 foreach j in L2{ 5 if(i == j){ 6 Found == True 7 } 8 } 9 if(not Found){ 10 L3 = L3 ++ [i] 11 } 12 Found = False 13 } 14 return(L3) 15 End eliminate If **L1** and **L2** are two lists, and **L = eliminate(L1, L2)**, choose the correct option. Consider the following pseudocode: 1 aList = [2, 6, 7, 2, 8, 7, 6, 2, 3] 2 bDict = {} 3 bList = [] 4 foreach a in aList{ 5 if(not isKey(bDict, a)){ 6 bDict[a] = True 7 bList = [a] ++ bList 8 } 9 } At the end of execution of the pseudocode, which of the following is correct? The following pseudocode is executed using "Scores" dataset. Let **M**, **P**, and **C** be the lists of the sequence numbers of the students who have scored more than 75 marks in Mathematics, Physics, and Chemistry respectively. At the end of the execution, **dict** stores a dictionary with the sequence number of student mapped to the number of subjects in which the student has scored more than 75 marks. Choose the correct implementation(s) of **nSub**. Figure from the original question paper