Computational Thinking, Quiz 2
The given pseudocode is executed using the "Words" dataset. C stores the number of nouns which have at least one adjective adjacent to it. Choose the correct code fragment to complete the pseudocode.
A = [ ], N = [ ]while (Table 1 has more rows) { Read the first row X in Table 1 if (X.PartOfSpeech == "Adjective") { A = A ++ [X.SeqNo.] } if (X.PartOfSpeech == "Noun") { N = N ++ [X.SeqNo.] } Move X to Table 2}********************* Fill the code *********************The given pseudocode is executed using the "Words" dataset. **C** stores the number of nouns which have at least one adjective adjacent to it. Choose the correct code fragment to complete the pseudocode. A = [ ], N = [ ] while (Table 1 has more rows) { Read the first row X in Table 1 if (X.PartOfSpeech == "Adjective") { A = A ++ [X.SeqNo.] } if (X.PartOfSpeech == "Noun") { N = N ++ [X.SeqNo.] } Move X to Table 2 } ******************** * Fill the code * ******************** Let **L** be a non-empty list of integers, and **D** be a non-empty dictionary which are given below:\ **L** = [-20, -10, 0, 10, 20]\ **D** = {'a': -20, 'b': -10, 'c': 0, 'd': 10, 'e': 20} Match the following expressions on the left side with the appropriate values on the right side. a. **D['b'] + D['d']**\ b. **first(L) + last(L)**\ c. **init(rest(rest(L))) ++ [D['c']]**\ d. **[D['c']] ++ rest(init(init(L)))**\ e. **member(keys(D), 0)**\ f. **isKey(D, "IITM")** 1. True 2. False 3. Invalid key 4. 0 5. [0, 10, 0] 6. [0, -10, 0] The following pseudocode is executed using the "Library" dataset. At the end of execution, **A** captures a dictionary with author's name as key mapped to the list of books written by him/her. But the code may have mistakes. Identify all such mistakes (if any). It is a Multiple Select Question 1 A = { } 2 while (Table 1 has more rows) { 3 Read the first row X in Table 1 4 if (isKey(A, X.Author)) { 5 A[X.Name] = A[X.Name] ++ [X.Author] 6 } 7 else { 8 A[X.Name] = [X.Author] 9 } 10 Move X to Table 2 11 }