Questions and published explanations below are available without starting a test. Some questions may not have a published solution yet.
10 / 11 published solutions
Question 2 MCQ · 0.0 marks
6406536343122.
Useful Data has been mentioned above.
6406536343123.
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 procedure is executed using the **Scores** dataset.
What does the procedure **Mystery("M")** compute?
6406536343124.
The average Physics score of all students
6406536343125.
The average Physics score of male students
6406536343126.
The total score of male students
6406536343127.
The total Physics score of male students
Published solution
Mystery('M') visits every row but adds to count and sum only when X.Gender is M. sum accumulates the Physics scores of those male students, and count records their number. Returning sum/count therefore gives the male students' average Physics score, assuming at least one male student is present.
**Answer: B.**
A: **Incorrect:** Other genders are excluded by the condition.
B: **Correct:** Filtered Physics sum divided by filtered student count gives this average.
C: **Incorrect:** It neither sums total subject scores nor returns an undivided total.
D: **Incorrect:** The Physics sum is divided by count before returning.
The following pseudocode is executed using the **Scores** table. At the end of the execution, the
variable **CountBA** captures the number of students with total marks less than average total marks
and below average in exactly one subject. Assume that the variable **AvgT** holds the value of
average total marks. Similarly, the variables **AvgP**, **AvgC** and **AvgM** hold the value of average
marks of Physics, Chemistry and Mathematics respectively. Choose the correct choice to complete
the pseudocode.
The surrounding condition already requires X.Total<AvgT. For that student, SubC starts at zero and increases separately for each subject whose mark is below its subject average. Exactly one such subject means SubC==1. If true, CountBA must increase by one, preserving the number counted from earlier rows.
**Answer: D.**
A: **Incorrect:** SubC<=1 also accepts students below average in zero subjects.
B: **Incorrect:** Accepts zero as well as one and resets rather than accumulates CountBA.
C: **Incorrect:** Tests the right subject count but overwrites CountBA with 1.
D: **Correct:** Requires exactly one subject and increments the running student count.
Based on the **Scores** dataset, the Procedure **highTotal(S)** returns **True** if student name **'S'** has a
**TOTAL score greater than 180**. Choose the correct pseudocode for Procedure **highTotal(S)**.
(Consider all students have distinct names)
Search for the row whose name equals S and test that same row's Total>180. B returns True immediately when both conditions hold, and False only after all rows have been searched without success. Distinct names ensure the matching student's row is unambiguous.
**Answer: B.**
A: **Incorrect:** Adds only Mathematics and Physics, omitting Chemistry from the intended total.
B: **Correct:** Checks both the requested name and its complete total.
C: **Incorrect:** Checks whether any student has a high total, ignoring S.
D: **Incorrect:** Sums all students' totals rather than testing the specified student.
What does the given pseudocode achieve using the **Words** table?
6406536343132.
Bins the rows in the **Words** table into four tables based on word length
6406536343133.
Bins the rows in the **Words** table into four tables based on whether the word
has more vowels or more consonants
6406536343134.
Bins the rows in the **Words** table into four tables based on the ratio of vowels
to total letters
6406536343135.
Bins the rows in the **Words** table into four tables based on whether the word
contains only vowels
Published solution
DoSomething counts vowels V in the current word of length N. The branches distinguish V<N/2, V=N/2, N/2<V<N, and V=N. Equivalently they group vowel proportions below one-half, equal to one-half, above one-half but below one, and equal to one. Thus the four tables are based on vowel-to-total-letter ratio.
**Answer: C.**
A: **Incorrect:** The tests depend on V relative to N, not on N alone.
B: **Incorrect:** More/fewer vowels gives part of the classification but does not explain the separate all-vowel fourth group.
C: **Correct:** Describes all four ratio-based categories.
D: **Incorrect:** Only the last category consists exclusively of vowels; the other branches distinguish several other ratios.
The following pseudocode is executed using the **Shopping bills** dataset to find the number of bills
with one of the top three total bill amounts. Choose the correct code block to complete the
pseudocode.
The first pass maintains the three largest distinct bill amounts: First, Second and Third. The second pass must count every bill whose amount is at least Third, covering all bills at any of those three amount levels, including ties. Hence use X.TotalBillAmount>=Third and increment Count. The intended setup assumes nonnegative bill amounts and enough distinct amount levels for Third to represent a real third level.
**Answer: D.**
A: **Incorrect:** Counts bills below the third-highest threshold, the opposite region.
B: **Incorrect:** Counts only the largest amount level.
C: **Incorrect:** Strictly greater than Third leaves out bills at the third-highest level.
D: **Correct:** Includes the largest, second-largest and third-largest amount levels, with ties.
The following procedure is executed using the **Shopping Bills** dataset. Choose all the correct
options given below.
6406536343144.
The procedure ignores all bills from shops other than SV Stores
6406536343145.
Bills from SV Stores with amount ≥ 400 do not affect either
or
6406536343146.
The value stored in
depends on the order of cards in Pile 1
6406536343147.
represents the number of SV Stores bills whose total amount is strictly
less than 400
6406536343148.
At the end of execution, **(sum/count)** will give the average total bill amount of
all bills from SV Stores
Published solution
A row contributes only if its shop is SV Stores and its total amount is strictly below 400. For each qualifying row the procedure adds its amount to sum and one to count. All other rows are ignored. Reordering does not change these mathematical sums and counts. sum/count, when count>0, is the mean only for the filtered bills, not all SV Stores bills.
**Answer: A, B, D.**
A: **Correct:** The shop-name condition excludes every other shop.
B: **Correct:** The strict <400 test excludes amounts equal to or above 400.
C: **Incorrect:** The same qualifying amounts are summed regardless of row order.
D: **Correct:** Count increases once for every qualifying below-400 SV Stores bill.
E: **Incorrect:** The computed mean excludes the store's bills of 400 or more, and is undefined if no bill qualifies.
The following procedure finds the highest amount of bill generated at **Sun General** from the
**Shopping Bills** dataset. But the programmer may have made mistakes in one or more steps.
Identify all such steps (if any)
Step 1. Arrange all cards in a single pile called Pile 1
Step 2. Maintain a variable **max** and initialize it to 0
Step 3. If Pile 1 is empty then stop the iteration
Step 4. Read the top card in Pile 1
Step 5. If the shop name is **Sun General** and **max > total bill amount** then store total bill amount
in **max**
Step 6. Move the current card to another pile called Pile 2 and repeat from step 3
6406536343149.
Step 1
6406536343150.
Step 2
6406536343151.
Step 3
6406536343152.
Step 4
6406536343153.
Step 5
6406536343154.
Step 6
6406536343155.
No mistake
Published solution
To maintain a maximum, replace it only when a new qualifying bill is larger than the stored maximum. Step 5 instead tests max>amount, the reverse comparison. It should test ShopName=='Sun General' and amount>max. With nonnegative bill amounts, starting max at zero is appropriate. The remaining steps perform a normal full scan.
**Answer: E.**
A: **Incorrect:** A single input pile is a valid starting setup.
B: **Incorrect:** Zero is a suitable initial bound for nonnegative bill amounts.
C: **Incorrect:** Stopping on an empty pile is correct.
D: **Incorrect:** Reading the top card is necessary.
E: **Correct:** The maximum-update comparison is reversed.
F: **Incorrect:** Moving the card and repeating ensures every card is processed once.
G: **Incorrect:** Step 5 contains an actual error.
Consider the following pseudocode operating on **Scores** dataset.
Which of the following statements are true?
6406536343156.
The algorithm counts the number of ordered pairs of students having the
same
and
.
6406536343157.
Each pair of students with the same
and
is counted exactly once.
6406536343158.
The algorithm avoids comparing a student with itself.
6406536343159.
The final value of
depends on the initial ordering of rows in Table1.
Published solution
Each outer iteration removes one row X permanently from the remaining comparison pool. The inner loop compares X with every row still in Table1, moving those rows temporarily to Table3 and then restoring them. Thus each pair of distinct students is compared once: whichever student is selected earlier is X for that pair. DoSomething contributes 1 precisely for equal city and total. The final count is the number of matching unordered pairs and is invariant under input order.
**Answer: B, C.**
A: **Incorrect:** Ordered pairs would count both directions; this scan counts each pair once.
B: **Correct:** Every matching unordered pair contributes exactly once.
C: **Correct:** X has already left Table1, so the inner loop cannot compare X with itself.
D: **Incorrect:** Changing order changes which direction is visited, not how many matching pairs exist.
The following pseudocode is executed using a dataset similar to the "Words" dataset, based on the
paragraph below.
"Patience and persistence often unlock hidden potential."
Ignore case while comparing letters.
What will be the value of **Score** at the end of execution?
Published solution
A word contributes 3 when consonants outnumber vowels, otherwise 1. Ignore case and treat the terminal full stop as punctuation rather than a letter. The (vowels,consonants) counts are patience (4,4), and (1,2), persistence (4,7), often (2,3), unlock (2,4), hidden (2,4), potential (4,5). Only patience fails the strict greater-than test. Thus Score=1+6×3=19. Equal counts go into the else branch.
**Answer: 19.**