Computer Science - 0478 CIE

Arrays

Overview

Imagine storing the marks of 100 students in 100 separate variables, then trying to add them up. It would be unbearable. An array solves this by holding many values of the same type under a single name, each reachable by a number called its index, so a short loop can sweep through them all.

In this lesson you will learn to declare and use one-dimensional and two-dimensional arrays in the Cambridge pseudocode style, understand why arrays are so useful, and write values into and read values from an array using iteration, with full worked routines you can adapt in the exam.

Objectives

  1. 1 Declare and use one-dimensional (1D) and two-dimensional (2D) arrays
  2. 2 Understand the use of arrays
  3. 3 Write values into, and read values from, an array using iteration

Lesson Note

Almost every real program handles lists of data: scores, names, prices, pixels. Arrays are the basic structure for storing such lists, and the programming paper expects you to declare them, put data in, take data out, and process them with loops. Master the array-and-loop pattern and a whole class of problems becomes routine.

Available on the Green Bridge App

Download the Green Bridge CBT app on your phone or computer to access full lesson notes, practice questions, and more.

Full lesson notes with diagrams
AI-powered learning assistant
Study offline, anytime, anywhere
Available on Android, Windows, macOS, and Linux

Lesson Evaluation

Congratulations on completing the lesson on Arrays. Now that youve explored the key concepts and ideas, its time to put your knowledge to the test. This section offers a variety of practice questions designed to reinforce your understanding and help you gauge your grasp of the material.

You will encounter a mix of question types, including multiple-choice questions, short answer questions, and essay questions. Each question is thoughtfully crafted to assess different aspects of your knowledge and critical thinking skills.

Use this evaluation section as an opportunity to reinforce your understanding of the topic and to identify any areas where you may need additional study. Don't be discouraged by any challenges you encounter; instead, view them as opportunities for growth and improvement.

  1. What must be true of all the items stored in one array? A. they must be integers B. they must be the same data type C. they must be strings D. they must be unique Answer: B
  2. What is used to identify the position of an element in an array? A. its value B. its data type C. its index D. its identifier Answer: C
  3. Which declaration creates a 1D array of 8 integers indexed 1 to 8? A. DECLARE A : INTEGER B. DECLARE A : ARRAY[1:8] OF INTEGER C. DECLARE A : ARRAY OF 8 D. DECLARE A[8] Answer: B
  4. Which loop structure is normally used to process every element of a 2D array? A. a single WHILE loop B. a REPEAT loop C. a nested (loop inside a loop) D. no loop is needed Answer: C
  5. Before adding all elements of an array into a variable Total, Total should first be: A. set to the first element B. set to 0 C. left undeclared D. set to the array length Answer: B

Available on the Green Bridge App

Download the Green Bridge CBT app on your phone or computer to access full lesson notes, practice questions, and more.

Full lesson notes with diagrams
AI-powered learning assistant
Study offline, anytime, anywhere
Available on Android, Windows, macOS, and Linux

Available on the Green Bridge App

Download the Green Bridge CBT app on your phone or computer to access full lesson notes, practice questions, and more.

Full lesson notes with diagrams
AI-powered learning assistant
Study offline, anytime, anywhere
Available on Android, Windows, macOS, and Linux

Practice Mock Questions

Want to practice mock questions on Arrays? Download the Green Bridge CBT app to access mock questions and full practice assessments for this topic.

Download The App On Google Playstore

Everything you need to excel in JAMB, WAEC & NECO

Green Bridge CBT Mobile App
Personalized AI Learning Chat Assistant
Thousands of JAMB, WAEC & NECO Past Questions
Over 1200 Lesson Notes
Offline Support - Learn Anytime, Anywhere
Green Bridge Timetable
Literature Summaries & Potential Questions
Track Your Performance & Progress
In-depth Explanations for Comprehensive Learning