Indian Institute of Technology Madras
BS Degree Programme · Examination & Study Paper
BSCS1001 · Computational Thinking
Qualifier · January 2024
Examination Instructions & Guidelines
- Solve on notebook/paper first before checking solutions.
- MCQ: Exactly 1 option is correct. Negative marking applies.
- MSQ: One or more options correct. Select all to score.
- NAT: Numerical response. No negative marking.
- Scientific calculator allowed for all calculations.
- Official answer key is sealed at the end of this sheet.
Useful Reference Data for this Paper

Q1MCQ3 Marks·Choose one optionThe following pseudocode is executed using the “Library” dataset. What will B represent at the end of execution?

- ANumber of books written by author Kalam in English
- BNumber of books not written by author Kalam in English
- CNumber of English books written by authors other than Kalam
- DNumber of books that are written by author Kalam or in English or both
- Q2MCQ3 Marks·Choose one option
The following pseudocode is executed using the "Scores" dataset. At the end of the execution of below pseudocode, if count2 represents the number of male students whose Physics marks are less than or equal to Mathematics marks, then select the correct code fragment for A and B.

- A

- B

- C

- D

- A
- Q3MCQ3 Marks·Choose one option
The following pseudocode is executed using the “Scores” dataset. What will A represent at the end of the execution?

- ANumber of students with highest marks in Mathematics among the three subjects
- BNumber of students with highest marks in Mathematics and lowest marks in Physics
- CNumber of students with highest marks in Chemistry among the three subjects
- DNumber of students with lowest marks in Physics among the three subjects
- Q4MCQ3 Marks·Choose one option
The following pseudocode is executed using the “Words” dataset.
What will count represent at the end of execution?- ANumber of words with at least one pair of vowels occurring consecutively
- BNumber of words with at most two pairs of vowels occurring consecutively
- CNumber of words with at least two pairs of the same vowel occurring consecutively
- DNumber of words with at most two pairs of the same vowel occurring consecutively
- Q5MCQ4 Marks·Choose one option
The following pseudocode is executed using the "Words" table. At the end of the execution, count stores the number of pairs of nouns such that both nouns have either the same letter count or both end with a full stop. Choose the correct code fragment to complete the pseudocode.

- AStatement 1: X.PartOfSpeech == Y.PartOfSpeech Statement 2: X.LetterCount == Y.LetterCount Statement 3: X.Word and Y.Word end with a full stop
- BStatement 1: X.Word and Y.Word end with a full stop Statement 2: X.PartOfSpeech == Y.PartOfSpeech Statement 3: X.LetterCount == Y.LetterCount
- CStatement 1: X.LetterCount == Y.LetterCount Statement 2: X.Word and Y.Word end with a full stop Statement 3: X.PartOfSpeech == Y.PartOfSpeech
- DStatement 1: X.LetterCount == Y.LetterCount Statement 2: X.PartOfSpeech == Y.PartOfSpeech Statement 3: X.Word and Y.Word end with a full stop
- Q6MCQ4 Marks·Choose one option
The following pseudocode is executed using the “Scores” dataset. At the end of the execution,variable Count captures the number of students whose total marks are more than the class average (of total marks) but have scored below the subject average in at least one subject. Assume that the variable AvgT holds the value of the average total marks. Similarly, the variables AvgP,AvgC and AvgM hold the value of the average marks of Physics, Chemistry and Mathematics respectively. Choose the correct code fragment to complete the pseudocode.

- A

- B

- C

- D

- A
- Q7MCQ4 Marks·Choose one option
The following pseudocode is executed using the “Words” dataset. What will A represent at the end of the execution?

- ANumber of sentences with average letter count more than the average letter count of dataset
- BNumber of sentences with average letter count less than the average letter count of dataset
- CNumber of words with average letter count more than the average letter count per word of dataset
- DNumber of words with average letter count less than the average letter count per word of dataset
- Q8MCQ4 Marks·Choose one option
Procedure miniSum accepts three numbers as parameters and returns the sum of two smallest numbers. Choose the correct code fragment to complete the procedure.

- A

- B

- C

- D

- A
- Q9MCQ4 Marks·Choose one option
The following pseudocode is executed using the “Olympics” dataset. Procedure doSomething accepts a table of rows which contains rows of the same player. Assume that the player has won at least two medals and only one medal in any year. What will (B - A) represent at the end of the execution?

- AYear gap between first and second medal won by a player
- BYear gap between first and latest medal won by a player
- CYear gap between latest and second latest medal won by a player
- DYear gap between first and second latest medal won by a player
- Q10MCQ3 Marks·Choose one option
The given pseudocode is executed using the “Olympics” table. What will count represent at the end of the execution? Assume all players have distinct names.

- AThe number of pairs of players having the same nationality or the same medal.
- BThe number of pairs of players having the same nationality and same medal.
- CThe number of players having the same nationality and same medal.
- DThe number of players having the different name but of same nationality.
- Q11MSQ4 Marks·Choose all correct options
The given pseudocode is executed using the “Shopping Bills” dataset. frac stores the ratio of the number of customers who purchased both “Bread” and “Milk” to the number of customers who purchased “Milk”. Choose the correct code fragment(s) of procedure hasItem to complete the pseudocode. (Assume there is at least one customer who has purchased “Milk”).

