The Egyptian Language School_ (Computer Department) Final Revision sheets

Chapter1

Range Of values / Storage Space
In RAM / Description / Data Type / Group
0 - 255 / 1 Byte / Used to store Whole Numbers only
(used in arithmetic operations)
Ex.( No of books
Population no.
No. of family members) / Byte / Integer Numeric Types / Numeric Data Types
Short
4 Bytes / Integer
Long
Used to store Whole Numbers and fractions
(used in arithmetic operations)
Ex.( grades – price ….) / Single / Non Integer Numeric Types
(Fraction no.)
Double
Decimal
One letter , number , symbol or one space / Char / Character Data Types
Any number of letters , numbers , symbols or spaces / String
Special format to store date and Time
Ex( birth date )
(DD/MM/YYYY) / Date / Miscellaneous Data Types
Takes True or False only
Ex(Gender –Marital status ) / Boolean
Picture, sound file , color, ……. / Object

Q1.What are the data types provided by VB.Net?

Q2) Compare between:

1-The (BYTE) Data type and (Integer) Data type.

Byte / Integer
Used to store integral values between 0 and 255 and reserves 1 byte in the computer memory / Used to store integral values between and reserves4 byte in the computer memory

2-Constants and Variables

Variables / Constants
They are reserved places in computer memory(RAM) declared and determined by their names and data types. / They are reserved places in computer memory(RAM) declared and determined by their names and data types.
Their values can be changed during the running of the program . / They take fixed value and can`t change during the progress of the program .
Declaration in VB.Net is done by the key word or the command ( DIM )
And the declaration statement is:
DIM Variable as Data = [initial value]
Name Type / Declaration in VB.Net is done by the key word or the command ( Const )
And the declaration statement is:
Const Constant as Data = Value
Name Type
Assigning initial value to variables during declaration is optional. / Assigning value to constants during declaration is a must.
Such as : price of product - value of the tax – address – Birthrate of student - Gender – no. of books in the library. etc…. / Such as : mathematical constants like (Ԓ) – Some physics constants like gravity acceleration , the speed of light and speed of sound.etc….

Q3) What are the Naming Rules in Declaring Variables or Constatns :

  • must begin with a letter or underscore
  • Should not contain symbols or special characters
  • Do not use reserved words( Dim , single , name, ……)
  • Consists of letters, numbers & Underscores(_)

Q4) Give Reason :

  1. The suitable data type to store the student Gender is Boolean .

Because Boolean data type is used to store logical values that takes true/ false

  1. 55City is invalid variable name.

Because it starts with number and this is not allowed in variable names

  1. " Name " and "Date"areConsidered a wrong variable name..

Because they are reserved words and this is not allowed in variable names

Q5) Declare the following :

  1. Constant birth date which value is 22/11/1972

Const Birthdate As Date = # 22/11/1972 #

  1. Declare a variable for storing schoolnames with initial value (ELS)

Dim School_Name As String = " ELS"

  1. ConstantGravity which value is 9.8

Const gravity As Single = 9.8

Note : Declaration could be on Class Level Or on Event Procedure Level and that`s called the Scope Of Declaration.

Q6) State the Function of the following :

Keyword / function
Me / Express the current form window (the control is on the same form where we write the codes)
Concatenation operator ( to append or join text of the codes together)
vbCrLf / Values of Variables are separated from each other by new line.
(_) or underscore / Enables writing lines of code in more than one line (to organize and simplify the process of reading codes)
Rem or
Appostrophe( ‘ ) / To indicates the line of code as comment (what`s written after is neglected and isn`t considered by the compiler while program execution )

Q7:Rearrang the priority of the arithmetic operators:

( 4 )Addition (+) and subtraction (-) from left to right.

( 2 ) exponent (raise to power ) ^ .

( 1 ) Parentheses (brackets from inside to outside) .

( 3 ) Multiplication ( * ) and Division ( / ) from left to right .

Q8: What are the Types of Errors in VB.net?(Compare?)

Runtime Error / Logical Error / Syntax Error
occursduring the program execution Due to assigning value lesser or greater than the range of the data type declared or not matching with the data type of the variable. / Due to the wrong formulating in arithmetic or logic expressions, So we get incorrect results after executing the program / Refers to the spelling mistakes in writing the reserved words or error in the common syntax commands of the language. / Define
Use Try --- Catch Structure / review the written code, and test the program with data already validated to check . / the IDE helps and displays the syntax of any command as we type it / How To Handle
Dim Age As Byte
Age = 500 or Age = - 10
Age =“ five” / Area = Pi + Radius ^ 2 / Din X As Byte
Const PI As Single / Ex.

