Sunteți pe pagina 1din 9
UNIVERSITY EXAMINATIONS LUNIVERSITEITSEKSAMENS UNISA INF2611 VISUAL PROGRAMMING II Duraton 2 Hous EXAMINERS BRST DR V2 HORNER SECOND MsELeus EXTERNAL MS SJVAN DER MERWE ee Mayidune 2015 70 Marke Closed book examination “This examination question paper remains the property ef the Unlversity of South Africa and may not be removed from ‘he examination venue ‘This paper consists of 9 pages. Instructions: ‘Answer all questions in the answer book Answers in pencil will be marked Enjoy! Marks are given in the brackets next to the question. CTOREOVER) INF2611 fay/June 2015 Question 1 — Menus (15) Gonsider the following application using menu tne Leet Om ‘The new main menu component, to he added to «§* OFF Surarmeswate the U! and also the menu, is called ae mnuDeleteName, To prevent the repetition of the code for most of the menu-items, we use the event handlers of the existing buttons Gey ont Stee What is a cascading menu? Explain how this menu type ts used in the ‘example application provided. (2). Discuss three reasons why menus are required in the development of a database application (2) Explain what the purpose of an accelerator key 1s on a menu? Give an ‘example of such a key from the example provided (2) Name at feast two types of monus that you used in your database prolect Discuss the purpose of each of these menu types that you used (4) Explain how the Load menu ttem (giving the coda where required) ts inked with the relevant Load buttons for the re-use of an event handler (3) What additional code is required to ensure that the DELETE menu item matches the behaviour of the Delete Button? Explain why this is necessary? 2) [Please Tum Over] INF2611 May/June 2015 Question 2~ Multiple forms (15) “A Delphi project is a collection of files that make up an application”. ©) Project pion forfnTeffil gry ev Bae Configuration 2 em Go cor 4 esa eCe3e Dress ecerscendterss aaneeeteens a seebos sop ate erin 2 Bremen Bost adeee “ bet x ce! “ee (EEE eee eee ‘a There are several aptions for the inclusion of multiple forms and reuse of multiple forms in a database application Discuss three such options, referring to the form options presented above (6) b_ Name two different modes of form use that you used in your database project Name and motwate the use of these two form formats (4) [Please Turn Over] Explain (with clear reference tothe information provided) why error messages were generated dunng the compilation of the project” Hint the one form references, the other (2) INF 2611 May/June 2015, Foam = | ousrena. conform Lofthe appl aton! Sho. form Z modal, type @ message and ness aack ta form Sten farm 2 moses type 2 message anc pass pack ta form 3 Tremessege sr Forn2 5 = Fo > a whe form 2ressage sie ‘eseage Go beck to om 1 uth messace Gosece ta form 4 sth message uoperCase Name at least three factors (designer or user) that need to be taken into consideration when including multiple forms into an application (3) [Please Turn Over] INF2611 May/June 2015 Qi Database applic 1s (20) ‘a Whats the difference between data and information? Explain with CONCISE reference to your database project, what data was required and what information was available You are welcome to include references to data collection methods and sources (4) What is a data module? What is the importance of a data module? Name at least two components included in a data module. (4) Reporting can be used to gain information from the data in your database ‘Name and exolain two reports that you included in your project Also include Televant references to queries used and table accessed Motwate the purpose for including these in your project (4) d With reference to your database project, explain how data was retrieved from ‘the database for manipulation within your database application You may include reference to data aware controls and connactions that you specifically sed (4) 2 The following is a required structure for a database application Provide an ‘explanation of the function of the code to be included in the FormShow and in the FormClose subroutines You may add specific reference to and details of your database application Code or text comments may be used to motwate the inclusion of this code in the database application (4) procedure TfrnMlyProject .formShow(Sender TObyect) , begin //Beplain what code is required here in this subroutine. end, procedure TfrmMyProject .FormClose (Sender TOobject; var Action: TCloseAction) ; begin //Beplain what code is required here in this subroutine. end, [Please Turn Over] INF2611 May/June 2015 n4 bject orientation (20) The program below presents the simple object. onented traffic light shown alongside The structure of a trathc ight object 1s given in the Object TreeView. aia) A eT 2) btTraffictight > shpGireen | shpRed >] shpYellow 3 tmTrafhoLight ‘unit LightControlU, //Defines the user interface ] interface | uses | Windows, Messages, SysUtils, Variants, Classes, Graphics, | controls, Forms, Dialogs, ExtCtris, Stdctrls, Traffictightv, type Térmfrafficlaght - clase(TForm) tmrTraffaclaght: TTaner; Ablfrafficlight TLabel, shpRed Shape; shpYellow: TShape, shpGreen Shape; procedure tmrTrafficlightTimer(Sender TObject) , procedure FormShow(Sender Object), private procedure UpDateDisplay; public { Public declarations } end, frmfrafficbight TfrwTraffaclaght, MyTrafficlaght: TTrafficlight, // TTrafficlight a programmer defined Period: integer, [Please Turn Over] INF2611 May/June 2015 State: string, Stoplight, Cautionbight, GoLight Color; dmplementation [$R *.dfm} procedure Tfrmfraffictaght .FormShow (Sender: Tobject) ; begin MyTraffichight + TfrafficLight Create; State := ‘Caution; MyTrafficlaght Nextstate(State, Period, Stoplight, Cautionlaght, Golaght) ; UpDateDisplay, ead; // end procedure TfrmTrafficlight Formshow procedure TérmfrafficLaght tmrTrafficLaghtTamer (Sender: ‘DObject), begin MyTrafficLight NextState(state, Period, Stoplight, Cautionbight, Gobaght); UpDateDisplay; end, // end procedure Tirmfraffichaght tmrTraffichaghtTimer procedure TfrmfrafficLight UpDateDisplay; begin tmrTrafficlaght Interval := Period; Ibltraffictaght Caption := State, shpRed.Brush.Color Stoplight, shpYellow.Brush Color Cautrontagnt, shpGreen.Brush Color = Golaght; end, // end procedure Térw?rafficlaght UppateDisplay end__// end unat LaghtControlu wait TrafficlightU; //defines the object traffic light interface uses Graphics; // for Tcolor type ‘TTrafficlaght = class (Tobject) public Procedure Nextstate (var State: string; out Period anteger; var Stoplaght, CautionLight, GoLaght: TColor) , end, implementation ( Tiraffichaght } Procedure TTrafficlaght NextState(var State: string, out [Please Tum Over] INF2611 May/June 2015 Period: integer: var Stoplight, CautionLaght, GoLaght TColor), begin 4£ (State = 'Stop') then begin Pericd = 3000, State = 'Go', Stoplight = clBlack, Gobight elGreen; end else if (State = 'Go') then i begin Period = 1000, state = 'Caution'; Gobight = clBlack; Cautiontight += clYellow, end else begin Period = 4000, state 'stop'; Cautiontight .= clBlac! Stophight. = clRed, end; end, // end procedure Trrafficbight .Nextstate end. // end unit TraffichaghtU 1 Expiain the difference between an object anda class Give an example of each from the code given above (2) 2 Explain the concept of ihentance in object onentation Give an example from the code above (2) 3. The program given above consists of two units Name these two units, and describe the purpose of each of these units (4) 4 Each of the units has an interface section and an implementation secton. ‘What is the purpose of the interface section? (2) 5 The interface section has several sub-sections. Name two of these sub- sections, and describe the purpose of each of these subsections with reference to the code given. (4) 6. The uses clause of unit LightControlU contains a reference to TrafficLightU (line 6) What 1s the significance of this reference? (2) [Please Tum Over] 9 INF2611 May/June 2015 1. The textbook notes that there are three steps in creating objects, namely define the class, declare the name for an object of the class, and then create the object After creation, the object can be used. In the program above we define and use an object called MyTrafficLight. For this object, identity 1n unit, where each of these three steps occur and also where the object 1s used. (4) Unit name The class is defined The object is declared. The object is created The object is used @UNISA 2015

S-ar putea să vă placă și