Quiz Space

Computational Thinking Quiz 1: 11 July 2021, Set POD21QZBQPB (May 2021 term)

Question 1

+1 markOne correct option

doSomething is a procedure that accepts a list of integers as input.

text
S = doSomething(L)
Procedure doSomething(L)
if (length(L) ≤ 1) {
return(0)
}
else {
return(first(L)-last(L) + doSomething(init(rest(L))))
}
End doSomething

Based on the above data, answer the given subquestions.

What will the value of S at the end of execution when L = [3, 2, 1, 0, 1, 2, 3]?

  1. A

    0

  2. B

    1

  3. C

    12

  4. D

    Error in the pseudocode

Question 2

+1 markOne correct option

doSomething is a procedure that accepts a list of integers as input.

text
S = doSomething(L)
Procedure doSomething(L)
if (length(L) ≤ 1) {
return(0)
}
else {
return(first(L)-last(L) + doSomething(init(rest(L))))
}
End doSomething

Based on the above data, answer the given subquestions.

What will the value of S at the end of execution when L = [3, 2, 1, 0, -1, -2, -3]?

  1. A

    0

  2. B

    1

  3. C

    12

  4. D

    Error in the pseudocode

Question 3

+2 marksOne correct option

The following pseudocode constructs a graph from the "Words" dataset. Each word position (Seq_No) is a node. The matrix M represents the graph. M[i][j] = 1 if there is an edge from node i to node j.

text
A = { }
while (Table 1 has more rows) {
Read the first row X in Table 1
A[X.Seq_No] = [X.LetterCount, X.PartOfSpeech]
Move X to Table 2
}
n = length(keys(A))
M = createMatrix(n, n)
foreach i in keys(A) {
foreach j in keys(A) {
if ((last(A[i]) ≠ last(A[j])) and isCompatible(A[i], A[j])) {
M[i][j] = 1
}
}
}
Procedure isCompatible(P, Q)
if ((first(P) - first(Q)) == 1) {
return (True)
}
else {
return (False)
}
End isCompatible

Study the pseudocode given above and answer the subquestions:

There will be an edge between word i and word j if and only if:

  1. A

    The letter count and part of speech of words i and j are same.

  2. B

    The letter count of word i is more than word j and both have same part of speech.

  3. C

    The letter count of word i is one more than word j and both have same part of speech.

  4. D

    The letter count of word i is one more than word j and both have different part of speech.

10 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 1 11 Jul 2021 Set POD21QZBQPB paper

The IIT Madras BS Computational Thinking (Computational Thinking (CT)) Quiz 1 paper sat on 11 Jul 2021, in the May 2021 term, set POD21QZBQPB: 13 questions for 25 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 1 11 Jul 2021 Set POD21QZBQPB at a glance
TermMay 2021 term
SubjectComputational Thinking
Course codeBSCS1001
Questions13
Marks25
Duration120 min
MCQ12
MSQ1
Official paperIIT M QUIZ EXAM POD21QZAQPA FN 11 July 2021
Negative markingNo negative marking.
Updated

Other sets that day

Same Quiz 1, other subjects

More Computational Thinking (CT)