Question
TestHello 1. #include wx/wx.h 2. 3. class MyApp: public wxApp 4. { 5. virtual bool OnInit(); 6. }; 7. 8. enum 9. { 10. ID_Quit
TestHello
1. #include "wx/wx.h"
2.
3. class MyApp: public wxApp
4. {
5. virtual bool OnInit();
6. };
7.
8. enum
9. {
10. ID_Quit = 1001, ID_About, ID_TextBox, ID_Timer
11. };
12.
13. class MyFrame: public wxFrame
14. {
15. public:
16. MyFrame(const wxString& title, const wxPoint& pos, const wxSize size);
17.
18. void OnQuit(wxCommandEvent& event);
19. void OnAbout(wxCommandEvent& event);
20. void OnTimer(wxTimerEvent& event);
21.
22. wxTimer* m_timer;
23. wxTextCtrl* textControl;
24. wxString MyString;
25. unsigned int MyStringOffset;
26.
27. DECLARE_EVENT_TABLE()
28. };
29.
30. BEGIN_EVENT_TABLE(MyFrame, wxFrame)
31. EVT_MENU(ID_Quit, MyFrame::OnQuit)
32. EVT_MENU(ID_About, MyFrame::OnAbout)
33. EVT_MENU(ID_Timer, MyFrame::OnTimer)
34. END_EVENT_TABLE()
35.
36. IMPLEMENT_APP(MyApp)
37.
38. bool MyApp::OnInit()
39. {
40. MyFrame *frame = new MyFrame(_("Text Timer"), wxPoint(50,50), wxSize(450,340) );
41. frame->Show(true);
42. SetTopWindow(frame);
43. return true;
44. }
45.
46. MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize size) :wxFrame( NULL,-1, title, pos, size)
47. {
48. textControl = new wxTextCtrl(this, ID_TextBox, wxT(""), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_RICH , wxDefaultValidator, wxTextCtrlNameStr);
49.
50. wxMenu *menuFile = new wxMenu;
51.
52. menuFile->Append(ID_About, _("&About..."));
53. menuFile->AppendSeperator();
54. menuFile->Append(ID_Quit, _("&Exit"));
55.
56. wxMenuBar *menuBar = new wxMenuBar;
57. menuBar->Append(menuFile, _("&File"));
58. SetMenuBar(menuBar);
59.
60. MyString = "The program timer says.. Hello World :-) ";
61. MyStringOffset = 0;
62. m_timer = new wxTimer(this, ID_Timer);
63. m_timer->Start(100);
64. }
65.
66. void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
67. {
68. m_timer->Stop();
69. Close(TRUE);
70. }
71.
72. void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
73. {
74. wxMessageBox(_("Timer with text"),_(""),
75. wxOK | wxICON_INFORMATION,this);
76. }
77.
78. void MyFrame::OnTimer(wxTimerEvent& event)
79. {
80. textControl- 81. if(MyStringOffset > MyString.Len()) MyStringOffset=0; 82. } 14. ID_Quit is assigned an initial constant numeric value. In the TestHello program this happens on which line? A) 31 B) 10 C) 54 D) 66 15. ID_Timer is assigned an initial constant numeric value. What is that value? A) 4 B) 1001 C) 3 D) 1004 16. It is necessary to actually implement an event table in application where events are routed to their respective handler functions in the window class. There are predefined macros for building a table for routing all common events. Where is the event table located in the TestHello example? A) 18 B) 30 C) 10 D) 66 17. The actual event handler MyFrame::OnQuit() closes the main window by calling Close(). Close is a member of which class? A) textControl B) MyApp C) MyFrame D) OnInit() 18. The parameter TRUE for the Close function indicates that other windows such as after asking "Do you really want to close?"... A) have no veto power B) Can prevent closing the program C) are overridden based on the choice D) can veto the exit 19. Why is it important to stop the timer before leaving the application? If the clock ticks, the OnTimer function will be... A) at a different rate B) Called from operating system C) gone D) not affected 20. In line 40, what takes place? 1. Creates memory space for the object 2. passes calling arguments to the constructor 3. returns pointer to the location of the object 4. creates a MyFrame pointer 5. initiates variable frame pointing to new object A) 5 only B) All of the items C) 2, 4, &5 D) 1-4 21. Which line places a wxTextCtrl inside the main window? A) 82 B) 23 C) 80 D) 48 22. Which line in the TestHello program is an access specifier? A) 15 B) 5 C) 41 D) 43 23. If "MyString" was to have access limited only to the frame scope, which line would be the best choice to place the private access specifier? A) 49 B) before 31 C) after 40 D) 21 24. Line 16-28 form what element within C++? A) prototype B) constructor C) description D) instance 25. Which line creates a timer in the program? A) 22 B) 62 C) 63 D) 78 26. Which line sets the timer period in milliseconds and that it will run continuously (default)? A) 68 B) 20 C) 22 D) 63 27. When the timer ticks, which actual member functionis executed? A) 20 B) 22 C) 78 D) 33 28. What action specifically happens when the timer ticks? A) The string after offset is placed on textControl B) the whole string is placed on textControl C) the string up to the offset is placed on textControl D) A single letter is placed on textControl 29. When does a happy face appear on screen? A) never B) At the end of the string C) only once D) at the beginning of the next string 30. Where is MyStringOffset kept within the bounds of the string? A) 81 B) 24 C) 25 D) 61 31. Which line is the best example of a scope operator? A) 48 B) 78 C) 3 D) 13 32. The member function on line 72 belongs to which class object? A) menuFile B) textControl C) m_timer D) frame 33. Line 63 uses arrow notation with m_timer which is determined with its declaration. Where is m_timer declared and what type of object is it? A) 62 - timer B) 33 - event C) 22 - pointer D) 78 - member function 34. What makes program "events continue" to run after the splash screen is drawn? A) wxTimer B) wxFrame C) wxApp D) wxTextCtrl 35. If the timer was not incorporated into the program, where would all the execution time be spent? A) permission to write to cout B) wxFrame window C) wxTextCtrl keyboard input D) wxApp idle loop 36. Which item in Illustration 1 encompasses the entire software development process, which includes processes such as requirements definition, software design, coding, source code control, code reviews, change management, configuration management, testing, release management, and product integration? A) 3 B) 2 C) 1 D) 5 37. Which item in Illustration 1 is the original document from which subsequent copies are made? A) 2 B) 1 C) 4 D) 6 38. Which item in Illustration 1 is a process for establishing and maintaining consistency of a product's performance, functional and physical attributes with its requirements, design and operational information throughout its life? A) 4 B) 3 C) 2 D) 7 39. Which item in Illustration 1 is the management of changes to documents, computer programs, large web sites, and other collections of information? A) 3 B) 6 C) 4 D) 7 40. The process where vendors agree to supply products that comply with detailed descriptions of the measurable characteristics desired in an item to be purchased, such as quality, size, weight, performance parameters, safety requirements, etc. A) 4 B) 3 C) 6 D) 7
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started