Q9-Define :

  • the Assignment Statement

It`s the statement that has two sides separated by the assignment operator .it takes the value from the right side and store it in the variable or constant or property on the left side.

  • Mod

Arithmetic operator used to calculate the reminder of division number ex. 9 mod 2 = 1 18 mod 3 = 0

Chapter2

Q1: Compare between If … Then and Select… case statements:

IF … Then … Else / Select … Case
Used to express branching programmatically when you test one conditional expression / Used to express branching programmatically when you testmore than conditional expression on the same variable
Display only one or 2 possible branching if using else. / Can display more than 2 possible branching
if the conditional expression is (True) it executes the statements that follow (Then) or if conditional expression is (false) it executes the statements that follow (else) / depends only on the value of one variable and there are many conditions, which reduces the code and makes it easier and clearer.
IF Conditional Expression Then
Code1
Else
Code2
End IF
Note: The keyword (else) is optional
You can write if statement in one line without End If / Select Case Variable
Case value1
Code1
Case value2
Code2
..
..
Case Else
Code n
End Select
Dim x As Integer
x = Me.textbox1.text
If x = 0 Then
label1.text = " Equal Zero"
End If
If x > 0 Then
Label1.Text = "Greater than Zero"
End If
If x < 0 Then
Label1.Text = "Less than Zero"
End If / Dim x As Integer
x = Me.textbox1.text
Select Case x
Case 0
label1.text = " Equal Zero"
Case is > 0
Label1.Text = "Greater than Zero"
Case is < 0
Label1.Text = "Less than Zero"
End Select

Chapter3

Q1: Compare between For … Next and Do .. While statements:

For … Next / Do … While
It is one of the limited loop statements used when we want to repeat a code for specific number of time . It needs numeric variable (integer or decimal) to work as a counter with start value , end value and add or increment value / The statement 'Do while ... loop' is used to repeat a specific code for a several times of an unknown end, but based on a specific condition, so they are useful if you do not know the number of iterations emphatically.
The repetitive code will be implemented (executed) as long as the counter variable is less than or equal the end value .The loop stops when the value of the counter exceeds the last value. / The repetitive code will be implemented (executed) as long as the conditional expression is true. If the condition is not met for any reason, we get out of the iterative loop, and implement the code after the Loop if it exists.
General syntax for this statement
For Variable = Start To End Step Add Value
Repetitive Code
Next [Variable] / General syntax for this statement
Do While Conditional Expression
RepetitiveCode
Loop

Q2- Define ?

1- TheProcedures : A set of commands and instructions under a name, can be recalled by that name, so as to implement them. Theprocedures declaration is done only once and then, you recall the procedures many times from anywhere in your program

2- Parameters: Special variables that were declared inside the procedure code to pass values (arguments) from outside the procedure while calling. In the procedure declaration, we can use more than one Parameter .

Q3: Compare between For … Next and Do .. While statements:

Sub Procedure / Function Procedure
create a (Sub) if we have a set of commands that are frequently used in more than one place in the class / A set of commands under a particular name that should express its task.
does not return a value / returns a value
is never used in the assignment statement / is used on right side of the assignment statement and does not have any value

Chapter4

Q3: Define :

1- Cyber bullying:- Is a deliberate aggressive behavior from one person to another through electronic modes of communication

2- Forms of cyber bullying :- Harassment – annoyance - embarrassment - intimidation - threat –Blackmailing

3- Electronic media :- Email - Forums - Instant Message - Face book – Blogger

4. Anonymity: It is the use of pseudonyms (aliases) to hide e-aggressor's identity for impunity.

5. Harassment: It is aggressive messages directed against one or more persons.

6. Cyber stalking: It is a form of electronic harassment where the aggressor frequently traces and chases a particular person in all electronic media.

7. Flaming: It is a publication of hostile and vulgar words against one or more through a media and electronic communication.

8. Outing: It is a dissemination of information about a specific person or more abusively.

9. Exclusion: It is to ignore one or more persons through the electronic media.

10. Cyber threats: It is an email or e-message carrying a threat and intimidation to one or more persons.

1