levo

Defining Data: Types, Variables and Classes

Primitive types and their storage

  • 3 things to know
  • AS Unit 1

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.

What is inside Levo

Six ways to work the same material.

1Closed book
2Open book
3Closed book

The 3-step method, run for you

Answer cold, learn it, then prove it stuck. Levo tracks the jump between your first attempt and your last.

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

Cram a whole paper in one sitting

Sort every topic into what you know and what you do not, then drill only the weak ones.

A null is the of one.
absencepresencetype

Blank Blitz makes facts automatic

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

AA null means no value has been recorded.
BZero and an empty string are values.
CA null is the absence of a value.

Build It gets the exam shape right

Assemble a full-mark answer from its marking points, in the order an examiner wants them.

An error is the mistake a person made.
TrueFalse

Test It catches misconceptions

Spot the fault in a statement. The traps are the mistakes students actually make.

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.

Attempt a question from memory, write the correct version, then attempt it again. Levo records the jump between your first attempt and your last, and brings each question back on the day you are due to forget it.

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