The dQuiz — Test Your dBASE IQ
by Peter Rorlick (the author is a co-founder of  Montreal Business Software. He has been developing xbase solutions since 1981).

The program below creates a table, adds three records, one of which is deleted.  The table is then indexed, and the COUNT command is issued, so that the number of visible rows is shown in a message box.

Before you run it, examine the source code, and try to guess what the COUNT line will report. (Hint: think carefully!)

Once you’ve made your guess, type this in Command window:
 
 
modify command dQuiz1
   

Paste the code below into the program editor, and press F2 to run it.  You may be surprised.
 
 
// dQuiz1.prg
set deleted on
close tables
if file("Quiz.dbf")
   delete table Quiz
endif
create table "Quiz.dbf" ( Name char(10), City char(10) )
use Quiz exclusive
append blank
replace Name with 'Paul',  City with 'London'
append blank
replace Name with 'Dan',   City with 'Montreal'
delete  // Delete record number 2.
append blank
replace Name with 'Peter', City with 'Montreal'
index on City tag City unique
count  // What will it report?
   

Click here for the answer and an explanation.