Mr.Khaled Anwar ( )

Similar documents
Else. End If End Sub End Class. PDF created with pdffactory trial version

Chapter 1: Representing Data

S.2 Computer Literacy Question-Answer Book

Unit 7. Lesson 7.1. Loop. For Next Statements. Introduction. Loop

Unit 3. Lesson Designing User Interface-2. TreeView Control. TreeView Contol

VISUAL BASIC II CC111 INTRODUCTION TO COMPUTERS

Revision for Final Examination (Second Semester) Grade 9

In this tutorial we will create a simple calculator to Add/Subtract/Multiply and Divide two numbers and show a simple message box result.

DO NOT COPY AMIT PHOTOSTUDIO

Programming with Visual Studio Higher (v. 2013)

IMS1906: Business Software Fundamentals Tutorial exercises Week 5: Variables and Constants

Objectives. After completing this topic, the students will: Understand of the concept of polymorphism Know on How to implement 2 types of polymorphism

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Label1.Text = Label1.

To enter the number in decimals Label 1 To show total. Text:...

A Complete Tutorial for Beginners LIEW VOON KIONG

超音波モータ制御プログラムの作成 (v1.2.1)

Learning VB.Net. Tutorial 10 Collections

Form Connection. Imports System Imports System.Threading Imports System.IO.Ports Imports System.ComponentModel

Unit 4. Lesson 4.1. Managing Data. Data types. Introduction. Data type. Visual Basic 2008 Data types

Repetition Structures

Radius= 10 cm, Color= Red, Weight= 200g, X= 3m, Y= 5m, Z= 2m. Radius= 10 cm, Color= Blue, Weight= 200g, X= 3m, Y= 5m, Z= 0m

My first game. 'function which adds objects with bug tag to bugarray array. Saturday, November 23, :06 AM

Visual Basic: Opdracht Structuur

Computing Science Unit 1

โปรแกรมช วยทดสอบหม อแปลงกระแส

Computer Net Revision

DRAWING AND MOVING IMAGES

FOR 240 Homework Assignment 4 Using DBGridView and Other VB Controls to Manipulate Database Introduction to Computing in Natural Resources

(0,0) (600, 400) CS109. PictureBox and Timer Controls

Disclaimer. Trademarks. Liability

Learning VB.Net. Tutorial 19 Classes and Inheritance

Add Subtract Multiply Divide

System Analysis and Design

Final Exam 7:00-10:00pm, April 14, 2008

: CREATING WEB BASED APPLICATIONS FOR INSTRUMENT DATA TRANSFER USING VISUAL STUDIO.NET

Section 7 The BASIC Language II

VARIABLES. Aim Understanding how computer programs store values, and how they are accessed and used in computer programs.

Interacting with External Applications

CALIFORNIA STATE UNIVERSITY, SACRAMENTO College of Business Administration. MIS 15 Introduction to Business Programming. Programming Assignment 3 (P3)

VARIABLES. 1. STRINGS Data with letters and/or characters 2. INTEGERS Numbers without decimals 3. FLOATING POINT NUMBERS Numbers with decimals

VB.NET Programs. ADO.NET (insert, update, view records)

Form Adapter Example. DRAFT Document ID : Form_Adapter.PDF Author : Michele Harris Version : 1.1 Date :

Overview About KBasic

Serial-out Color Sensor. Overview. Features

Programming for Engineers Iteration

Decision Structures. Start. Do I have a test in morning? Study for test. Watch TV tonight. Stop


VB FUNCTIONS AND OPERATORS

Lab 3 The High-Low Game

Developing Student Programming and Problem-Solving Skills With Visual Basic

