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 makes the sensible assumption 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.

    Please do not use this feature in a program.

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

    C. 'XY '

    The familiar + 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 appears to treat '->' as being 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 the three characters 'ZAP'.

    Please don't do this. Anybody trying to debug this will see that the source code still says "PACK" and will have to work out why the PACK command appears to be deleting all records.

  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. . This is not quite true. All that the function does 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 on the File menu.
  • In FoxPro, Format|Font changes to Format|Screen font when you hold down the Shift key.

MS Access technical tips

Visual FoxPro technical tips

General Tips

 

More tips from Alvechurch Data

FoxPro Trivia Quiz

FoxPro Trivia Quiz

How much do you really know about FoxPro?

Read More