Quiz Space

Computational Thinking · End Term · 30 Apr 2023 · January 2023 term · Set QPF1-S2

Question 10: Consider the procedure given below where A and B are two…

Question 10

+4 marksNumerical answer

Consider the procedure given below where A and B are two rows in the "Words" dataset. Let procedure getSomething(A) returns a dictionary with characters of A.Word as keys mapped to their frequency in A.Word.

text
1 Procedure doSomething(A, B)
2 count = 0
3 dictA = getSomething(A)
4 dictB = getSomething(B)
5 foreach letter in keys(dictA){
6 if(iskey(dictB, letter)){
7 if(dictA[letter] == dictB[letter]){
8 count = count + 1
9 }
10 }
11 }
12 return(count)
13 End doSomething

Let X.Word = "developer" and Y.Word = "designer", then, what will doSomething(X, Y) return?

Show answer

Correct answer: 2

Question 10 of 25 in the IIT Madras BS Computational Thinking (Computational Thinking (CT)) End Term paper sat on 30 Apr 2023, in the January 2023 term (IIT M FOUNDATION ET1 EXAM QPF1 S2 30 Apr 2023). It carries 4 marks.

More questions from this paper

  1. Q1The following pseudocode is executed using the "Scores" dataset. What will count represent at the end of the execution?
  2. Q2The following pseudocode is executed using the "Words" dataset. What will B represent at the end of the execution?
  3. Q3The following pseudocode is executed using the "Words" dataset. The variable count stores the number of words which are…
  4. Q4The following pseudocode is executed using the "Library" dataset. At the end of the execution, N captures the name of a…
  5. Q5The following pseudocode is executed using the "Scores" dataset. What will B represent at the end of the execution?
  6. Q6The following pseudocode is executed using the "Olympics" dataset. What will dict represent at the end of the execution?
  7. Q7The following pseudocode is executed using the "Scores" dataset. What will first(D[i]) - last(D[i]) represent for a giv…
  8. Q8The following pseudocode is executed using the “Words” dataset. What will wordCount represent at the end of the executi…
  9. Q9Consider the following graph with six nodes. M is the 6 × 6 adjacency matrix corresponding to the graph below. Assume t…
  10. Q11What will the value of S be at the end of the execution of the following pseudocode?
  11. Q12Let D be a dictionary. Choose the correct statement(s) about the dictionary D. It is a Multiple Select Question (MSQ).
  12. Q13reverse is a recursive procedure to reverse a list. Select the correct code fragment to complete the pseudocode given b…
  13. Q14The procedure visitedShop(B) returns the list of names of customers who have visited shop B in the "Shopping Bills" dat…
  14. Q15The following pseudocode is executed using the "Shopping Bills" dataset. At the end of the execution, L stores the list…
  15. Q16stations is a list that contains the sequence of stations visited by a train from the "Trains" dataset. Each element in…
  16. Q17stations is a list that contains the sequence of stations visited by a train from the "Trains" dataset. Each element in…
  17. Q18trains is a list that contains information about trains associated with a station stn. Specifically, each element in th…
  18. Q19trains is a list that contains information about trains associated with a station stn. Specifically, each element in th…
  19. Q20trains is a list that contains information about trains associated with a station stn. Specifically, each element in th…
  20. Q21Let M be the adjacency matrix of the graph G given below. Consider the procedure given below. Based on above informatio…
  21. Q22Let M be the adjacency matrix of the graph G given below. Consider the procedure given below. Based on above informatio…
  22. Q23Let M be the adjacency matrix of the graph G given below. Consider the procedure given below. Based on above informatio…
  23. Q24What will evaluate(L1, L2) return?
  24. Q25How many times will the procedure evaluate be called, excluding the main call?