2.2.1

Variable Declaration & Assignment

Test yourself on Variable Declaration & Assignment

Test your knowledge with free interactive questions on Seneca — used by over 10 million students.

Variable Declaration and Assignment

A variable must be declared before a value can be assigned.

Declaration

Declaration

  • Before variables can be used, they must be declared.
  • Declaring a variable means telling the computer:
    • What the identifier (name) should be.
    • What type of data will be stored.
Assignment

Assignment

  • Changing the value stored inside a variable is called assignment.
  • The value assigned to a variable must match the data type of the variable.
Language specifics

Language specifics

  • Some languages don’t need you to declare variables before you use them:
    • These languages automatically declare the variable before the first assignment.
Jump to other topics
1

Computer Systems

1.1

Systems Architecture

1.2

Memory & Storage

1.3

Computer Networks, Connections & Protocols

1.4

Network Security

1.5

Systems Software

1.6

Ethical, Legal, Cultural & Environmental Concern

2

Computational Thinking, Algorithms & Programming

2.1

Algorithms

2.2

Programming Fundamentals

2.3

Producing Robust Programs

2.4

Boolean Logic

2.5

Programming Languages & IDEs

Practice questions on Variable Declaration & Assignment

Can you answer these? Test yourself with free interactive practice on Seneca — used by over 10 million students.

  1. 1
  2. 2
  3. 3
Answer all questions on Variable Declaration & Assignment

Unlock your full potential with Seneca Premium

  • Unlimited access to 10,000+ open-ended exam questions

  • Mini-mock exams based on your study history

  • Unlock 800+ premium courses & e-books

Get started with Seneca Premium