• 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

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

    3 star(s)

    o Geon's and Gross 3D shapes; Geon's and Gross 3D shapes enable the consistency when images are being reproduced. Geon's are made up of a property that allows viewers to see the images from almost any angles. It has less complexity when in the stage of being designed.

  2. Peer reviewed

    Principles of Computer Networks

    3 star(s)

    Type 2 is a connection-oriented operational mode. It uses sequence numbering similar to the TCP/IP guarantee it guarantees that the order they are sent in is the order they receive it in and no frames are lost. Finally Type 3 is an acknowledged connectionless service which only supports communication to single destination or point-to-point communication.

  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. 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.

  2. 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

  1. Smart Card System

    5.6 Conclusion As a conclusion, Java has significant advantages, not only as a commercial language, but also as a teaching language. Java allows learning object-oriented programming without exposing them to the complexity of C++. It also provides the kind of rigorous compile-time error checking.

  2. Flexible Architectures in Communication Security Application

    important to accurately discern what part of the code is creating the bottleneck. We can best spend optimization resources by focusing on this part of the algorithm. Each of the ciphers is composed of three major components: setup, encryption kernel, and decryption kernel.

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