Declaration a Declaration is an act of defining a variables b A declaration

Declaration a declaration is an act of defining a

This preview shows page 3 - 5 out of 6 pages.

Declaration: a) Declaration is an act of defining a variable(s) b) A declaration states the type of a variable, along with its name. c) A variable can be declared only once. d) It is used by the compiler to help programmers avoid mistakes such as assigning string values (i.e. name, address, etc.) to integer variables (i.e. age, number of children, etc.). e) Before reading or assigning a variable, that variable must have been declared. Initialization: f) It's a special kind of assignment: the first. g) Before initialization objects have null value and primitive types have default values such as 0 or false. h) Can be done in conjunction with declaration. Assignment: i) Throwing away the old value of a variable and replacing it with a new one. 6- Explain the ways of assigning values to variables in - Getting your data into a variable - Using the equals sign (=) - Make sure all variables are first declared before assignment 7- State THREE (3) of the naming rules in a) must start with a letter or underscore b) cannot have spaces c) cannot use special characters 8- Define the following: - (i) Scope of Variables Scope refers to the part of the program where a variable is visible and may be accessed by program code. (ii) Lifetime of Variables Lifetime of a variable is the period of time the variable exists. When a procedure terminates, all local variables will come to the end of its lifetime. The values of its local variables are not preserved and VB reclaims their memory. Next time the procedure is called, its local variables will be created afresh and reinitialized.
Image of page 3
CD206 BUSINESS PROGRAMMING (Tutorial 3) (L3B-4) 9-
Image of page 4
Image of page 5

You've reached the end of your free preview.

Want to read all 6 pages?

  • Fall '19
  • Type theory

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes