Kablow!

Arrays, lists and records

விளையாடிக் கற்றுக்கொள்ளுங்கள்

ஆற்றல் சம்பாதிக்க இந்த கேள்விகளுக்குப் பதிலளியுங்கள், பின்னர் மீன் பிடித்து ஆராயுங்கள். கணக்கு தேவையில்லை.

கல்வியாளர்களுக்கு: Arrays, lists and records (Computer Science, Programming)-க்கான தயாரான பாட ஸ்லைடுகள், திருப்புதல் குறிப்புகள் — உங்கள் பாடத்தில் அவற்றைப் பயன்படுத்தவும், அல்லது கற்பவர்கள் நேரலை விளையாட்டாக விளையாடும் ஊடாடும் வகுப்பு செயல்பாடாக தலைப்பை இயக்கவும்.

பாட குறிப்புகள்

Arrays and lists

  • An array stores multiple values of the same data type under one name. Each item has an index (usually starting at 0). Example: scores = [12, 8, 15]; scores[0] is 12.
  • One-dimensional (1D) arrays are lists; two-dimensional (2D) arrays are tables with rows and columns: grid[row][column].
  • Arrays have a fixed size in many languages; lists may grow.

Indexed array

Indexed array

Using arrays

  • Traversal visits elements using their valid indices. For total = 0 and scores = [12, 8, 15], an inclusive FOR loop from 0 to 2 adds all three elements to give 35.
  • Initialise an accumulator before adding values. For a maximum search, initialise from the first element of a non-empty array rather than assuming zero is a valid starting maximum.

Array traversal

Array traversal

Records

  • A record groups named fields about one entity, such as a student’s name, age and grade. Fields may have different types.
  • Collections of records may be held in files or database tables; not every record file by itself is a database system.

When to use

  • Use arrays for lists of the same type; records for related fields of different types.

Advantages

  • Arrays avoid many separate variables, make code shorter and loops possible.

Two-dimensional arrays

  • grid[row][column]
  • Rows and columns
  • Nested loops

Accessing a two-dimensional array

Accessing a two-dimensional array

ஸ்லைடுகள்

Sign up free to view the lesson slides

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

பயிற்சி கேள்விகள்

இலவச முன்னோட்டம் — 33-இல் 8 கேள்விகள். அனைத்தையும் பார்க்க பதிவு செய்யவும்.
  1. 1.What is an array?

    Easy
    • Aa data structure storing multiple values under one name
    • Ba variable only
    • Ca loop
    • Da function
  2. 2.What is an index?

    Easy
    • Athe position of an item in an array
    • Bthe value
    • Cthe size
    • Dan error
  3. 3.With zero-based indexing, which index selects the first item?

    Easy
    • A0
    • B1
    • C-1
    • D2
  4. 4.What is a record?

    Easy
    • Aa collection of fields about one thing
    • Ba list of numbers
    • Ca loop
    • Da file name
  5. 5.What is a field?

    Easy
    • Aone item of data in a record
    • Ba loop
    • Ca function
    • Dan array
  6. 6.If names = ["Ali","Bo","Cy"], what is names[2]?

    Easy
    • A"Cy"
    • B"Bo"
    • C"Ali"
    • Derror
  7. 7.What is the length of [4, 7, 9, 2]?

    Easy
    • A4
    • B3
    • C5
    • D2
  8. 8.a is a zero-based array of three numbers. What does this inclusive loop do? total = 0; FOR i = 0 TO 2; total = total + a[i]; NEXT i

    Easy
    • Aadds all three elements
    • Bdeletes elements
    • Csorts them
    • Dfinds the largest

Unlock all 33 questions & more

இந்த தலைப்பிற்கான ஒவ்வொரு கேள்வியையும், ஸ்லைடுகளையும், ஃப்ளாஷ் கார்டுகளையும் மற்றும் திருப்புதல் குறிப்புகளையும் பார்க்க இலவச கணக்கை உருவாக்கவும்.

முந்தைய தேர்வுகள்

இந்த தலைப்பிற்கான முந்தைய தேர்வு பயிற்சி விரைவில் வருகிறது.
விரைவில் வருகிறது