INF2611-2010-6-E-1 - UNIVERSITY EXAMINATIONS...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 4
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 6
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: UNIVERSITY EXAMINATIONS UNIVERSiTEITSEKSAMENS UNISAQ: IN 1 MayiJune 2010 VISUAL PROGRAMMING 2 Durahon 2 Hours 70 Marks EXAMINERS FIRST MS PM GOUWS SECOND MR KJ HALLAND __—___—.__....———— Thls paper conSIsfs of 6 pages. Ins’rruchons: 0 Answer all queshons m The answer book 0 Answers In penal} Will be marked 0 Marks are given In the brackefs nex’r To The question 0 En Joy? INF2611 May/June 2010 QuesTion 1 - Menus (10) a GIVE four reasons why menus are used In an GPleCGTIOh (4) b Explam The dlfference beTween a drop-down and a pop-up menu (2) c DISCUSS The use of menus in your daTabase pr0|ecT IdenTIfy The menu Types ThaT you used, as well as The funchonaIITy ThaT These menus tmplemenTed (4) QuesTion 2 — MulTiple forms (10) a Explain The use and ImplemenTaTIon of The modal form sTyle, and give an example of such a form (4) b IdenTIfy The form sTers used In your daTabaSe prolecT MoTIvaTe Their use (2) c WhaT Is a daTa module? Explain why a daTa module IS included In any daTabase apphcaTIon (4) QuesTion 3 - DaTobase applications (251 a Explam The difference beTween daTa and mfor‘maTion (1) b. CharTIng and reporTing can be used To gain mformaTIon from The daTa In your daTabase applncaTIon Give Two examples of daTa In your daTabase, and Two examples of The unformaTIon ThaT was gamed. (4) c The daTa module holds non-Visual componenTs Explain whaT a daTa module, and gwe Two examples of such componenTs The funcTIon of each of These componenTS musT be given (5) d In a daTabase applucaTIon, we bring The daTa In a daTabaSe and The applncaTIon To mampulaTe This daTa TogeTher Explain how The modified daTa Is reTurned To The daTabase You may refer To The componenTs and examples ThaT you u5ed In you daTabase pro JECT (5) e The followmg IS an eXCerpT from an accommodaTIon daTabase applicoTIon Each accommodaTIon esTabIIshmenT musT have an owner Explain In deTaIl whaT The code Will do when execuTed, and moTIvaTe The Inclusmn of This code In The applrcaTIon (10) INF2611 May/June 2010 procedure TfrmOwner.FormShow(Sender TObject); begln dmoAccommodatlon.cdsOwner.Open: end; procedure TfrmOwner.FormClose(Sender TObject, var Actlon. TCloseActlon); begln 1f dmoAccommodatlon.cdsOwner.ChangeCount > 0 then dmoAccommodatlon.cdsOwner.ApplyUpdates(0); dmoAccommodatlon.cdsOwner.Close, end; procedure TfrmOwner.bmbUndoLastChangeClick(Sender: TObject), begln dmoAccommodatlon.cdsOwner.UndoLastChange(True); end; procedure TfrmAccommodatlon.Establishmentlellck(Sender: TObject); begln frmOwner.ShowModal, end, Qu_e_sfion 4 - Obiec‘r orientation (25) The program below presents the sumple ObJBC'I' oriented Traffic Ingh’r shown Traffic Light ENE”?! alonQSIde g lbITral‘thlght The structure of a [a 321333;" 1 s p 8 Traffic light obJec’r IS El ShpYenow given In The ObJec’r a: tmrTraffchIght TreeVIew 53 Caution unzt nghtControlU; //Def1nes the user interface 1nterface 1.1885 Wlndows, Messages, SysUtlls, Varlants, Classes, Graphlcs, Controls, Forms, Dlalogs, ExtCtrls, StdCtrls, TraffchlghtU; 4 lNF2611 May/June 2010 type TfrmTraffchight = c1ass(TFcrm) tmrTraffchlght: TTlmer; lblTraffchlght' TLabel; shpRed: TShape: shpYellow TShape; shpGreen: TShape; procedure tmrTraffchlghtTlmer(Sender: TObject), procedure FormShow(Sender TObject); prlvate procedure UpDateDlsplay; publlc { Public declarations } end; var frmTraffchlght- TfrmTraffchlght; MyTraffchlght: TTraffchlght, // TTraffchlght a programmer defined Period' 1nteger; State: strlng, Stoleght, Cautlonnght, Gonght: TColor; 1mp1ementat10n {SR *.dfm} procedure TfrmTraffchlght.FormShow(Sender TObject), begrn MyTraffchlght := TTraffch1ght.Create, State '= 'Cautlon'. MyTraff1cL1ght.NextState(State, Perlod, Stoleght, Cautlonnght, Gonght); UpDateDlsplay; end; // end procedure TfrmTraffchlght.EbrmShow procedure TfrmTraffchlght.tmrTraffchlghtTlmer(Sender: TObject); begrn MyTraff1cL1ght.NextState(State, Perlod, Stoleght, Cautlonnght, Gonght); UpDateDlsplay: end; // end procedure TfrmTraffchlght tmrTraffchlghtTlmer procedure TfrmTrafficnght.UpDateDlsplay; begln tmrTraffchlght.Interval := Period; lblTraffchlght.Captlon .= State; shpRed.Brush.Color := Stoleght: shpYellow.Brush.Color := Cautronnght; shpGreen.Brush.Color :: Gonght; end: // end procedure TfrmTraffchlght.UpDateDlsplay end. // end UHlt LightControlU INF2611 May/June 2010 un1t TraffchlghtU; //def1nes the object trafflc llght 1nterface // for TColor uses Graphlcs: type TTraffchlght = class (TObject) pub11c procedure NextState (var State. strlng; out Period: 1nteger: var Stoleght, Cautlonnght, Gonght: TColor); end; lmplementation { TTraffchlght } procedure TTraff1cL1ght.NextState(var State: strlng, out Period: 1nteger; var Stoleght, Cautlonnght, Gonght TColor), begln 1f (State = 'Stop'} then begln Period := 3000; State := 'Go'; Stoleght .= clBlack; Gonght = chreen; end else 1f (State = 'Go') then beg1n Perlod = 1000; State := 'Cautlon', Gonght = clBlack, Cautionnght = clYellow, end else begin Perlod := 4000, State := 'Stop'; Cautlonnght := clBlack, Stoleght = clRed; end, end; // end procedure TTraffchlght NextState end. // end unit TrafficnghtU (1 Explain the difference between an ob JECT and a class usmg an example of each from ’rhe code given above (2) INF2611 May/June 2010 Explain The concepT of inheriTance in ob JECT orienTaTion Give an example from The code above (2) The program given above con5isTs of Two uniTs Name These Two unITs, and describe The purpose of each (4) Each of The uniTs has an inTerface secTion and on implemenTaTion secTion WhaT IS The purpose of The inTerface secTion') (2) The inTerface SecTion has several Sub-secTions Names These, and describe The purpose of each of TheSe subsecTions WiTh reference To The code given: (3) The u5es clause of MIT LighTConTrOIU conTains a reference To TrafficLighTU (line 6) WhaT is The Significance of This reference? (2) The Tebeook noTes ThaT There are Three sTeps In creaTing obJecTs, namer define The class, declare The name for an obJecT of The class, and Then creaTe The ob JecT AfTer creaTion, The obJecT can be used In The program above we define and use an ob JecT called MyTrafficLighT For This obJecT, idenTify in The MIT, where each of These Three sTeps occur and also where The ob JecT is used (8) The changing colour of The Traffic lighT is a sysTem evenT conTrolled by The Timer Explain The difference beTween a sysTem evenT and a user evenT Give an example of each from The code above (2) © UNISA 2010 ...
View Full Document

This note was uploaded on 02/27/2012 for the course IT 101 taught by Professor Unsure during the Spring '11 term at University of South Africa.

Page1 / 6

INF2611-2010-6-E-1 - UNIVERSITY EXAMINATIONS...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online