Questions and published explanations below are available without starting a test. Some questions may not have a published solution yet.
13 / 14 published solutions
Question 2 MCQ · 0.0 marks
6406537087442.
Useful Data has been mentioned above.
6406537087443.
This data attachment is just for a reference & not for an evaluation.
Published solution
This is a reference card showing the schemas and sample rows of Scores, Words, Library, Olympics and Shopping Bills. It supplies context for later pseudocode questions rather than asking for a computed result. Use the field names and row meanings when tracing the later algorithms; the displayed ellipses indicate omitted rows, not a complete dataset.
**Answer: A.**
A: **Correct:** The source selects the acknowledgement that useful dataset information is supplied.
B: **Incorrect:** This describes its reference role too, but is not the source's selected administrative acknowledgement; these are not competing computational answers.
The following pseudocode is executed using the **Scores** dataset.
What does **L** contain at the end of the execution?
6406537087444.
Towns/cities where the highest and second highest total scores among
students from that town/city differ by at most 10
6406537087445.
Towns/cities where every student has a total score within 10 marks of every
other student from that town/city
6406537087446.
Towns/cities where the highest and second highest total scores among
students from that town/city differ by more than 10
6406537087447.
Towns/cities where the first two students read from that town/city differ in
total score by at most 10
Published solution
For each city, First and Second track the two largest student totals and Count tracks how many student rows the city has. A new maximum shifts the previous maximum into Second; other totals can improve Second. Equal highest totals are allowed, so these are the top two student scores, not necessarily distinct numerical values. The final test requires Count>=2 and First-Second<=10. Thus L contains cities whose top two totals differ by at most 10.
**Answer: A.**
A: **Correct:** Matches the two stored maxima and the final difference test.
B: **Incorrect:** The algorithm does not compare the maximum with the minimum; lower students can be far behind.
C: **Incorrect:** The final comparison is at most 10, not greater than 10.
D: **Incorrect:** The tracked maxima are updated throughout the scan, not limited to the first two rows.
The following pseudocode is executed using the **Library** dataset.
What does **D** store at the end of the execution?
6406537087448.
For each publisher, the name and year of one of its earliest English books in
the dataset
6406537087449.
For each publisher, the name and year of one of its latest English books in the
dataset
6406537087450.
For each publisher, the number of English books published by it
6406537087451.
For each publisher, the name and year of its earliest book, irrespective of
language
Published solution
update ignores every non-English book. For an English book, it groups by publisher and stores its name and year. An existing entry is replaced only if the new year is smaller, so each entry represents an earliest English book for that publisher. If several books share that earliest year, the first encountered is retained because the comparison is strict.
**Answer: A.**
A: **Correct:** Correctly identifies the per-publisher earliest English book information.
B: **Incorrect:** A smaller year replaces the entry, so it tracks earliest rather than latest.
C: **Incorrect:** No book count is accumulated.
D: **Incorrect:** Non-English books never enter the selection.
The following pseudocode is executed on the **Words** dataset.
What does
represent at the end of execution?
6406537087460.
Total number of words having at least 8 letters.
6406537087461.
Total number of nouns having at least 8 letters.
6406537087462.
Total number of sentences having at least 8 words.
6406537087463.
Total number of distinct words having at least 8 letters.
Published solution
Each row in Words is examined, and count increases exactly when X.LetterCount>=8. There is no part-of-speech filter, sentence grouping or uniqueness test. Thus count measures word occurrences with at least eight letters, including repeated occurrences if the dataset has them.
**Answer: A.**
A: **Correct:** Precisely matches the only condition and one increment per qualifying row.
B: **Incorrect:** There is no requirement that PartOfSpeech be Noun.
C: **Incorrect:** LetterCount concerns letters in a word, not the number of words in a sentence.
D: **Incorrect:** There is no deduplication of equal words.
Each iteration appends the current last element to ans, then init(L) removes that last element from L. For [3,8,1,6], the extracted sequence is 6,1,8,3. Thus the function returns [6,1,8,3], a reversal of the input list.
**Answer: B.**
A: **Incorrect:** This is the original order, not the removal order.
B: **Correct:** Correctly lists successive last elements 6,1,8,3.
C: **Incorrect:** Omits the first original element and does not reverse the others.
D: **Incorrect:** Keeps an incorrect order for the middle extracted values.
The following pseudocode is executed using the **Shopping Bills** dataset.
What does
represent for a category **C**?
6406537087452.
The average price of distinct item names in category C, where each item name
is counted once
6406537087453.
The average unit price of all purchased units belonging to category C across all
bills
6406537087454.
The average total bill amount of bills that contain at least one item from
category C
6406537087455.
The total cost of all items belonging to category C across all bills
Published solution
For each category, Amount accumulates item costs and Units accumulates purchased quantities across all bills. Value=Amount/Units is therefore total expenditure per purchased unit. If cost=quantity×unit price, this is a quantity-weighted average of unit prices, not an unweighted average of distinct item names. It assumes a category being divided has positive total quantity.
**Answer: B.**
A: **Incorrect:** Distinct item names are not deduplicated or equally weighted.
B: **Correct:** Total cost divided by total units gives the average unit price across purchased units.
C: **Incorrect:** It groups item costs by category, not whole-bill totals.
D: **Incorrect:** Total cost is Amount; Value divides that by Units.
The following pseudocode is executed using the **Shopping Bills** dataset. What will **D** represent at
the end of the execution?
6406537087456.
For an item C, and a shop S,
is set to True if and only if the
item is sold for a constant price
6406537087457.
For an item C, and a shop S,
is set to True if and only if the
item is billed in more than one bill
6406537087458.
For an item C, and a shop S,
is set to True if and only if the
item is sold for variable price
6406537087459.
For an item C, and a shop S,
is set to True if and only if the
item is billed in exactly one bill
Published solution
For each item name and shop, Price stores the first observed price and Flag starts False. On any later occurrence with a different price, Flag becomes True and is never reset. Thus True means that at least two observed prices differ for that item at that shop. Multiple bills alone are insufficient if every price stays equal.
**Answer: C.**
A: **Incorrect:** Constant price leaves Flag False.
B: **Incorrect:** Two or more bills can still all have the same price.
C: **Correct:** A differing observed price sets the persistent variation flag True.
D: **Incorrect:** A single occurrence only initialises Flag=False.
The following pseudocode is executed using the **Words** dataset. Choose all the correct statements.
6406537087468.
counts nouns that are palindromes
6406537087469.
Every word in L is a noun such that no pair of letters at symmetric positions
(first–last, second–second-last, etc.) is the same.
6406537087470.
A word whose
is not "Noun" can still increase
if the word is a
palindrome
6406537087471.
A noun with
equal to 1 will always increase
Published solution
Only nouns enter checkWord. It compares symmetric character pairs while i<j, counting total pairs t and matching pairs m. When m=t, every compared pair agrees, so the noun is a palindrome and P increases. When m=0, no symmetric pair agrees, so the word enters L. For a one-letter noun, there are no pairs: m=t=0, so it increases P and also enters L. The centre letter of an odd-length word is not compared with itself.
**Answer: A, B, D.**
A: **Correct:** m=t means every symmetric pair matches, the palindrome condition.
B: **Correct:** m=0 means no compared symmetric pair matches, and the outer filter guarantees a noun.
C: **Incorrect:** The outer noun test prevents non-nouns from reaching this increment.
D: **Correct:** A one-letter noun has zero matching and zero total pairs, so m=t holds.
The procedure **visitedShop** returns the list of names of people who have visited a particular shop
in the **Shopping Bills** dataset. It accepts the shop's name as a parameter. Additionally, each
customer must be represented exactly once in the returned list. The following pseudocode may
have mistakes. Identify all such mistakes (if any).
6406537087477.
Error in line 2
6406537087478.
Error in line 6
6406537087479.
Error in line 7
6406537087480.
Error in line 16
6406537087481.
Error in line 18
6406537087482.
Error in line 19
6406537087483.
No error
Published solution
S must begin as an empty list, not the string 'None'. When a matching-shop card belongs to a customer not yet present, append the customer's name, not the shop name. Finally isPresent must initialise present=False; it should return True only if its search finds the name. The condition on line 6, the equality check on line 18, and setting True on line 19 are appropriate once those errors are repaired.
**Answer: A, C, D.**
A: **Correct:** Line 2 should initialise S as a list.
B: **Incorrect:** Checking not isPresent is the correct way to prevent duplicate customers.
C: **Correct:** Line 7 must append X.CustomerName, not X.ShopName.
D: **Correct:** Line 16 must start present as False; otherwise every search reports success.
E: **Incorrect:** Line 18 correctly compares the current element with the sought name.
F: **Incorrect:** Line 19 correctly marks a found name as present.
G: **Incorrect:** The initialisation and append errors prevent the required result.
The following pseudocode is executed on the **Scores** dataset. Assume
uniquely identifies
each student.
Which of the following statements are always true?
6406537087484.
Every sequence number stored in
is also present in
.
6406537087485.
stores the sequence numbers of students whose Mathematics marks are at
least 90.
6406537087486.6406537087487.
Published solution
A receives every student's unique sequence number when Mathematics>=90. B is appended only inside that same block and additionally requires Total>=270. Therefore B is a subset of A, and length(B)<=length(A). The total threshold alone does not populate B unless the Mathematics condition also holds.
**Answer: A, B, D.**
A: **Correct:** Every append to B occurs within the condition that also appends to A.
B: **Correct:** A's exact membership test is Mathematics>=90.
C: **Incorrect:** B need not be as large as A; students can satisfy the Mathematics test but fail the total test.
D: **Correct:** Subset membership and unique identifiers guarantee length(A)>=length(B).
The following pseudocode is executed using the **Library** dataset. Choose all the correct
statements.
6406537087472.
For each genre G,
contains each author at most once
6406537087473.
For each genre G,
is the total number of pages across all books
in that genre
6406537087474.
If an author has three books in the same genre, at most one of those books
contributes to
6406537087475.
If an author has more than one book in the same genre with different page
counts,
may depend on the order in which the rows are read
6406537087476.
For each genre G,
is the sum of pages of the latest book
written by each author in that genre
Published solution
Each genre's Authors list records an author only on the first encountered book for that author in the genre. Pages likewise gains that book's pages only on the first encounter. Thus Authors has no duplicates and Pages sums one first-encountered book per author, rather than every book. If an author's page counts vary, changing row order can change which book contributes. No publication-year comparison is performed.
**Answer: A, C, D.**
A: **Correct:** Membership checking prevents an author's repeated insertion within a genre.
B: **Incorrect:** Later books by an already-listed author do not add their pages.
C: **Correct:** Only the first encountered book by that author can contribute.
D: **Correct:** Different first-encountered books can produce different page sums.
E: **Incorrect:** There is no year comparison selecting the latest book.
The procedure adds the last element of each inner list whose length is at least two. [2] is skipped. [5,1] contributes 1; [4,7,3] contributes 3; [6,8] contributes 8. Total=1+3+8=12. The test concerns each inner list's length, not its numeric values.
**Answer: 12.**
The given pseudocode is executed using a dataset having the same fields as the **Words** dataset,
and contains the following words:
"I ordered this product from Gitark. I am very happy to share my review regarding this awesome
product. It is not only nice to use, but also has a very cool look. I think this is the best product
which can be bought in this price range."
Consider the following information:
1.
returns a list of unique elements of list L. For example,
will return
.
2.
returns the number of common elements in lists L1 and L2.
3. Ignore the upper and lower case, and punctuation symbols while comparing with other
words.
What will be the value of **posSen** at the end of the execution of the above pseudocode?
Published solution
Process complete sentences separately and compare their distinct normalised words with positiveList. Sentence 1 has none. Sentence 2 contains happy and awesome, so it qualifies. Sentence 3 contains nice and cool, so it qualifies. Sentence 4 contains best only, so it fails the threshold of two distinct positive words. Therefore posSen=2. Deduplication means repeating one positive word would not count as two different matches.
**Answer: 2.**