Now find the button component in the tool box. [if toolbox isn't present click VIEW on the top and click toolbox]

"!#... )*! "!# )+, -./ 01 $

Disclaimer. Trademarks. Liability

Member Management System

PROGRAMMING ASSIGNMENT: MOVIE QUIZ

Year 12 : Visual Basic Tutorial.

Tutorial 03 understanding controls : buttons, text boxes

BASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I

WEEK 1. Event: Tick: Occurs when the specified timer interval has elapsed and the timer is enabled.

Repetition Structures

Condition-Controlled Loop. Condition-Controlled Loop. If Statement. Various Forms. Conditional-Controlled Loop. Loop Caution.

Chapter 4: Control structures. Repetition

Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.

Lab 4: Adding a Windows User-Interface

Lecture 10 OOP and VB.Net

Upgrading Applications

PROBLEM SOLVING WITH LOOPS. Chapter 7

UNIT 2 USING VB TO EXPAND OUR KNOWLEDGE OF PROGRAMMING

Loops and Files. Chapter 04 MIT 12043, Fundamentals of Programming By: S. Sabraz Nawaz

Introduction. C provides two styles of flow control:

Chapter 4: Control structures

You will have mastered the material in this chapter when you can:

An overview about DroidBasic For Android

OVERLOADING METHODS AND CONSTRUCTORS: The Ball Class

5.1. Chapter 5: The Increment and Decrement Operators. The Increment and Decrement Operators. Looping. ++ is the increment operator.

Chapter 4 The If Then Statement

ก Microsoft Visual Studio 2008

Chapter 3 Problem Solving and the Computer

Learning VB.Net. Tutorial 17 Classes

VISUAL BASIC 2005 EXPRESS: NOW PLAYING

C-LANGUAGE CURRICULAM

Language Fundamentals

Chapter 1: Problem Solving Skills Introduction to Programming GENG 200

Lecture 7 Tao Wang 1

Individual research task. You should all have completed the research task set last week. Please make sure you hand it in today.

Control Statements: Part 1

An InputBox( ) function will display an input Box window where the user can enter a value or a text. The format is

o Counter and sentinel controlled loops o Formatting output o Type casting o Top-down, stepwise refinement

Quick Reference Guide

Multiple Choice (Questions 1 13) 26 Points Select all correct answers (multiple correct answers are possible)

VBA Collections A Group of Similar Objects that Share Common Properties, Methods and

COPYRIGHTED MATERIAL. Taking Web Services for a Test Drive. Chapter 1. What s a Web Service?

variables programming statements

Check out the demo video of this application so you know what you will be making in this tutorial.

Higher Computing Science Software Design and Development - Programming Summary Notes

Learning VB.Net. Tutorial 15 Structures

3 The L oop Control Structure

Flow Control Continued

Appendix 1: Pseudo-code command set

COMS 469: Interactive Media II

Transcription:

The Rnd() function generates random numbers. Every time Rnd() is executed, it returns a different random fraction (greater than or equal to 0 and less than 1). If you end execution and run the program again, you will notice that it produces the same sequence each time the program is executed. To make the computer produce a different sequence of random numbers each time the program runs, use the function: Randomize() which needs to be executed only once, before the first Rnd() is executed. 1

Public Class Form1 Dim A, B, M As Byte Dim R As Single Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Randomize() A = Fix(Rnd() * 13) : B = Fix(Rnd() * 13) Label1.Text = A : Label3.Text = B TextBox1.Clear() : TextBox1.Focus() Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click R = Val(TextBox1.Text) M = A * B If R = M Then MsgBox("Right Answer") Else MsgBox("Wrong Answer... Right Answer " & M) End If 2

Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim X, Y, L, H As Single Randomize( ) X = Me.Width - PictureBox1.Width Y = Me.Height - PictureBox1.Height L = Fix(Rnd( ) * X) H = Fix(Rnd( ) * Y) PictureBox1.Left = L PictureBox1.Top = H End Class 3

The Timer: It is an invisible stop watch that gives you access to the system clock from the new designed program. By the timer we can make events occur after some interval and without the user intervention. The Timer properties: 1- Interval: Using it the time interval can be set after which the timer starts. This interval ranges from (Zero to 65535) milliseconds. 1000 milliseconds = 1 second 2- Enabled: It takes the value (True) or (False) and by which we can start or stop the timer. The default of this property is (False) 3- Tick Event: It is the event of the timer and when the timer start after the interval which in interval property. We can write inside the tick event what we want to be executed automatically after an interval. 4

The datetime Structure: This structure is in V.B and it contains an extensive list of properties and methods and when declaring a variable of the Date type, then it will be possible to use the properties and methods of this structure. The following table lists some of those properties. Dim S As Date Property Purpose Example Result Now Retrieve system date and time X = Now 10/1/2010 10:06:27 PM Date Date Component X.Date 10/1/2010 Day Day of month (1-31) X.Day 10 DayOfYear Day of year (1-366) X. DayOfYear 10 Hour Hour (0-23) X. Hour 22 Minute Minute (0-59) X. Minute 6 Second Second (0-59) X. Second 27 Month Insert month order through the year (January) X. Month 1 5

Method of the (Datetime) Structure: 1- Add Days : Creates a new date value that is specified numbers of days later (Or earlier). 2- Add Hours : Creates a new date value that is specified numbers of hours later (Or earlier). 3- Add Minutes : Creates a new date value that is specified numbers of Minutes later (Or earlier). For Example: Dim H As Date H.AddHours (-3) This statements result in creating a new date that is three hours earlier. 6

Public Class Form1 Dim M As Byte Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load M = 0 Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Label1.Text = TimeOfDay M = M + 1 If M = 60 Then End 7

End Class 8

Public Class Form1 Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Label1.Text = Now Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Label1.Text = Today Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Label1.Text = TimeOfDay 9

End Class 10

Public Class Form1 Dim M As Byte Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load M = 0 Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Label1.Text = TimeOfDay M = M + 1 If M = 60 Then End 11

End Class 12

13

Public Class Form1 Dim X As Integer Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick PictureBox1.Left = PictureBox1.Left + 5 If PictureBox1.Left > X - 10 Then Timer1.Enabled = False : Timer2.Enabled = True End If Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load X = Me.Width - PictureBox1.Width Timer1.Enabled = True : Timer2.Enabled = False Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick PictureBox1.Left = PictureBox1.Left - 5 If PictureBox1.Left < 0 Then Timer1.Enabled = True : Timer2.Enabled = False End If End Class 14

Public Class Form1 Dim TR As Byte Dim SCORE As Integer Private Sub Button1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseDown Button1.Image = PictureBox2.Image SCORE = SCORE + 1 Label3.Text = SCORE 15

Private Sub Button1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseUp Button1.Image = PictureBox1.Image Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Dim K As Byte K = MsgBox("Are you sure?", MsgBoxStyle.YesNo, "Exit") If K = vbyes Then End Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim K As Byte Timer1.Enabled = False K = MsgBox("Do you want to play New Game?", MsgBoxStyle.YesNo, "New Game") If K = vbyes Then Label5.Hide() Button1.Left = 0 : Button1.Top = 0 SCORE = 0 ' Button2.Enabled = False Button3.Enabled = True Button2.Enabled = False TR = 30 Else If TR > 0 Then Timer1.Enabled = True End If Label2.Text = TR 16

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Button3.Enabled = False Button1.Enabled = True Timer1.Enabled = True Button2.Enabled = True Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Button1.Left = Rnd() * (Me.Width - Button1.Width) Button1.Top = Rnd() * (Me.Height - Button1.Height) If TR > 0 Then TR = TR - 1 Label2.Text = TR End If If TR = 0 Then Timer1.Enabled = False Button1.Enabled = False Label5.Show() If SCORE <= 30 Then Label5.Text = "Weak" If SCORE > 30 And SCORE < 40 Then Label5.Text = "Pass" If SCORE >= 40 And SCORE < 50 Then Label5.Text = "Good" If SCORE >= 50 And SCORE < 70 Then Label5.Text = "Very Good" If SCORE >= 70 Then Label5.Text = "Excellent" End If Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Randomize() 17

Public Class Form1 Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged PictureBox1.Show() Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged PictureBox1.Hide() End Class 18

19

The reserved word for marks the top of the loop, and the reserved word Next marks its bottom. The counter is a numeric variable that the programmer provides and that the loop uses to count iterations. Start, end, and increment are numeric expressions that the programmer provides. Using the keyword Step is optional. If you omit it, the counter is incremented by one after each repetition, by default. When the computer executes the For statement the first time: The Start numeric value is stored in the variable counter. The value stored in counter is compared to the ending value end, then a) If the counter is greater than end, then the computer exits the loop, and execution resumes at the statement following the reserved word Next. b) If the counter is less than or equal to end, then the computer executes the statements inside the loop from top to bottom. When the computer executes the Next statement, it 1. Increases the value stored in counter by the value of increment. If the keyword Step is omitted, the counter is incremented by 1. 2. Execution goes back to the top of the loop. 20

