levo

Programming Fundamentals

Data types and casting

  • 3 things to know
  • J277/02
Start revising · £5/month

Overview

Integer, real, Boolean, character and string, choosing the right type for phone numbers, prices and grades, and casting with worked results.

What you need to know

Answer each one before you reveal it.

Your recallNot started
Key term

Name five common data types used in programs.

Key term

What is the integer data type?

Key term

What is the real data type?

Questions from this subtopic

Each one with the model answer underneath.

  1. 1

    Name five common data types used in programs.

    Model answer

    Five common data types are integer, real, Boolean, character and string.

  2. 2

    What is the integer data type?

    Model answer

    An integer is a whole number with no fractional part. Values such as −12, 0 and 450 are integers.

  3. 3

    What is the real data type?

    Model answer

    A real is a number that can have a fractional part, such as 3.75. Many languages call the real type a float.

  4. 4

    What values can a Boolean hold?

    Model answer

    A Boolean holds only one of two values, True or False. Booleans suit yes-or-no facts such as whether a door is locked.

  5. 5

    What is the difference between a character and a string?

    Model answer

    A character is a single letter, digit or symbol, such as "G". A string is a sequence of characters, such as "Go home".

  6. 6

    Which data type should store a UK phone number such as 07700 900123, and why?

    Model answer

    A phone number should be stored as a string. An integer would lose the leading zero and the space, and no arithmetic is done on a phone number.

Other ways to work this

The same content, four other ways.

Everything in your subscription

Runs, plus a mode for every other kind of session.

1Flash
2Imposter
3Fade
4Brain dump

Learn every subtopic in runs of four questions

Facts flash and fade, a wrong word hides in some of them, and a brain dump decides which questions are locked in.

Systems Architecture
Memory and Storage
Computer Networks, Connections and Protocols
Network Security

Cram the night before, weakest topic first

A quick scan finds your weakest topics. Recall each fact you missed three times in a row.

A bit is the unit of data.
smallestlargestmain

Blank Blitz consolidates the facts

Rapid timed gap-fills on the terms and numbers you need to recall without thinking.

✓What it iscovered
~Why it happenspartly there
How long it lastsnot there yet

Explain It tests your understanding

Explain a concept in your own words and see which of its points you covered.

Integer means a whole number with no fractional part.
TrueFalse

Test It catches misconceptions

Spot the fault in a statement. The faults are the mistakes students make most often.

721941163128510

Brain Breaks between sessions

Short focus games to reset attention, so the next set lands better than the last.

Every question in Programming Fundamentals, on a schedule.

Learn it in runs of four questions, each ending on a brain dump against the clock. Every question you lock in comes back the next day, then at longer gaps, each time just before you would forget it.

Or £46 a year, about £3.83 a month. Cancel anytime.