Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
final revision sheet prep3.doc
Скачиваний:
0
Добавлен:
01.07.2025
Размер:
833.02 Кб
Скачать

1) Declaring Variables

2) Assigning values to the Variables

Q11: Write the order of execution of Arithmetic operations that follow:

Order

Operation

( 3 )

Multiplications and divisions from left to right.

( 1 )

Parentheses starting from the inside out

( 4 )

Additions and subtractions from left to right

( 2 )

Exponentials.



Q12: Put each word in the right place:

(Start – Dim - Byte – Integer – Boolean – String – Single)

  1. We are used variable of type Single to put the degrees of subjects.

  2. Variables are declared using the word Dim

  3. We are used variable of type String to put the student’s name.

  4. The type of variables Integer used to store integer only.

  5. Variable of type Boolean takes the value True or False.

  6. The variable Byte Takes the values (0 : 255).

Q13: Give the suitable term to the following sentences:

  1. Data type for storing date and time. (Date)

  2. Data type for storing (String and characters) values. (String)

  3. Data type in the form of an object. (Object)

  4. Data type for storing logical values. (Boolean)

  5. It is stored in Visual Basic.Net and it indicates to the current Form window. (Me)

  6. Data type takes value in the border of (0 To 255). (Byte)

  7. It is typed in the start of the line in the Form window for typing a comment or note. (REM)

  8. It is statement that consists of two sides (right hand side and left hand side) separated by the assignment operator “=”; which doesn’t mean the arithmetic equality. And it enables to store a value in a variable or property. (assignment Statement)

  9. It means the errors which occur when typing the codes incorrectly in the code window as “characters errors”. (Syntax error)

  10. A guiding word for creating a new line. (Vbcrlf)

  11. It is a statement which is used for discovering the errors which occurs during the program runtime. (Try / Catch)

  12. A code for defining the constant name, type and value. (Declare of Constant)

  13. They are errors that occur as a result of the user entering incorrect values during the program runtime. (Runtime error)

  14. The word is used to announce the names of the constants in the program. (Const)

  15. It is used to link literal values together and make one value. (&)

Q14: What is the result of executing the following code?

  • Dim N1 As Byte = 3 : N2 As Byte = 2 : N3 As Byte = 5

  1. N2 ^ 2 * N3

………20……………………………………………………

  1. N1 * (N3 – 2) ^ 2 * N2 ^ 2

………108………………………………………………

  1. N1 * (N2 + 3)

……15……………………………………………………

  • Dim U_B As string

TextBox2.Text = “I like”

U_B = TextBox2.Text & “ “ & “ Egypt”

…… I like Egypt ……………………………………………………

Q15: What is the result of executing the following equations?

  1. 2 ^ 3 + (23 + 2) / 5

……………13…………………………………….

  1. 3 ^ 2 *2 + 4 + 3

…………25……………………………………….

  1. 3 ^ 2 + (2 + 4)

…………15……………………………………….

  1. (3 + 2 ^ 2) * 3 / 7

…………3……………………………………….

  1. 4 * 3 + 5 * 2 ^ 2

…………32……………………………………….

Q16: What is the wrong in each of the following codes?

  1. Dim number1 As Integer

Number = (4 * 3 ^ 2) / (3 – 9 / 3)

……………………You cannot divide by Zero…………………………

…………………………………………………………………………………………

…………………………………………………………………………………………

  1. Dim Total As Integer

Total = (5 * 2 ^ 3) / (18 / 6 – 3)

……………………… You cannot divide by Zero ………………………………..

…………………………………………………………………………………………

………………………………………………………………………………………….

Q17: Select the type of error in the following Code and then correct as follows

Code

Error type

Correction

Dim x As Sangle

Syntax Error

Single

Const x As Integer X=10

Syntax Error

Const x As Integer = 10

Q1: State whether the following statements are true (T) or false (F):

(1)

The number of possible branches when using (If ...Then..Else) statement is 2.