Examples Using the For Net Statement 1- Vary the control variable from 5 to 50 with increments of 2 2-Vary the control variable i from 1 to 100 with increments of 1 For i = 1 To 100 Or For i = 1 To 100 Step 1 3- Vary the control variable i from 10 to 2 with increments of -2 (decrements of 2) For i = 10 To 2 Step -2 4- Vary the control variable i over the sequence 11, 13, 15, 17, and 19 For i = 11 To 19 Step 2 5- Vary the control variable i over the sequence 49, 42, 35, 28, and 21 For i = 49 To 21 Step -7 21

22

Public Class Form1 Dim N As Byte Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load TextBox1.Clear() For N = 1 To 10 TextBox1.Text = TextBox1.Text & N & vbcrlf Next Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click TextBox2.Clear() Label2.Text = Button1.Text For N = 1 To 10 Step 2 TextBox2.Text = TextBox2.Text & N & vbcrlf Next Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox2.Clear() Label2.Text = Button2.Text For N = 2 To 10 Step 2 TextBox2.Text = TextBox2.Text & N & vbcrlf Next End Class 23

Each time the computer encounters DO While, it evaluates the condition. If the condition is False, execution skips to the first statement following the reserved word LOOP, as can be seen in Figure 3-2 Figure 3-2 24

As long as the condition is True, the computer executes the statements in the body of the loop from top to bottom. The reserved word Loop then causes execution to go back up to the top of the loop where the condition is evaluated again and then either we exit the loop or we execute the statements in the loop seen in Figure 3-3 Figure 3-3 Example (3-1): The code in Figure 3-4 illustrates the Do While Loop, where we need to calculate the sum of all odd integer numbers from 1 to limit where limit is an integer in txtlimit text box. The corresponding user interface is show in the Figure 3-5 25

