Quiz Space

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

Question 1

+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 = [8, -4, 10, 4, -6]
D = {1: {"Name": "John", "Age": 12, "Gender": 'M'}}
Match the following expressions on the left side with the appropriate values on the right side.

a. member(L, 10)1. 12
b. isKey(D, "Name")2. 10
c. D[1]["Age"]3. [1]
d. first(L) + last(init(L))4. False
e. first(rest(rest(L)))5. True
f. keys(D)6. Invalid expression
  1. A

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

  2. B

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

  3. C

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

  4. D

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

  5. E

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

Question 2

+5 marksOne correct option

The given pseudocode is executed using the "Words" dataset. C stores the number of adjectives which have at least one noun 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 3

+5 marksOne correct option

trains is a dictionary with train number as key mapped to a list of stations which that train runs through. For example, trains = { 12281: ["Bhubaneswar","Balasore", "Adra", "Varanasi", "Kanpur", "New Delhi"],......}. In this example, the train with train number 12281 starts from Bhubaneswar and reaches New Delhi via Balasore, Adra, Varanasi, and Kanpur.

At the end of execution of the code below, L stores the names of stations through which the maximum number of trains pass. Choose the correct fragment to complete the pseudocode.
It is a Multiple Choice Question. (MCQ).

text
stns = { }, N = 0, L = [ ]
foreach X in keys(trains) {
stns = updateDictionary(stns, X)
}
foreach Y in keys(stns) {
********************
* Fill the code *
********************
}
Procedure updateDictionary(D, Z)
foreach A in trains[Z] {
if (not isKey(D, A)) {
D[A] = 1
}
else {
D[A] = D[A] + 1
}
}
return (D)
End updateDictionary
  1. A
  2. B
  3. C
  4. D

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 QPA paper

The IIT Madras BS Computational Thinking (Computational Thinking (CT)) Quiz 2 paper sat on 31 Oct 2021, in the September 2021 term, set QPA: 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 QPA at a glance
TermSeptember 2021 term
SubjectComputational Thinking
Course codeBSCS1001
Questions12
Marks50
Duration120 min
MCQ8
MSQ3
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)