Skip to content
Your progress

Checking your sign-in…

Who's learning?

Each profile keeps its own read lessons, badges, streak, and practice scores on this device.

Lesson 10 of 11

8 min

Text size

Eight lessons, one line each. Keep the table beside the register while you answer.

One heading row, rows that keep together, and the questions a table can be asked without asking it twice
IdeaThe line to keep
One record, one rowA record is one row of values that belong together. The heading row names the columns. One field takes two positions: first the row, then the column.
The naming valueA key is a column whose values each name exactly one record. A single value names a record when only one record carries it.
Naming the columnsThe headers list turns a column's name into a position. Find the position first, then fetch the field. Minus one is an answer. Do not use it as a position. It means no such column exists.
One conditionA query walks the rows. It keeps rows where one field meets the condition. The answer is whatever the walk kept — including nothing.
Two conditionsTwo conditions joined by and keep a row only when both hold. Two conditions keep fewer rows, or the same — never more.
The answer in orderSorting moves whole rows and compares one field at the key's position. The comparison is strict. Tied rows are never swapped with each other. Sorting nothing is not an error.
Counting the groupsCount the answer, not the table. This report lists its groups first. So a group with no answer rows still shows a 0.
What a database addsOne query means the same as a walk. Read the condition, take each row, keep it or pass it. Hand back what you kept. A database program can give the same answer. A report with empty groups must list them first.

The headers list reads ['admission', 'name', 'section', 'due']. What does rows[2][0] fetch?

  • The admission number of the third record
  • The due of the second record
  • The whole third row

In this course's runner, a row has four values. What does rows[2][4] do?

  • Stops, naming position 4 and the list length 4
  • Hands back nothing, from an empty slot
  • Wraps around and fetches position 0

Two records are named Ananya Suresh. Why can the name not be the key?

  • Names are too long to compare quickly
  • Two records carry it, so it cannot tell them apart
  • The key must be a number, never text

Why can the admission number serve as the key?

  • It is the first column, and first columns are always keys
  • It is the only column with letters in it
  • The school issues one per student and never reuses it

What does headers.indexOf('marks') hand back for a register with no marks column?

  • −1, an answer meaning no such column
  • Nothing: the question stops the run
  • 0, the first place marks could go

In this course's runner, a program gets −1 from the headers. It fetches with it anyway. What happens?

  • The fetch returns the last field
  • The fetch returns nothing and the run carries on
  • The run stops: it asked for position −1

The query "the due is 1450" walks the register. What lands in the answer?

  • Only the four dues, with the names left behind
  • The four whole records that carry that due
  • The whole register, with the matching rows marked

After the walk builds the answer, what does the register hold?

  • Only the rows that met the condition
  • Nothing: its rows moved into the answer
  • All twelve records, in the order it always held them

Which records does the 10-C query keep?

  • All twelve records
  • None, and the walk stops with an error
  • None: an empty list, not an error

Section 9-A alone keeps 7 records. What is true of "9-A and due at least 1000"?

  • It keeps 7 or more, and here it keeps 9
  • It keeps 7 or fewer, and here it keeps 4
  • It keeps exactly 7, and here it keeps 7

When the sort compares two rows, what does it compare?

  • The whole rows, value by value from position 0
  • One field of each row, read at the key's position
  • The rows' positions in the answer

Two records tie on due. One was already ahead. What does the taught sort do?

  • Never swaps them, but another swap can still move one
  • Always keeps their arrival order, whatever else moves
  • Leaves their order to whatever the machine decides

After sortRows hands back the sorted answer, what does the register read?

  • Sorted too, in the same order
  • Empty, its rows moved into the answer
  • As before: the passes ran on a copy

The Friday report reads 9-A: four. The register holds seven 9-A records. What happened?

  • The tally counted the query's answer, not the register
  • The tally skipped three 9-A records it could not read
  • The query kept every 9-A record and the tally lost count

This report's tally lists its groups first, 10-C included. Why?

  • So a group with no answer rows still shows a 0
  • So the count runs faster on a shorter list
  • The answer cannot be counted without them

A database program answers a question about twelve thousand rows. What must its answer match?

  • A stored answer, even if the table has changed
  • The answer your walk would give
  • Only the first few rows that match

Assertion (A): Adding and to a query never raises the kept count. Reason (R): Every kept row must pass both conditions. What is right?

  • A and R are true, and R explains A.
  • A and R are true, but R does not explain A.
  • A is true, but R is false.

Case: A new row joins: A-113, Ananya Suresh, 9-B, due 0. Which column can still serve as the key?

  • Name: it is the easiest column to remember
  • Due: the value 0 still names one record
  • Admission: only one record carries A-113

That is the whole track: a table, a key, and a question.

Your track is How AI Learns II: Neural Networks Intuition. It will look different — numbers, not rows. You have spent a term asking a table exact questions. You are hard to fool now.

Reveal every answer to finish this lesson.