( )

(2)

In (IF) statement the code that follows (Else) is executed when the result of the conditional expression is (True).

( X )

(3)

The operator (&) is one of the logical comparison operators.

( X )

(4)

The result of (80 <= 60) conditional expression is False.

( )

(5)

The result of the conditional expression (12 Mod 6 = 2) is True.

( X )

(6)

The use of (Else) keyword is optional in (If) statement.

( )

(7)

The result of the function (IsNumeric) is always (True) or (False).

( )

(8)

The value of the expression (4 < > 4) is false.

( )

(9)

The value of the conditional expression could be "True" or "False" and that depends on the result of the conditional relation

( )

(10)

The result (90 <=30) conditional expression is False.

( )

(11)

The result of the conditional expression (12 Mod 3) = 30 is false.

( )

(12)

IsNumeric Function uses two parameters.

( )

(13)

In (If…Then…Else) statement, when the outcome of the condition is evaluated to be False then the statements following (Then) are executed.

( X )

(14)

If the variable A=20, variable B= 15 then the result of the condition A>=B is True.

( )

(15)

Use the (If.Then..ElseIf) statement when testing more than one conditional expression

( )

(16)

When using If – Then – Else statements after End if is executed when the condition is true.

( X )

(17)

There is more than one condition in (If … Then) Statement.

( )

(18)

Focus property is used for concentration or attention.

( )

(19)

IsNumeric function uses three factors.

( X )

(20)

In (If … Then … Else If) statement, when there is no True condition, the codes following Else will be executed as a default condition.

( )

(21)

IsNumeric function is used in converting the characters values into digits.

( )

(22)

The conditional statement (If) can be used set the order of the codes during the program runtime.

( )

(23)

The result of the following code is “False:

Dim S As Single = 21

MsgBox(IsNumeric(S))

( X )

(24)

(IsNumeric) statement has logical value (True / False).

( )

(25)

If conditional statement has one form only.

( X )

(26)

In (If … Then … Else If) statement the codes after True are executed while the other codes and conditions are ignored.

( )

(27)

The code < > is of the Comparison factors.

( )

(28)

When typing If conditional statement in one line, we will need to type End If.

( X )

(29)

The result of (50 <= 35) conditional expression is True.

( X )

(30)

In (If … Then ElseIf ) statement the conditions are selected from up to down.

( )

Q2:

The following code calculates the area of a circle of radius (R).Rewrite this code in left column so that; the message “ Not Allowed “will be displayed; when you enter a negative number in (TextBox1); whose value is assigned to variable (R).

Dim r, area As Single

Const pi As Single = 22 / 7

r = Me.TextBox1.Text

If r < 0 Then

MsgBox (“Not Allowed”)

Else

area = pi * r ^ 2

MsgBox (“area of circle= “ & area)

End If

Q3: The following code is written to solve the first degree equation (y = 3x + 2) and gives correct results when you enter numeric values in the (TextBox) ; but an error occurred while running (Runtime Error) when you entered string values in the (TextBox). Write the code after solving this problem using an additional (If) statement, that displays the message " You must enter a positive numerical values " in a (label ) control.

Dim x, y As Single

If IsNumeric (Me.TextBox1.Text) Then

x = Me.TextBox1.Text

y = 3 * x + 2

label1.Text = y

Else

Label1.Text = “You must enter numerical values”

End If

Q4: Choose the result of executing each of the following codes:

S

The code

The result

1

a. One

b. Two

c. three

2

a. True

b. False

c. 15

3

  1. Youssif

Ahmed

  1. Ahmed

Youssif

  1. Ahmed

4

a. AXB=63

b. 7X9=63

c. 7X9=A*B

Q5- Multiple choice Questions

  1. The If … Then … Else selection statements end with the keywords ……………..

    1. End If

    2. End Else

    3. EndIf

    4. EndElse

  2. The conditional expression (42 Mod 8) its result:

(2 – 5 – 5.5)

  1. We use the ……………. operators in typing the conditional expression in Visual Basic.

(Logical – Comparison – Null)

  1. The code …………… is used when there are two at alternatives (A) and (B).

(Boolean – If … Then – If … Then … Else)

  1. If the value of variable (X = 60) and value of variable (Y = 45), then the result of the conditional expression (X >= Y) is: ………….

(Null – False – True)

Q.6: Give the result of each of the following codes:

  1. MsgBox (IsNumeric (“Ahmed”)) (False)

  2. MsgBox (Isnumeric (30)) (True)

  3. Label1.Text = IsNumeric (“One”) (False)

  4. Dim H As Single = 5 // MsgBox (IsNumeric (H)) (True)

  5. TextBox1.Text = “7” MsgBox (IsNumeric (TextBox1.Text)) (False)

Q.7- If Variable A = 20 and variable B = 15;

Put () or (X) for the following statements

  1. Evaluation of condition A > B is True ( )

  2. Evaluation of condition A <= B is False ( )

  3. Evaluation of condition A >= B is False ( X )

  4. Evaluation of condition A < > B is False ( X )

  5. Evaluation of condition B < A – B is True ( X )

  6. Evaluation of condition B >= A – 5 is True ( )

Q8- Read the following code; after code execution, choose the correct answer:

Age = 25.5

Mark = 90

If Age < 26 Then

Age = 16

Mark = 100

End If

Total=Mark*2

  1. Value of variable Age = …(A. 25.5 - B. 90 - C. 16)

  2. Value of variable Mark = …(A. 90 - B. 100 - C. 25.5)

  3. Evaluation of the condition Age < 26 is … (A. True - B. False - C. 25.5)

  4. Value of variable Total is …. (A. 200 - B. 180 - C. 190)

Q.9: Rewrite the following sentences after correcting the underlined:

  1. Focus function is used to determine whether the value is digital or not.

IsNumeric ………………………………………………………………………..

  1. MessageBox (TextBox1.Text)

……MsgBox………………………………………………………………………..

  1. Dim N As Integer = “Egypt”.

…………String…………………………………………………………..

  1. To get an empty characters chain in (TxtFirst) tool, the code should be as the following:

TxtFirst.Text = “ “

………………… ” “ ………

Q10: Complete the following code by choosing the suitable between Brackets:

(End) – (Age > 16) – (Stop) – (MsgBox) – (Finish)

  1. 1)

  2. 2)

  3. 3)

Q11- Read the following code then put () or (X) for the following statements after code execution.

Arabic=30

English=20

If Arabic>25 Then

Total=Arabic +English

Avg=( Arabic +English )/2

Else

Arabic=25

English=22

Total=Arabic + English

Avg=( Arabic +English )/2

End If

  1. Value of variable Arabic = 30 ( ).

  2. Value of variable English = 22 ( X ).

  3. Condition Arabic > 25 will evaluate to True ( ).

  4. Value of variable total = 47 ( X ).

  5. Value of variable Avg = 23.5 ( X ).

Q.12: Complete the following sentences from between the bracets:

(Attention – Focus – True – Try/Catch – IsNumeric - > - False - < = - MsgBox)

  1. Try/Catch is a statement which is used to identify the errors which the user may do during the program runtime and it enables the programmer to identify the error to the user.

  2. IsNumeric is a function which is used to identify the digits values.

  3. TextBox1.Focus moves Attention to TextBox1.

  4. MsgBox IsNumeric (90) displays a message containing True

  5. Using ………>……… factor results in errors in the operation when the values of the left side is less than the right one.

  6. Focus method is used to move the concentration to TextBox.

  7. If (H is divisible by Y) the result of the condition (H mod Y < > 0) is False

  8. To view a MessageBox including the statement (Egypt is my great love), the code will be MsgBox (“Egypt is my great love”).

Q.13:

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]