Kablow!

Variables, data types and operators

플레이하며 배우기

이 문제들을 풀어 에너지를 얻은 뒤 낚시하고 탐험하세요. 계정이 필요 없어요.

교육자를 위해: Variables, data types and operators(Computer Science, Programming)을(를) 위한 바로 쓸 수 있는 수업 슬라이드, 복습 노트 — 수업에 사용하거나, 학습자들이 실시간 게임으로 즐기는 인터랙티브 클래스 활동으로 진행하세요.

수업 노트

Variables and constants

  • A variable is a named memory location whose value can change. A constant has a value that does not change while the program runs (e.g. VAT rate).
  • Assignment stores a value: score = 10. Use meaningful names (e.g. totalCost) and consistent style.

Variables and constants

Variables and constants

Data types

  • Integer (whole numbers), real (numeric values that can include a fractional part; an integer-valued number can also be stored using a real type). Floating-point is a finite representation and may involve rounding, Boolean (True/False), character (a single symbol), string (text).
  • Casting converts between types: converting the string "12" to integer 12, or 7 to the string "7".

Choosing a data type

Choosing a data typeTypeExample valueUseInteger42Whole-number countReal3.5; also 3.0Numeric fractional valuesBooleanTrue / FalseCondition resultCharacter'A'One characterString"A12"Character sequence

Operators

  • Arithmetic: + - * / MOD (remainder) DIV (integer division) ^ (exponent). Example: 17 MOD 5 = 2; 17 DIV 5 = 3.
  • Comparison: = (or ==), ≠, <, >, ≤, ≥.
  • Boolean: AND, OR, NOT.

Operators

Operators

Input and output

  • INPUT reads data (usually a string, then cast); OUTPUT or print displays data.

Order of operations

  • Brackets first, then exponents, multiplication and division, then addition and subtraction.

Good practice

  • Declare variables, choose appropriate types, and comment code.

슬라이드

Sign up free to view the lesson slides

Step through every slide for this topic — plus flashcards and revision notes — with a free account.

연습 문제

무료 미리 보기 — 34개 중 8개 문제. 가입하면 전부 볼 수 있어요.
  1. 1.What is a variable?

    Easy
    • Aa named stored value that can be updated
    • Ba value that is always fixed
    • Ca repetition instruction
    • Da syntax error
  2. 2.What is a constant?

    Easy
    • Aa value that does not change
    • Ba value that changes
    • Ca loop
    • Da function
  3. 3.Which data type is intended specifically for whole-number values?

    Easy
    • Ainteger
    • Bstring
    • CBoolean
    • Dreal
  4. 4.Which data type stores text?

    Easy
    • Astring
    • Binteger
    • CBoolean
    • Dreal
  5. 5.Which data type stores True or False?

    Easy
    • ABoolean
    • Binteger
    • Cstring
    • Dreal
  6. 6.What is 17 DIV 5?

    Easy
    • A3
    • B2
    • C3.4
    • D12
  7. 7.What is 20 MOD 6?

    Easy
    • A2
    • B3
    • C14
    • D6
  8. 8.What is the value of 2 + 3×4?

    Easy
    • A14
    • B20
    • C24
    • D10

Unlock all 34 questions & more

무료 계정을 만들어 이 주제의 모든 문제, 슬라이드, 플래시카드, 복습 노트를 확인하세요.

기출 문제

이 주제의 기출 문제 연습이 곧 나와요.
곧 출시