MFC的考试题(英文).doc_第1页
MFC的考试题(英文).doc_第2页
MFC的考试题(英文).doc_第3页
MFC的考试题(英文).doc_第4页
MFC的考试题(英文).doc_第5页
已阅读5页,还剩16页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

MFC的考试题2001 AnswerMastering MFC Fundamentals Tests Name:_ Number:_ First Section: Read the following statements carefully, please write T or F in the place of the anwer sheet to show it is true or false(10%): 1. An application is a static sequence of instructions that makes up an executable file. A process is usually defined as an instance of a running application.(T)2. Accelerator、 Bitmap、 Menu、 Toolbar、Statusbar are also standard Win32 GUI resource types. (F)3. MFC completely encapsulates the Windows API, freeing the developer from all SDK dependence.(F)4. The application framework implements the message map data structure, which provides the link between the message ID and the function that will handle the message. (T) 5. Although the release version of a project is more efficient than its debug version, they use the same set of DLLs. (F) 6. There is more flexibility in routing a command message than a Windows message since command messages can be handled by a wide variety of objects. (T)7. Pen, Brush, Font, Rectangle are all GDI Objects. (F) 8. The status bar can be easily managed with the status bar editor in Developer Studio. (F) 9. Most of the initial work to create a dialog box is the same for modal and modeless types. But the user need to write additional code for a modeless dialog box to enable reciprocal communication with its application. (T) 10. CString is a data type supported by MFCs serialization operators, the archive insertion() operators. (T) Second Section: In this section, please choose the correct answer from the four statements in each of the following questions ( 36%): 1. Which of the following is a required function for all windows-based applications? (A) A WinMain B MyWndProc C WndMgr D GetMenu 2. CObject is the base class for most of MFC. Which of the following is not the information and foundations that provides: (C) A Run-time class information B Diagnostic and debugging support C Some simple value types D Compatibility with collection classes 3. If you use MFC to develop a document/view based project , the Document、View、Frame and Application class usually are the default four elements, Which one of the following is false about their declarations: (D) A The application class acts as a binder for the frame, view, and document objects and a set of GUI resources in a application. B A document is a data object with which the user interacts in an editing session and a view is a window object through which the user interacts with the document, C The framework provides a set of starter files for an application and supplies standard user-interface features that you can implement in your application. D SDI applications allow only one document frame window at a time, but MDI applications has a window with which the user can open multiple MDI child windows and they should be the same types. 4. What tool do you normally use to automates the creation and editing of classes, and creates additional classes based on MFC. (C) A AppWizard B The Project Workspace C ClassWizard D Developer Studio Gallery 5. What is the purpose of the DECLARE_DYNCREATE macro? (A) A To enable objects of CObject-derived classes to be created dynamically at run time. B To enable objects of any class to be created dynamically C To dynamically create the documents D To dynamically create the frames and views. 6. In which case we will call OnUpdate member function of the CView class? (B)A Called when a view is first attached to a document. B Called when the documents data has changed and the view needs to be updated. C Called when the applications frame has been resized. D Called when you want to change some document data. 7. Which one of the following statements is false when using the Developer Studio debugger to set and manage breakpoints? (C) A To set a breakpoint on a source statement extending across two or more lines, you must set the breakpoint on the last line of the statement. B An asterisk(*) in the Breakpoint check box indicates that the breakpoint is not supported on the current platform. C The breakpoints you set cannot be saved as part of your projects. D You can set more than one location breakpoint on a line. 8. In a MFC application, what is the message map macro name and handler name associated with the WM_MOUSEMOVE Windows message? A The macro is WM_MOUSEMOVE_MESSAGE and the handler is OnMouseMoveMessage. B The macro is OnMouseMove and the handler is ON_MM_MOUSEMOVE. C The macro is ON_WM_MOUSEMOVE and the handler is OnMouseMove. D Since general window messages are handled by the MFC framework, they never need message map entries. 9. Communication between the operating system, applications, and application components is conducted through: C A Windows messages、Command messages B Windows messages、Command messages、Event-notification messages. C All types of messages. D Windows messages、Command messages、System-registered messages. 10. Which one of the following is not a DC(Device Contexts) does in Windows: B A Gives permission to an application to use an output device. B Gives permission to an application to redraw all of the views. C Maintains current information about how to draw or paint to a window, such as the colors, brush or pen patterns and so on. D Provides a link between a Windows-based application, a device driver, and an output device, such as a monitor or printer. 11. If you want to draw a rectangle like G-1, which one of the following codes cannot realize it, suppose you have the following definition : D A pDC-Rectangle(0,0,100,100); B pDC-MoveTo(0,0); pDC-LineTo(100,0); pDC-MoveTo(0,0); pDC-LineTo(0,100); pDC-MoveTo(100,100); pDC-LineTo(100,0); pDC-MoveTo(100,100); pDC-LineTo(0,100); C CRect rect(0,0,100,100); pDC-Rectangle(&rect); D pDC-Rectangle(CPoint(0,0),CPoint(100,100); 12 Please read the codes, and select the correct answer about the output strings color in sequence: ACPen pen1, pen2; CPen *pOld; CPoint pt(0,0); pen1.CreatePen(PS_SOLID,1,RGB(255,0,0); pen2.CreatePen(PS_SOLID,1,RGB(0,0,255); pOld = pDC-SelectObject(&pen1); pDC-TextOut(pt,”The first line.”); pDC-SelectObject(pOld); pDC-TextOut(pt,”The seconde line.”); pOld = pDC-SelectObject(&pen2); pDC-TextOut(pt,”The third Line”); A RED, BLACK, BLUE B BLACK, RED, BLACK C RED, BLUE, BLACK D RED, WHITE, BLUE 13 When you are debugging a program, you find that there is a dimmed menu item, which one of the following measures cannot make it available: D A check if it has an associated command handler. B check if you have executed an operation to make it unavailable temporarily. C check if there is no objects that can be used. D check if it has a combination with an Update command handler 14 Which one of the following is not true about toolbar editor: C A You cannot delete the blank placeholder button on the right end. B In the Toolbar editor, you can drag the button off the toolbar to delete a button. C In the Toolbar editor, you can delete a button directly and conveniently by pressing “Delete” key. D If you want to create a new button, you can copy a button and change the original bitmap to the new one. 15 In a dialog box class, you want to save changes of the dialog controls to a variable, what function you often add in the program: B A Invalidate() B UpdateData() C UpdateData(false) D Update() 16 Which one of the following statements is true about the relationship of DDX and DDV? D A DDX and DDV occur when the user clicks OK. B DDX and DDV are mutually exclusive; only one can be performed for each control. C The developer cannot extend DDX and DDV. D In a DoDataExchange routine, if a DDV routine exists, it must follow immediately after its associated DDX routine in the data map. 17 Templates are useful for generating collection classes because: B A Templates have built-in functionality for collections. B Templates work with arbitrary data types. C All templates have iterators, which are useful for collection classes. D Templates have built-in support for the most common data types. 18 Which of the following conditions or steps is not required to add support for serialization to a class? D A The class must be publicly derived from CObject or a class derived form CObject. B The class declaration must declare both an overridden version of CObject:Serialize and invocation of the DECLARE_SERIAL macro. C The class implementation file must contain the implementation for Serialize and an invocation of the IMPLEMENT_SERIAL macro. D Each class in an application must have different, sequentially numbered schema. Third Section: Please use your brief words in English to explain the following phrases (14%): 1. What is Event-driven programming? 2. Please explain What is “Mapping modes” and illustrate it with some detail examples . 2002 AnswerMastering MFC Fundamentals TestsName:_ Number:_SectionA(26%): In this section, please choose the correct answer from the four statements in each of the following questions :( C )1.CObject is the base class for most ofMFC. Which one of the following is not the information and foundations that provides: ARun-time class information B Diagnostic and debugging support CSome simple value types DCompatibility with collection classes( D )2.If you use MFC to developadocument/viewbased project , the Document、View、Frame and Application class usually are the default four elements, Which one of the following statements is false about their declarations: A The application class acts as a binder for the frame, view, and document objects and a set of GUI resources in a application. B A document is a data object with which the user interacts in an editing session and a view is a window object through which the user interacts with the document. C The framework provides a set of starter files for an application and supplies standard user-interface features that you can implement in your application. DSDI applications allow only one document frame window at a time, but MDI applications has a window with which the user can open multiple MDI child windows and they should be the same types.( C )3. What tool do you normally use to automates the creation and editing of classes, and creates additional classes based on MFC. A AppWizard B The Project Workspace C ClassWizard D Developer Studio Gallery( A )4. When you derive an application class from CWinApp, what function must you override to create your applications main window object? A InitInstance B Run C CFrameWnd and CWinApp D CView and CFrameWnd( B )5. In which case we will call OnUpdate member function of the CView class? A Called it when a view is first attached to a document. B Called it when the documents data has changed and the view needs to be updated. C Called it when the applications frame has been resized. DCalled it when you want to change some document data.( C )6. Which one of the following statements is false when using the Developer Studio debugger to set and manage breakpoints? A To set a breakpoint on a source statement extending across two or more lines, you must set the breakpoint on the last line of the statement. B An asterisk(*) in the Breakpoint check box indicates that the breakpoint is not supported on the current platform. C The breakpoints you set cannot be saved as part of your projects. D You can set more than one location breakpoint on a line.( C )7. In a MFC application, what is the message map macro name and handler name associated with the WM_KEYDOWN Windows message? A The macro is WM_KEYDOWN_MESSAGE and the handler is OnKeyDownMessage. B The macro is OnKeyDown and the handler is ON_MM_KEYDOWN. C The macro is ON_WM_KEYDOWN and the handler is OnKeyDown. D Since general window messages are handled by the MFC framework, they never need message map entries.( B )8.Which one of the following is not a DC(Device Contexts) does in Windows ? A Gives permission to an application to use an output device. B Gives permission to an application to redraw all of the views. C Maintains current information about how to draw or paint to a window, such as the colors, brush or pen patterns and so on. D Provides a link between a Windows-based application, a device driver, and an output device, such as a monitor or printer.( D )9.When debugging a program, you find a dimmed menu item, which one of the following measures cannot make it available? A check if it has an associated command handler. B check if you have executed an operation to make it unavailable temporarily. C check if there is no object that can be operated. D check if it has a combination with an Update command handler( C )10.Which one of the following statements is not true about the toolbar editor? A You cannot delete the blank placeholder button on the right end. B In the Toolbar editor, you can drag the button off the toolbar to delete a button. C In the Toolbar editor, you can delete a button directly and conveniently by pressing “Delete”key. DIf you want to create a new button, you can copy a button and change the original bitmap to a new one.( D )11.Which one of the following statements is true about the relationship of DDX and DDV? A DDX and DDV occur when the user clicks OK. B DDX and DDV are mutually exclusive; only one can be performed for each control. C The developer cannot extend DDX and DDV. D In a DoDataExchange routine, if a DDV routine exists, it must follow immediately after its associated DDX routine in the data map.( C )12.What results when you use ClassWizard to create a dialog member variable and bind it to a control? A A new class is automatically generated for the parent dialog box. B A new CControl-derived class is created and an instance of this class is embedded in the parent dialog class. C A new member variable is created in the parent dialog class. D ClassWizard generates no source code, but maintains this information in the projects .clw file.( A )13.What is the default mapping mod in Windows? A MM_TEXT B MM_WINDOWS C MM_TWINPS D MM_ISOTROPICSection B(20%): Fill in the blank with the proper code in the following programs.在下面的程序中空白处填上合适的代码 1.(12%)The following code shows how to display the shape like in S-1 in the view,suppose we use red pento draw the rectangle, use blue brush to fill the circle, use green pen to write the text in the point when the left button of the mouse is down. voidCSimpleTextView:OnLButtonDown(UINT nFlags, CPoint point) (COLORREF)color;/ color用于存放颜色 CPen* pPen = new CPen; CPen* oldPen; CBrush*oldBrush; CBrush brush; CClientDC dc(this); pPen - ( CreatePen(PS_SOLID,1,RGB(255,0,0) );/ 创建线宽为1的红色实线画笔 oldPen = dc.SelectObject(pPen); dc.Rectangle (100,100,200,200 );/在(100,100)处绘制边长为100的矩形 CRgn* pRgn=new CRgn; pRgn-CreateEllipticRectRgn(100,100,200,200); color = ( RGB(0,0,255)); brush.CreateSolidBrush(color);oldBrush=dc.SelectObject(&brush); dc.FillRgn ( pRgn ,&brush ); /*Fill the circle*/ dc.SetTextColor(RGB(0,255,0); dc.TextOut( point.x,point.y,”Hello!” );/*Display the text when clicking the mouse*/ CView:OnLButtonDown(nFlags,point); 2 (8%)IDD_DIALOG1 is a new resource . The user has created a class named CListBoxDlg for it. The following code shows parts of its header and implementation file. In the implementation file,Function OnAddshows how to add the string written in the EditBox to the ListBox if the string is not a null string when clicking the add button,function OnDelete shows how to delete a selected string in the ListBox when clicking the delete button.ListBoxDlg.h:header file class CListBoxDlg : public CDialogpublic: CListBoxDlg(CWnd* pParent = NULL); enum IDD = IDD_DIALOG1 ; CListBox m_ctrListBox;/* this member is binded to ListBox*/ CString m_sEdit;/*this member is binded to EditBox*/protecte

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论