📄 apa.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"><HTML><HEAD><SCRIPT LANGUAGE="JavaScript"><!--function popUp(pPage) { var fullURL = document.location; var textURL = fullURL.toString(); var URLlen = textURL.length; var lenMinusPage = textURL.lastIndexOf("/"); lenMinusPage += 1; var fullPath = textURL.substring(0,lenMinusPage); popUpWin = window.open('','popWin','resizable=yes,scrollbars=no,width=525,height=394'); figDoc= popUpWin.document; zhtm= '<HTML><HEAD><TITLE>' + pPage + '</TITLE>'; zhtm += '</head>'; zhtm += '<BODY bgcolor="#FFFFFF">'; zhtm += '<IMG SRC="' + fullPath + pPage + '">'; zhtm += '<P><B>' + pPage + '</B>'; zhtm += '</BODY></HTML>'; window.popUpWin.document.write(zhtm); window.popUpWin.document.close(); // Johnny Jackson 4/28/98 }//--> </SCRIPT><link rel="stylesheet" href="/includes/stylesheets/ebooks.css"> <META HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=iso-8859-1"> <TITLE>Teach Yourself Borland Delphi 4 in 21 Days -- Appendix A -- Answers to the Quiz Questions</TITLE></HEAD><BODY TEXT="#000000" BGCOLOR="#FFFFFF"><CENTER><H1><IMG SRC="../button/sams.gif" WIDTH="171" HEIGHT="66" ALIGN="BOTTOM" BORDER="0"></H1></CENTER><CENTER><H1><BR>Teach Yourself Borland Delphi 4 in 21 Days</H1></CENTER><CENTER><P><A HREF="../ch21/ch21.htm"><IMG SRC="../button/previous.gif" WIDTH="128" HEIGHT="28"ALIGN="BOTTOM" ALT="Previous chapter" BORDER="0"></A><A HREF="../apb/apb.htm"><IMGSRC="../button/next.gif" WIDTH="128" HEIGHT="28" ALIGN="BOTTOM" ALT="Next chapter"BORDER="0"></A><A HREF="../index.htm"><IMG SRC="../button/contents.gif" WIDTH="128"HEIGHT="28" ALIGN="BOTTOM" ALT="Contents" BORDER="0"></A> <HR></CENTER><CENTER><H1>- A -</H1></CENTER><CENTER><H1>Answers to the Quiz Questions</H1></CENTER><UL> <LI><A HREF="#Heading1">Day 1</A> <LI><A HREF="#Heading2">Day 2</A> <LI><A HREF="#Heading3">Day 3</A> <LI><A HREF="#Heading4">Day 4</A> <LI><A HREF="#Heading5">Day 5</A> <LI><A HREF="#Heading6">Day 6</A> <LI><A HREF="#Heading7">Day 7</A> <LI><A HREF="#Heading8">Day 8</A> <LI><A HREF="#Heading9">Day 9</A> <LI><A HREF="#Heading9.5">Day 10</A> <LI><A HREF="#Heading10">Day 11</A> <LI><A HREF="#Heading11">Day 12</A> <LI><A HREF="#Heading12">Day 13</A> <LI><A HREF="#Heading13">Day 14</A> <LI><A HREF="#Heading14">Day 15</A> <LI><A HREF="#Heading15">Day 16</A> <LI><A HREF="#HeadingA">Day 17</A> <LI><A HREF="#Heading16">Day 18</A> <LI><A HREF="#Heading17">Day 19</A> <LI><A HREF="#Heading18">Day 20</A> <LI><A HREF="#Heading19">Day 21</A> <LI><A HREF="#Heading20">Bonus Day</A></UL><P><HR SIZE="4"><CENTER><H1></H1></CENTER><P>This appendix provides the answers to the quiz sections at the end of each chapter.</P><P><H2><A NAME="Heading1"></A>Day 1</H2><DL> <DT></DT> <DD><B>1. </B>What is the filename extension of a Pascal unit? <P> <DT></DT> <DD>.pas <P> <DT></DT> <DD><B>2. </B>What is the name of the keyword that marks the section in which variables are declared? <P> <DT></DT> <DD>var <P> <DT></DT> <DD><B>3. </B>What does the IntToStr function do? <P> <DT></DT> <DD>The IntToStr function converts an integer value into a Pascal string. <P> <DT></DT> <DD><B>4. </B>What is the purpose of the uses list in a Pascal unit? <P> <DT></DT> <DD>The uses list in a Pascal unit lists the units that this unit is dependent on. The compiler needs to be able to see those units in order to compile the current unit. <P> <DT></DT> <DD><B>5. </B>Are the following two declarations different? Why or why not? <P></DL><BLOCKQUOTE> <PRE>var top : Integer;</PRE> <PRE> Top : Integer;</PRE></BLOCKQUOTE><PRE></PRE><DL> <DT></DT> <DD>The declarations are identical because the Pascal language is not case sensitive. <P> <DT></DT> <DD><B>6. </B>How do you concatenate Pascal strings? <P> <DT></DT> <DD>By using the + operator. (You can also use the StrCat function for null-terminated strings.) <P> <DT></DT> <DD><B>7. </B>How can you embed a control character in a string? <P> <DT></DT> <DD>By using the # symbol followed by the ASCII value of the character you want to embed. <P> <DT></DT> <DD><B>8. </B>What is the maximum length of a short string? <P> <DT></DT> <DD>255 characters. <P> <DT></DT> <DD><B>9. </B>Look at this line of code: <P></DL><BLOCKQUOTE> <PRE>MyArray : array [0..10] of Byte;</PRE></BLOCKQUOTE><PRE></PRE><DL> <DT></DT> <DD>How many bytes can this array hold? <P> <DT></DT> <DD>11 bytes (0 through 10). <P> <DT></DT> <DD><B>10. </B>What is the index number of the first element of an array, 0 or 1? <P> <DT></DT> <DD>That depends on how the array is declared. This array has a base index of 0: <P></DL><BLOCKQUOTE> <PRE>Array1 : array [0..9] of Integer;</PRE></BLOCKQUOTE><PRE></PRE><DL> <DT></DT> <DD>This array, however, has a base index of 1: <P></DL><BLOCKQUOTE> <PRE>Array2 : array [1..10] of Integer;</PRE></BLOCKQUOTE><PRE></PRE><H2><A NAME="Heading2"></A>Day 2</H2><DL> <DT></DT> <DD><B>1. </B>What statements are executed in the event an if expression evaluates to True? <P> <DT></DT> <DD>The statement immediately following the if statement. If a code block follows an if statement, the entire code block will be executed. <P> <DT></DT> <DD><B>2. </B>How many return values can a function return? <P> <DT></DT> <DD>One. On the other hand, if you implement variable parameters, a function can effectively return more than one value. <P> <DT></DT> <DD><B>3. </B>Besides syntax, what is the difference between a while loop and a repeat loop? <P> <DT></DT> <DD>A while loop checks the conditional expression at the beginning of the loop. A repeat loop checks the conditional expression at the end of the loop. <P> <DT></DT> <DD><B>4. </B>What do the Break and Continue procedures do? <P> <DT></DT> <DD>The Break procedure is used to break out of a loop. The statement following the body of the loop will be executed after a call to Break. The Continue procedure forces program execution back to the top of the loop. <P> <DT></DT> <DD><B>5. </B>What is a global variable? <P> <DT></DT> <DD>A variable that is in scope anywhere in the program. It can be accessed by any function in the program. <P> <DT></DT> <DD><B>6. </B>Can a record contain a mixture of data types (Char, Integer, Word, and so on)? <P> <DT></DT> <DD>Yes, a structure can contain any number and type of data members. <P> <DT></DT> <DD><B>7. </B>How do you access the members of a record? <P> <DT></DT> <DD>With the dot operator (.). Here's an example: <P></DL><BLOCKQUOTE> <PRE>record.LastName = "Noble";</PRE></BLOCKQUOTE><PRE></PRE><DL> <DT></DT> <DD><B>8. </B>How many functions or procedures can a program have? <P> <DT></DT> <DD>There is no practical limit to the number of functions or procedures a program can have. <P> <DT></DT> <DD><B>9. </B>Can a function call another function or procedure? <P> <DT></DT> <DD>Yes, functions and procedures can, and often do, call other functions or procedures. <P> <DT></DT> <DD><B>10. </B>Is it legal to have arrays of records? <P> <DT></DT> <DD>Yes, you can have arrays of records just as easily as you can have arrays of integers, bytes, or strings. <P></DL><H2><A NAME="Heading3"></A>Day 3</H2><DL> <DT></DT> <DD><B>1. </B>How do you clear a set of all values? <P> <DT></DT> <DD>By assigning an empty set constructor to the set--like this: <P></DL><BLOCKQUOTE> <PRE>Font.Style := [];</PRE></BLOCKQUOTE><PRE></PRE><DL> <DD><B>2. </B>What is the purpose of having private fields and methods? <DT></DT> <DD>Private data members protect data from being modified directly by users of the class. Private data members can be modified through public member functions or properties, but not directly. <P> <DT></DT> <DD><B>3. </B>How can you keep fields private and yet enable users to read and set their values? <P> <DT></DT> <DD>By using methods or properties. <P> <DT></DT> <DD><B>4. </B>When is a class's destructor called? <P> <DT></DT> <DD>The destructor is called when the object is destroyed. <P> <DT></DT> <DD><B>5. </B>What does it mean to override a method of the base class? <P> <DT></DT> <DD>To override a method means to replace a method in the base class with a method in your derived class. The new method must have the exact same name, parameters, and return type to override the base class method. <P> <DT></DT> <DD><B>6. </B>How can you override a base class method and still get the benefit of the operation the base class method performs? <P> <DT></DT> <DD>Call the base class function from within the overridden function: <P></DL><BLOCKQUOTE> <PRE>procedure MyClass.DoIt;begin Inherited DoIt; { do some other stuff }</PRE> <PRE>end;</PRE></BLOCKQUOTE><PRE></PRE><DL> <DT></DT> <DD><B>7. </B>What operator is used to dereference a pointer? <P> <DT></DT> <DD>The pointer operator (^). <P> <DT></DT> <DD><B>8. </B>Can a class contain other class instances as fields? <P> <DT></DT> <DD>Yes. It's very common. <P> <DT></DT> <DD><B>9. </B>What keyword is used to specify a pointer that has no value? <P> <DT></DT> <DD>The nil keyword. <P> <DT></DT> <DD><B>10. </B>What is the as keyword used for? <P> <DT></DT> <DD>To cast a pointer from a derived type to an ancestor type, or vice versa. <P></DL><H2><A NAME="Heading4"></A>Day 4</H2><DL> <DT></DT> <DD><B>1. </B>How do you invoke the main window's Customize dialog box? <P> <DT></DT> <DD>Right-click any toolbar and choose Customize from the context menu. <P> <DT></DT> <DD><B>2. </B>When you have the Customize dialog box open, how do you add buttons to a toolbar? <P> <DT></DT> <DD>Simply drag an item from the Commands page to a toolbar and drop it where you want the item to appear on the toolbar. <P> <DT></DT> <DD><B>3. </B>How do you remove buttons from a toolbar? <P> <DT></DT> <DD>Drag unwanted buttons off the bottom of the toolbar and drop them. <P> <DT></DT> <DD><B>4. </B>What's the easiest way to place multiple components of the same type on a form? <P> <DT></DT> <DD>Hold the Shift key when you click the component in the Component palette. Each time you click on the form, a new component will be placed. <P> <DT></DT> <DD><B>5. </B>What's the easiest way to place a component in the center of the form? <P> <DT></DT> <DD>Double-click the component's button in the Component palette. <P> <DT></DT> <DD><B>6. </B>List the file types needed to build an application in Delphi. <P> <DT></DT> <DD>The .dpr, .pas, and .dfm files. <P> <DT></DT> <DD><B>7. </B>What VCL method do you use to display a form modelessly? <P> <DT></DT> <DD>The Show method. <P> <DT></DT> <DD><B>8. </B>What VCL method do you use to display a form modally? <P> <DT></DT> <DD>The ShowModal method. <P> <DT></DT> <DD><B>9. </B>How can you attach an event to an event handler that has been previously
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -