• Join over 1.2 million students every month
  • Accelerate your learning by 29%
  • Unlimited access from just £6.99 per month

Explain sequence, selection and iteration as used in computer programming; outline the benefits of having a variety of data types available to the programmer.

Extracts from this document...

Introduction

Data Types Task Brief * As Gary is fascinated about computer software, he would also like you (a) to explain sequence, selection and iteration as used in computer programming; (b) outline the benefits of having a variety of data types available to the programmer. Contents Task Brief 1 Introduction 1 Number Types 1 Character Types 2 Logical Type 3 Benefits of Different Data Types 3 Accurate Data 4 Efficient Memory Usage 4 Data Validation 4 Summery 5 Bibliography 5 Introduction This report will seek to address what data types are available to use in creating programming variables and on what basis they are used. I will also seek to address the advantages of selectively using different data types, and why different data types exist. This report will discuss seven data types I consider to be the most important for the creation of a memory-efficient program, and these fall under three categories: * Number types * Character types * Logical type Number Types These variable types form the very foundation of a programming language. With these, we can calculate values and actually compute data. Depending on the types of number data being used, there are two kinds of number types we can use: whole / integer number and floating point / decimal number. ...read more.

Middle

in computer memory. Because of this, alphabetic character types are handled differently compared to number types. The contents of strings cannot be manipulated in the same way that number types can, including numbers. The following table demonstrates an example of how this works. While the calculation is carried out in the number type, the two character strings with alphanumeric digits in them are simply shoved together: Result of "40 + 8" Using Number Type Result of "40 + 8" Using Character Type 48 408 When we are using strings, we also need to be aware of how many characters we may require to be in our variable. A normal fixed string variable can hold 65,400 units, while a variable string can hold up to about 2,000,000,000 units. This flexibility comes at the cost of 10 additional bytes being reserved. Below is a table of these two character types with their ranges and size in bytes: Character Types Data Type Storage Size Range / Value String (fixed) Length of string 1 to approximately 65,400 String (variable) 10 bytes + string length 0 to approximately 2 billion Logical Type Otherwise known as a Boolean, this is a special type of variable which can store only one value - True or false. ...read more.

Conclusion

One way of preventing this from happening and increasing stability is to set the default type of all new variables as one that is flexible, all encompassing, and will prevent accidental crashes like these from happening. In Visual Basic, this is achieved by setting the default data type of new variables as string. The below table demonstrates this: Dim Statement Resulting Data Type Dim myNumber String Dim myNumber As Int Integer The programmer is of course free to change the data type as they wish, but with prudence, a variable is only set as a number or logic type only when the contents have been validated. (Mark Fishpool, 2011) Summery In this report, we had a look at what data types are available and on what basis they are used. We learned about the varying storage sizes available for different kinds of numerical data and the resulting change in byte storage size. We also had a look at the advantages of selectively using different data types, and why different data types exist. We saw that using data types correctly made sure that the integrity of numerical data is preserved, that choosing memory-efficient data types is prudent, and that maintaining a data type consistency for new variables increases the stability of the program. ...read more.

The above preview is unformatted text

This student written piece of work is one of many that can be found in our AS and A Level Computer Science section.

Found what you're looking for?

  • Start learning 29% faster today
  • 150,000+ documents available
  • Just £6.99 a month

Not the one? Search for your essay title...
  • Join over 1.2 million students every month
  • Accelerate your learning by 29%
  • Unlimited access from just £6.99 per month

See related essaysSee related essays

Related AS and A Level Computer Science essays

  1. Peer reviewed

    Principles of Computer Networks

    3 star(s)

    The ring goes around and station wanting to transmit data will take control of it and send it to the destination and when the transmission is completed than the token ring is destroyed and new one is created. IEEE 802.11 Set of standards which put into operation WLAN communication in the 2.4, 3.6 and 5 GHz spectrum band.

  2. Peer reviewed

    HCI shortened for Human Computer Interaction is the study of the human and computer ...

    3 star(s)

    The Kinect allows people to do all sorts of things. It brings family together to play and enjoy each other's company. It allows friends to meet up online and play with each others. It can be used educationally for children also.

  1. Visual basic

    * Visual Basic provides six types of Repetition Structures: o While o Do While o Do Until o Do Loop/While o Do Loop/Until o For/Next } Used to repeat a specified number of times. Used to repeat "while" a condition holds or until a condition changes Advantages of Structured Programming

  2. Explain sequence, selection and iteration as used in computer programming; outline the benefits of ...

    and Num(2) are created (step 1). * The program asks and then prompts the user to enter a number (steps 2 to 4). * It then asks and then prompts the user to enter a second number (steps 5 to 6).

  1. Explain the component parts of a computer system - Include both hardware, software and ...

    A file server network is made up of PC's as well as a server computer. The server is usually responsible for the applications, and information storage whereas the PC's carry out most of the processing. In a client/server network the computers use the application software from the server computer but

  2. Influential Factors in Choosing a Programming Language

    Suitability Building a program in a language unsuitable for its intended task will cause big problems down the line, which is why understanding the application's technical requirements is important. The first thing to consider when making a program is what the intended platform will be.

  1. Free essay

    What is Visual Programming

    VB.Net just displays the name. Definitions of unfamiliar terms Java * JSpinner - Allows the user to increase the value of a number * JSlider - Allows the user to change the value of the slider * JPasswordBar - Allows the user to enter a password * JTree - Allows

  2. Smart Card System

    The meanings of the fields are defined by a proceeding #Fields directive. If a field is omitted for a particular entry a single dash "-" is substituted. Directives record information about the logging process itself. For example: "Fields: [<specifier>...]" - Specifies the fields recorded in the log.

  • Over 160,000 pieces
    of student written work
  • Annotated by
    experienced teachers
  • Ideas and feedback to
    improve your own work