levo

Defining Data: Types, Variables and Classes

Primitive types and their storage

  • 3 things to know
  • AS Unit 1
Start revising · £5/month

Overview

The integer, floating point, character and boolean types, how many bits each occupies, the range each can hold, and what happens when a value exceeds it.

What you need to know

Answer each one before you reveal it.

Your recallNot started
Key term

What range of values can a signed 8-bit integer hold, and how does that range follow from the number of bits?

Key term

Why is a sum of money badly represented by a float or a double?

Key term

What is a primitive data type?

Questions from this subtopic

Each one with the model answer underneath.

  1. 1

    What is a primitive data type?

    Model answer

    A primitive data type is a type built into the language whose variable holds the value itself, rather than holding a reference to an object stored elsewhere.

  2. 2

    Which four integer primitive types does Java provide, and how wide is each?

    Model answer

    Java provides byte at 8 bits, short at 16 bits, int at 32 bits and long at 64 bits.

  3. 3

    What range of values can a signed 8-bit integer hold, and how does that range follow from the number of bits?

    Model answer

    Eight bits give 256 different patterns, and in a signed type half are used for negative values, so the range runs from −128 to 127.

  4. 4

    How many different values can be stored in 16 bits?

    Model answer

    Sixteen bits give 65 536 different values, because each extra bit doubles the number of patterns available.

  5. 5

    Which two primitive types hold real numbers in Java, and which of the two is the more precise?

    Model answer

    Java holds real numbers in float at 32 bits and double at 64 bits, and double is the more precise, keeping roughly fifteen significant figures against roughly seven.

  6. 6

    What values may a boolean variable hold, and how much information does a boolean actually carry?

    Model answer

    A boolean variable holds either true or false, so a boolean carries one bit of information even though a machine usually reserves a whole byte for it.

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.

Software and the Development Environment
Defining Data: Types, Variables and Classes
Program Control Structures
Objects, Classes and Data Structures

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 null is the of one.
absencepresencetype

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.

An error is the mistake a person made.
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 Defining Data: Types, Variables and Classes, 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.