The user interface odd numbers application Figure 3-5 26

Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim W, T As String W = "By" T = "" Do While T < > W T = InputBox("Enter any Name") MsgBox("Welcome " & T) Loop End End Class 27

Any system in the universe, whether material or virtual needs to follow main stages to create it or improve its performance, these stages are summarized as follows: 1. Analysis 2. Design 3. Coding 4. Implementation 5. Maintenance You can create any software by following stages of the development of the system (System Development Life Cycle). There are many models that can be used to do so, and now you can use the model in the following figure(1). 28

Model (1) The System development Life This model is called "Waterfall Model" The following table shows these stages. Terms Other related terms or activities Analysis Analyze problem and identify system requirements Design OOP design, Structured design Implementation Development, construction, testing, installation Operation Implementation, documentation Maintenance Perform required modifications to cope with evolution & 29

development and make data backup copies Q1- Select the appropriate answer of the following: 1 - Follow the steps to solving a specific problem, the first step of the solution are: (identify the problem - determine output - plan the solution ) 2 - Map the flow of flowchart One way to solve the problem of what he called this step: (writing program - documentation of the program - plan the solution) 3 - step in which they are required to write code in one of the computer languages are: (write a program to - test and debug the program - identify inputs) 4 - Step by step pre-test and debug the program while solving a problem are: (closer to the program - write a program - determine output) 5 - Last step of solving the problem are: (deviate output - Write the program - documenting the program) 6 - The first phase of the main stages of the work of any system or improvement in the performance stage is: (Design - Implementation - Analysis) 7 - The last phase of the main stages of the work system, oh no improvement in the performance are: 30

(Analysis - Implementation - Maintenance) 8 - Run the program and enter the necessary data and test results and then the program is documented in this phase: (Implementation - Coding - Design) 9 - A study of the problem at hand and know the system requirements in this phase: (Analysis - Implementation - Coding) 10 - To develop a method for the work of any system, in that phase: (Coding - Design - Implementation) 11 - Of the tools used in the implementation of a set of commands automatically after a certain period of time is the tool: (Text Box - Timer - ComboBox) 12 - A set of instructions can be executed within the procedure Timer - tick after a certain period of time to be determined characteristic: (Interval - Enabled - Name) 13 - The result of command execution (time of day) Msg box gives: (the current time - the current date - current date and time) 14 - The result of command execution (Today) Msg Box given: (to the current date - the comment - current date and time) 15 - Can be found by using a random number function: ( Interval - Rnd - Year) 16 - When you use the conditional sentence If.. then.. else if the condition is met, which between If and Then are executed 31

(phrases Then after that - sentences else after that - before phrases If) 17 - When you use the conditional sentence If.. then.. else if the condition is not met, which between If and Then are executed: (phrases Then after that - sentences else after that - before phrases If) 18 - In the sentence "Clock" = me.text been using the property: (me - Text - clock) 19 - In the sentence "timer" = me.text been using the property: (me - Text - clock) 20 - After the implementation of the sentence Button 1. Enabled = false becomes the object Button1: (not available for use - vanished - available for use) Q2. Put ( ) or (X) 1 - select the input or step of the solution to the problem ( ) 2 - Defining the problem, first step of solving any problem ( ) 3 - Step by step followed by select inputs determine the output during the solution of any problem ( ) 4 - Step writing program last step of solving any problem ( ) 5 - A step closer the program, last step of solving any problem ( ) 6 - To develop a method followed by step writing program while 32

