[go: up one dir, main page]

0% found this document useful (0 votes)
13 views19 pages

2015 Nov

Past Papers

Uploaded by

John Njiru
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
13 views19 pages

2015 Nov

Past Papers

Uploaded by

John Njiru
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 19
easytvet.com Name: Index No.: 4 2920/205 VISUAL PROGRAMMING Candidate’s Signature: November 2015 Time: 3 hours Date: « ‘THE KENYA NATIONAL EXAMINATIONS COUNCIL DIPLOMA IN INFORMATION COMMUNICATION TECHNOLOGY MODULE [1 VISUAL PROGRAMMING 3 hours INS PRUCTIONS TO CANDIDATES: Write your name and index number in the spaces provided above: Sign and write the date of examination in the spaces provided above. Answer any FIVE of the FIGHT questions in the spaces provided. Ali questions carey equal marks. Candidates should answer questions in English For Examirer’s Use Only Question | 1 2 3} a]s | 6/7 | 4 | TOTAL nt SCORE Candidate's __ Score This paper consists of 20 printed pages. Candidates should check the question paper to ascertain that all the pages are printed as indicated and that no questions are missing. (2015 The Kenya National Examinaitons Corneil Turn over ee, easytvet.com 1. @)_—G_ Outline two reasons for using Visual Basic programming language when developing a Hospital Management System. (2 marks) z (ii) Describe event driven process as used in Visual programming. (2 marks) (b) Outline the funetion of each of the following Multiple Document Interface (MDI) in a Visual Programming Language: / (i) menu bar mark) . toolbox : / a mach (iii) code form. - (1 mark) (co) With the aid of an example, distinguish between seam properties , design time and setting the properties at run time. (5 marks) 2920/205 _ 2 " - November 2015 easytvet.com (d) Figure 1 shows a Visual Basic application used to compute multiplication and division of numbers. Write a Visual Basic program that uses a function for each computation. The program should display the phrase “illegal division operation’ on a message box when the denominator is zeso. (8 marks) FRGT NUMBER SECOND NUMBER ANSIIER, Figure 1 2920/2085 3 Turn over Nowember 2015 easytvet.com 2. (@) With the aid of an example, explain the function of the underscore symbol in Visual Basic programming B marks) (b) Convert the following statement into its equivalent in Visual Basic programming language. (3 marks) Many of x and y is at least 100 and their product is at most 1000 , store their product into z, Otherwise stare 1000 into 2. (c) Interpret the following Visual Basic code. (6 marks) © Private Sub Buttonl_Click() Dim x As Integer = 6 Dim y As Integer = 8 Labell.caption = x & y temp = x x y = temp Label2. caption = x & y End Sub 2920/205 4 November 2015 easytvet.com (4) Write a Visual Basic program that assigns numeric values; 80, 60, 70, 30, 40 to an array. The program should then computes the average of the values and display the values and average on a list box (8 marks) 2920/205 5 Turn over Novenber 2015 easytvet.com November 2015 3. (a) @)_ List four objects that may be accessed using project explore window of a Visual Basic program during the development an application. (2-marks) Gi) Outline two events and two methods associated with a picture box control. (4 marks (b) State two differences between sub procedures and event procedures as used in Visual programming (4 marks) 2920/2058 6 easytvet.com (c) With the aid of an example in each case, distinguish between fwo-dimensional array and parallel array as used in programming, (S marks) (4) Write a visual basic program that prompts a user to enter a name of an anirnal through the use of input box function. The name entered is then assigned to a dynamic array. A user prompted to select Ok or cancel from a message box when required to add more animals or terminate the program. Attach the cade to a command button. (5 marks) 2920/205 7 Turn over November 2015 easytvet.com 4. (@) Outline each of the following events of a command button as used in Visual programming. (i) MouseHover (mark) z Gi) KeyPress (1 mark) (iii) MouseDown. (1 mark) (b) Outline the steps to be followed when creating a report using a data environment given that a database is already created. (4 marks) (©) @_Deseribe the shell sort algorithm used in programming to sort elements as used in programming. 3 marks) 2920/205, 8 November 2015 easytvet.com (ii) Distinguish betweon Visual programming and object-oriented programming, (4 marks) (a) The formula F = 2C +32 is used to convert temperature value from Celsius to Fahrenheit where F is temperature in Fahrenheit and is temperature in Celsius, Write a Visual Basic program that prompts a user to enter temperature in Celsius using an input function. The program should use a function to convert the temperature to its equivalent in Fahrenheit and display the output on a label. (6 marks) 2920/20 November 2015 9 Turn over easytvet.com 5 (a)_Inaa Visual Basic program, the variables x and y stores values 10 and 4 respectively. State the output generated from each of the following logical statements when executed: (2 marks) @)—— Qay)eo15 And yo3 i) (Ay) O15 OF y>3 (iii) >=18 Xor yore (iv) Not ety) <>15, 2920/2058 10 November 2015 easytvet.com (b) Distinguish between listbox and FlexGrid controls as used in a Visual Basic program. (4 marks) (©) Describe each of the following sections of a report design as used in a Visual Basic program. @ Detail (2 marks) (ii) Page Footer (2 marks) (iii) Report Footer. (2 marks) 2920/205 nh Turn over November 2015 easytvet.com (d) Table 1 shows the points and their corresponding grades that can be attained in an. examination. POINTS GRADES Less than or equals 0 12 3.4 5.6 78 Fail Greater than 8 Invalid value Write a Visual Basic program that allows a user to enter an integer value point through the use ofa text box. The program should then display appropriate grade on a label. Use select case contro] structure and attach the code to a command button. (8 marks) 2920/2058 12 November 2015 easytvet.com 6 @)—@_—_—_ Outline the stage in programing when each of the following errors can be detected, 1. syntax errors (4 mark) ; - HI. logical errors. (1 mark) Gi) Explain the error in each of the following Visual Basic statements, Lak =y/e (2 marks) Ml. for (x = 95 x < 10; x) { msgbox("Hello word") } (2 marks (b) With the aid of an example, explain a way in which a public procedure can be accessed ° from a form in Visual Basic programming. (3 marks) (©) State the Visual Basic control represented by cach of the following names: (i) onrTask (1 mark) Gi) shpTask (mark) ii) fraTask (1 mark) (iv) drvTask, (1 mark) 2920/208 13 ‘Turn over November 2015 easytvet.com (d) Every month, a salesperson is paid a fixed amount of Ksh 10,000. The salesperson is paid an additional commission at the rate of 5% of the individual sales greater or equal to Ksh 30,000 or suffers a pay cut of Ksh 1000 if the sales fall below Ksh.30,000. The total earning is taxed at a rate of 15%. Write a Visual Basic program that allows a user to enter the amount of sales through the usc of a text box. The program then computes the commission, the tax deducted and the net pay that the salesperson will receive. Thefhet pay for the month should then be displayed on a label. Attach the code to command button, (7 marks) 2920/205 4 November 2015 easytvet.com 7, (a) __ Explain the scope of a procedure defined by use of each of the following the keywords: (i) Publie (2 marks) . Gi) Private. (2 marks) (b) Figure 2 shows a Visual Basic form design to manipulate data in a database. Use it to answer the questions that follow, soonew | beta (i) Write a Visual Basic program statement attached to a command button: LADD NEW to allow a user to add a new record (2 marks) I. UPDATE to allow a user to update the records (2 marks) 2920/205 15 Turn over Nowember 2015 easytvet.com (ii) Modify the program by adding a procedure such that when the command bu ADD NEW is clicked, it becomes disable and the button UPDATE is enabled and vice versa (4m (c)__ Aprime number is a positive integer which is divisible by 1 and itself. For examp! 1s prime number since it has non zero remainder when divided by 6 or 5 or 4 or 3 01 Write a Visual Basic program that prompts a user to enter an integer value through use of an inputbox function, The program should test if the number entered is a prie number or not. if not, the program displays an appropriate message. Use the for... loop and mod operator. Attach the code to a command button. @m 2920/205 16 November 2015 easytvet.com 8 (a)_Deseribe an algorithm for searching a binary search tree. (4 marks) (b) Figure 3 shows a form which has an ADO control and command buttons used for navigating through records in a Visual Basic program. Use it to answer the questions that follow. First | Prev Net | Last | | oe [W[ajAdoact Bia : : Figure 3 (i) Outline the error associated with the events attached to the button labelled L Prev (1 mark) 2920/208 17 Turn over November 2018 easytvet.com I. ‘Next. (mar Gi) Explain a way of preventing the errors in (i). (4 mark (©) Alex intends to link a Visual Basic program to a database using ActiveX Data Control. Explain three record source commands that he may use. (6 mark 2920/205 Bw November 2015 easytvet.com (4) (i) With the aid of an example, show how to delete an array in Visual Basic program, (2 marks) (ii) State a circumstance in which an array is deleted in a programming. (2 marks) 2920/208 19 Turn over November 2015

You might also like