Quiz Space

Computational Thinking Quiz 2: 31 October 2021, Set QPB (September 2021 term)

Question 1

+5 marksOne correct option

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.

text
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 *
********************
  1. A
  2. B
  3. C
  4. D

Question 2

+6 marksOne correct option

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]
  1. A

    a - (4), b - (4), c - (6), d - (5), e - (2), f - (2)

  2. B

    a - (4), b - (4), c - (5), d - (6), e - (2), f - (2)

  3. C

    a - (4), b - (4), c - (5), d - (6), e - (3), f - (3)

  4. D

    a - (4), b - (4), c - (6), d - (5), e - (3), f - (3)

  5. E

    a - (4), b - (4), c - (5), d - (6), e - (2), f - (3)

Question 3

+4 marksOne or more correct options

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

text
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 }

Select all that apply.

  1. A

    Line 4: Incorrect sequence of parameters for isKey

  2. B

    Line 5: Incorrect update of A

  3. C

    Line 8: Incorrect update of A

  4. D

    No mistakes

9 more questions in this paper

Sign in with Google — it is free — to see every question with its answer and explanation, practise it in learning mode, or take it as a timed mock test.

More on the Computational Thinking (CT) Quiz 2 31 Oct 2021 Set QPB paper

The IIT Madras BS Computational Thinking (Computational Thinking (CT)) Quiz 2 paper sat on 31 Oct 2021, in the September 2021 term, set QPB: 12 questions for 50 marks in 120 minutes. The first 3 questions are below. Sign in with Google — it is free — to see the whole paper with its answers and explanations, in learning mode or as a timed mock test.

FeatureComputational Thinking (CT) Quiz 2 31 Oct 2021 Set QPB at a glance
TermSeptember 2021 term
SubjectComputational Thinking
Course codeBSCS1001
Questions12
Marks50
Duration120 min
MCQ5
MSQ6
Written1
Official paperIIT M QUIZ FOUNDATION EXAM QPB 31 OCT 2021 350
Negative markingNo negative marking.
Updated

Other sets that day

Same Quiz 2, other subjects

More Computational Thinking (CT)