- A

- B

- C

- D

- A
- Q12MSQ4 Marks·Choose all correct options
The given information represents a "Words" dataset and it may have some mistakes with respect to the sanity of data. Identify all rows with such mistakes.

- ARow 1: Incorrect data type of card number
- BRow 2: Incorrect data type of Word
- CRow 3: Incorrect data type of Part of Speech
- DRow 3: Invalid value of Part of Speech
- ERow 4: Incorrect data type of Letter Count
- FRow 4: Invalid value of Letter Count
- Q13MSQ4 Marks·Choose all correct options
The following pseudocode is executed using the “Scores” dataset. At the end of the execution, count captures the number of pairs of students having either same gender or from the same city but not both. But the pseudocode may have mistakes. Identify all such mistakes (if any). Assume that all statements not listed in the options below are free of errors.

- ALine 13: Incorrect initialisation of B
- BLine 18: Incorrect update of B
- CLine 20: Incorrect condition
- DLine 21: It should return(0)
- Q14NAT3 Marks·Write the number
The following pseudocode is executed using a dataset similar to the "Words" dataset, based on the following paragraph. "Surrounded by nature, Susan often takes a stroll, savoring the soothing sounds of chirping birds.Such moments underline the significance of embracing simple joys in life. Rustlings in the trees suggest squirrels beginning their day, searching for sustenance. Surely, the beauty of a sunrise holds unparalleled magic."
What would be the value of count at the end of the execution of the above pseudocode? Assume that upper case and lower case are ignored during comparison of letters.Your answer:
Official KeyMaster Answer Key & Explanations
Official answer keys from IIT Madras BS past papers. Click any question to review.
Reveal KeyCollapse Key
Master Answer Key & Explanations
Official answer keys from IIT Madras BS past papers. Click any question to review.
Detailed Answer Notes & Working
- Q1Answer: D
- A counts books whose author is not Kalam and whose language is not English. count is the total number of books. So B = count − A is the number of books by Kalam or in English or both.
- Q2Answer: C
- count2 is updated in the else part, so it counts rows where (A or B) is False, that is, not A and not B. For male students with Physics ≤ Mathematics, not A must mean Gender is M and not B must mean Mathematics ≥ Physics. So A is X.Gender == 'F' and B is X.Mathematics < X.Physics.
- Q3Answer: D
- isInSeq returns 1 when Mathematics > Physics and Chemistry > Physics. Then Physics is lower than both other subjects. So A counts students with the lowest marks in Physics among the three subjects.
- Q4Answer: A
- A is True when the previous letter was a vowel. B becomes True when the current letter is a vowel and A is True, that is, two vowels come one after another. count adds 1 for each word where B is True, so it counts words with at least one pair of consecutive vowels.
- Q5Answer: A
- Y must also be a noun, so Statement 1 is X.PartOfSpeech == Y.PartOfSpeech. Then count goes up if the letter counts are equal (Statement 2), else if both words end with a full stop (Statement 3). The if-else adds 1 only once per pair, which matches option A.
- Q6Answer: A
- A is True when the total is above AvgT. B, C and D are True when the student is below average in Mathematics, Physics or Chemistry. We need A and at least one of B, C, D. So the condition is A and (B or C or D).
- Q7Answer: B
- B is the average letter count of all words. In the second loop, SumS and CountS hold the letters and words of the current sentence. At each full stop, C = SumS / CountS is the sentence average, and A goes up when C < B. So A counts sentences whose average letter count is less than the dataset average.
- Q8Answer: A
- The first if handles A as the largest, so Sum = B + C. In the else part, if B is the largest then Sum = A + C, else C is the largest and Sum = A + B. Option A does this. In options B, C and D, Sum can be overwritten after the first case, or the wrong pair is added.
- Q9Answer: A
- A keeps the earliest year. When a smaller year comes, the old A moves to B, and B also takes any year between A and B. So at the end, A is the year of the first medal and B is the year of the second medal. B − A is the year gap between the first and second medal.
- Q10Answer: B
- Each pair (X, Y) is checked once, with X before Y. count goes up only when the names differ and both Nationality and Medal are the same. So count is the number of pairs of players with the same nationality and the same medal.
- Q11Answer: B, D
- hasItem must return True when item A appears anywhere on the card. Option B starts with False and sets True when A is found. Option D sets C to False when A is found and returns not(C), which gives the same result. Option A can reset C to False on a later item, and option C always returns True.
- Q12Answer: A, B, F
- Row 1: card number must be an integer, but 'xyz' is a string. Row 2: Word must be a string, but 1 is a number. Row 4: −5 is an invalid Letter Count, because a count cannot be negative. Row 3 is fine, since 'Noun' is a valid part of speech.
- Q13Answer: A, C
- We need pairs where exactly one of A (same gender) and B (same city) is True. Line 13 must set B = False, otherwise B is always True. Line 20 must use 'or' between the two parts: (A and not B) or (not A and B). With 'and', the condition can never be True.
- Q14Answer: 3
- flag is True only for the first word and for each word just after a full stop, so only the first word of each sentence is checked. These words are Surrounded, Such, Rustlings and Surely. Surrounded, Such and Surely start with 'su', so count = 3.