solving any problem ( ) 7 - Step test and debug the program followed by step writing program while solving the problem ( ) 8 - Maps flow one way to solve the problem ( ) 9 - Humor is the first analysis of the key stages of the establishment of this system or the improvement in performance ( ) 10 - In the maintenance phase is the last key stages of the establishment of any system or improvement in performance ( ) 11 - At the stage of documenting the program is correct and test the program( ) 12 - In the implementation phase of the program is run and the introduction of the necessary data and then test the results then are documented program ( ) 13 - In the design stage is to run the program and enter the necessary data and test output ( ) 14 - The program is written using the language of the computer in the appropriate phase code while solving the problem ( ) 15 - Maintenance phase precedes the design phase in the initial stages of the establishment of any system ( ) 33

Q.3- Complete Youssef wanted to calculate area of a circle so h wrote the following program: Const Pi As Single = 3.14 Dim R As Single Dim Area As Double R = 1000 Area = Pi * R * R MsgBox( Area ) 1. Youssef used the numeric variable R of type.. to store the value 2. He used also numeric constant.. of the data type single to store the value... 3. Youssef used the numeric variable. of data type...to store.. which is equal to Pi*R 2. 4. Numeric variable was declared using the keyword (Dim), the constant Pi was declared using the keyword... 34

Q.4 - Choose the correct answer: (Dim, Const, String, Single) 1. Khaled wanted to calculate total grade of a student so he declared numeric variables using the word. 2. He used a variable of data type... To store student name. 3. He used a variable of data type. to store the total grade. Q5. : Put ( ) or ( ) 1-Add It's possible to control the intervals of the "Timer" firing through the "Interval property" ( ) 2-One second is equal 100 milliseconds ( ) 3-The determined interval in " Interval property " ranges from (zero, 6500) milliseconds ( ) 4-By " Enabled " property of the timer the "Timer" runs or stops it after putting it on the "Form window" ( ) 5-When "Enable property" takes "True" value, this prevents "Tick event" from occurring and stops the "Timer" ( ) 6-To control " Enable property " and give it (True or False) values, that should be during designing and that can't be controlled during running ( ) 7- To use (DateTime) structure and its properties and method we should first declare a variable of the Date type. ( ) 35

Q6- What is the term which the following sentences indicate: 1- It is a property which means the duration in which the timer is activated and when it is activated Tick event occurs. 36 (..) 2- An event of the timer and it occurs when activating (starting) the timer and we write inside the statements which need to be executed after on interval. 3- An invisible object which helps us in our dealing with the operating system clock. (..) (..) 4- It has a number of properties and methods which control the time and they may be used when declaring a variable of the Date type. (..) Q7- Choose from the second column the suitable for the first column: Column (1) Column (2) 1 Second ( ) A Insert the Month order during the year. 2 Day ( ) B Insert the current second. 3 Now (.) C Insert the Day order during the year. 4 Minutes ( ) D Insert the current minute. 5 Date ( ) E Insert the Day order during the month. 6 Month (.) F Occurs after the specified interval and the statements in it are executed. 7 Enabled ( ) G Insert the current date and time. Responsible for determining the duration after 8 Tick ( ) H which the timer starts and is measure with the millisecond 9 DateOfYear(.) J Insert the current Date. 10 Interval ( ) K For starting or stopping the timer.

Q8. : Multiple choices Question:- 1- Timer property Interval sets the rate at Tick events occur in a) Seconds b) Milliseconds c) Minute d) Hour 2- Timer property Interval property sets the rate at which tick events occur in a. Second b. Minute. c. Millisecond. d. Hour 3- If Interval value is 3000, then its value in seconds is: a. 3 b. 30 c. 3000 d. 300 4- The.. structure retrieves your computer s date and time. a. Current Time b. Time c. Now d. DateTime 5- You can. To a date variable. a. Add day s b. Add hour s c. Subtract days d. All of the above 6- To subtract one day from Date variable X, assign the value returned by.. to X. a. X.AddHours (-24) b. X.SubtractDays c. X.AddHours (-1) 37

