Answers to FoxPro Trivia Quiz



  1. If the Customers table is open, what does this command do: ? [company]

    B. Displays the characters 'company'.

    Foxpro has three delimiters for text. The single and double quotes are familiar but square brackets are equally effective and very useful if you have to work with a string which include the other two types of quote such as lcWhere = [Where Name = "O'Leary"].


  2. What happens if you hold the Shift key down then click on File in the main menu?

    A. The Close option becomes Close All

    For a bonus mark - which other standard Microsoft applications have this feature?
    And for a second bonus - which other Fox menu changes when you hold down Shift?


  3. What date is given by Gomonth({^2000-01-31}, 1)?

    B. February 29th 2000

    Foxpro has always been very good with dates; it knows that February 31st is not a valid date and knows that 2000 was a Leap Year. The Gomonth function assumes that the last day of February is one month after the last day of January.


  4. What does the command 3+8 do if you are on the first record of the Customer table?

    B. Moves to record 11

    Go is a shorthand for the Goto command but neither are actually needed. If you type a number in a program or in the Command Window then Foxpro will move to that record in the current table.


  5. If x is 'X ' and y is 'Y ' then what is the result of x - y?

    C. 'XY '

    The + operator concatenates two strings. The - operator also concatenates two strings but it removes the trailing spaces from the first string and puts them on the end of the concatenated string.


  6. What happens if you redefine a field type from Numeric to Float?

    C. Nothing

    The Float and Numeric types are identical. The two definitions have been kept in the language for backwards compatibility.


  7. Can you enter duplicate values in a field with a Unique index?

    A. Yes

    The Unique index type allows duplicate entries but will only display or process one of them. It's badly named and has been dropped from the language in VFP 9.


  8. What does ?_screen->backcolor do?

    A. Displays the value of the screen's background colour.

    Foxpro has always used the '->' characters as an alternative to the period between table name and field name. When object orientated features were added in version 3 the Fox team followed convention and used a period between names of objects and properties. The compiler treats '->' as equivalent to a period so _screen->backcolor is effectively the same as _screen.backcolor.


  9. Can you use a #DEFINE on a Foxpro keyword?

    A. Yes.

    The effect of a #DEFINE directive is similar to a search-and-replace through the code before it is compiled so something like #DEFINE PACK ZAP will find every occurence of the four characters 'PACK' in a program or method and replace them with 'ZAP'. Please don't do this.


  10. What is the result of Proper('MCKAY')?

    C. Mckay.

    Help says that the Proper function Returns from a character expression a string capitalized as appropriate for proper names.. All it does though is to change the first character of the string to upper case and change all the rest to lower case. Not a particularly useful function.


Bonus marks

  • Word and Excel both have a Close All feature.
  • Format|Font changes to Format|Screen font when you hold Shift.

Hints & tips

The textbox class in Visual FoxPro 9 has a new Autocomplete property which shows the user the previous values that have been entered in that textbox.
Autocomplete in VFP 9

Your Access database will look more impressive if you add custom toolbars...
Custom toolbars

FoxPro has always had functions to read and write files at a low level...
Foxpro low level file functions

More...
More pages of hints and tips for users of Microsoft FoxPro and Access databases.

Site Map