اردو

Home / Practice / Programming and arrays / Worksheet

Practise online

Programming and arrays

Class 12 · Computer Science · 5 questions

Name: ____________________   Date: ____________

  1. An array stores:

    • A Multiple values of the same type
    • B Only one value
    • C Only text
    • D Only images
  2. The first index of an array in C is:

    • A Depends on the size
    • B -1
    • C 1
    • D 0
  3. A function is used to:

    • A Compile only
    • B Group code that can be reused
    • C Print only
    • D Delete code
  4. Which of these is a relational operator?

    • A +
    • B >
    • C &
    • D =
  5. The number of times `for (i = 0; i < 5; i++)` runs its body is:

    • A 6
    • B 0
    • C 5
    • D 4

Answer key

1. A, 2. D, 3. B, 4. B, 5. C

  1. An array holds a list of items.

  2. Arrays are indexed from 0.

  3. Functions make code reusable.

  4. The greater than sign compares values.

  5. i takes values 0 to 4, so five times.