d. a and c Q9. Choose the correct answer for each one of the following: 1- In For Next statement, the number of repetition in For X=1 to 8 step 3 is (a) 3 (b) 4 (c) 2 (d) 1 2- The property Interval for the (Timer) sets the rate at which the event occurs in (a) Second. (c) Millisecond. (b) Minute. (d) Hour. 3 - We can stop the timer by giving the property --------- the value false (a) Interval. (c) Modifiers (b) Enabled. (d) Tag 4- The Numeric Variable which takes integer numbers from 0 to 255 is.. (a) Integer. (c) Byte. (b) String. (d) Double. 38

Q10.Complete the following statements from the words between brackets: 1- To prevent the (Timer1) from running, you write the command " Timer1.enabled =.. " ) True False End ) 2- In (If Then Else ) statement, when the outcome of the condition is evaluated to be. then the statements following (Else) are executed ) True False Null ) 3- You can find out the date and time in the computer by executing the command MsgBox (.........) ) Now Time DateTime ) 4- To delete all items from the object (listbox1), we use the method... ) Remove Clear Delete ) Q11. Complete the following statements from the words between brackets. (Dim Const String - Single - Class Object) Khaled wants to write program codes to compute the total degrees of a student in all subjects, and 1-he uses numerical variable of type Single which is declared by the term ( ) 2-he uses also a variable type ( ) to store student name value. 39

3-he uses a variable of type ( ) to store the total degrees of the student in all subjects. Q12. A) Read the following instructions Dim Age, Mark, Total As Single Age = 25.5 Mark = 90 If Age < 26 Then Age = 16 Mark=100 End If Total = Mark * 2 B) Execute the previous instructions,then choose the correct answers from the following: 1. The value of the variable "Age" is: a- 25.5 b -90 c -16 2. The value of the variable "Mark" is: a 90 b-100 c-25.5 3. The result of the condition Age < 26 : a 25.5 b- True c-false 40

4. The value of the variable "Total" is: a 200 b- 180 c- 190 Q13-Put a tick ( ) in front of the true sentence and a cross (X) in front of the wrong sentence: 1- The variable name "Spent_Money" is a valid name in terms of rules of naming variables. ( ) 2- The For Next Loop is used when we know in advance the number of iterations of the loop. ( ) 3-In a program, lines that begin with ('), are considered comments within the program code. ( ) 4-Variable of type Double is used to store integers only ( ) 5-To clear the ListBox control from all items, the method Remove (text) is used. ( ) Q14 a- Read the following code: Dim X, Y, Z As Integer X = 2 Y = 3 Z = 4 MsgBox ( Y^X * X + Z * 3 ) 41

And then type the result of the execution :... b- Read the following code: Dim X, C As Integer X = 4 For C = 0 To 7 Step 3 X = X * 2 Next MsgBox ( X ) What is the value of x in the message box?... Q15-Write the scientific term for each phrase of the following statements: A- Method used to delete all items of the ListBox control is (...). B- Tool that allows programmers to divide a number of RadioButtons and CheckBoxes into different groups. (...). 42

C- Tool that allows you to create or display a list of items (...). Q.16: Match from the First column with the suitable in the second column: From the properties of Check Box Property Function 1 Appearance (.) 1 Set the width of the control 2 Width (.) 2 Changes the button from into the default 3 Enabled (.) 3 Sets and puts image on the control 4 Image (.) 4 Determines whether to choose the control or not (True or False) 5 Checked (.) 5 Runs or stops the control Q.17: Put ( ) or (X) 1- To store a numeric statement in a variable, this variable could be named (1 Number) ( ) 2- Colors are from the examples of the intrinsic constants in VB. ( ) 43

3- Byte means the equal sized bytes which determine the size of the computer memory ( ) 4- Interval property of the timer determines the average of tick event of the occurrence and the value of this property could be measured by minutes( ) The compound condition And takes the true value if one of the conditions is True and not both of them ( ) Q18. : Choose the correct answer: 1- Giving that X = 3, Y = 2, then the result of (X ^ Y + 3 * 2) is. ( 20-16 - 15 ) 2- To remove all the items in the Listbox, use the method. (Clear Delete remove) 3- You can add by. An item in the end of the program, (Add Insert Count) 4- The code.. is used for the integer division. ( Mod - \ - / ) 44