Arrays: Storing and Manipulating Student Data, Schemes and Mind Maps of Economics

An overview of arrays, a fundamental data structure in computer science. It covers the basics of declaring and initializing arrays, as well as how to store and retrieve data within them. The document then presents a scenario where the user is tasked with storing the names and test scores of 30 students, calculating the total score and average for the class, and identifying the student with the highest score. The document walks through the pseudocode for this scenario, demonstrating how arrays can be used to efficiently manage and analyze large sets of data. This resource would be particularly useful for students studying data structures, algorithms, or introductory programming courses, as it provides a practical example of how arrays can be applied to real-world problems.

Typology: Schemes and Mind Maps

2021/2022

Uploaded on 03/03/2023

mohamed-rahil-mubarak
mohamed-rahil-mubarak 🇱🇰

5 documents

1 / 6

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Arrays
Ms.Sandamali Ekanayake[BSc.(Hons) In Computing and IS] Page 1
pf3
pf4
pf5

Partial preview of the text

Download Arrays: Storing and Manipulating Student Data and more Schemes and Mind Maps Economics in PDF only on Docsity!

Arrays

How to Store values into an Array

Q. Store 5 students Marks in an array.

For C  1 to 5

Input Mark

arrMark[C]  Mark

Next C

Q. Store 5 students Names in an array.

For C  1 to 5

Input Name

arrName[C]  Name

Next C

How to output values stored in an Array

Q. Output 5 students Marks in an array.

For C  1 to 5

Output arrMark[C]

Next C

Scenario Input and store the names and marks for 30 students who have sat three computer science tests. Test 1 is out of 20 marks, Test 2 is out of 25 marks, Test 3 is out of 35 marks. You must store the names in a one-dimensional array and the marks and total score for each student in one-dimensional arrays. All the marks must be validated on entry and any invalid marks rejected. You may assume that the students’ names are unique. Calculate and store the total score for each student and calculate the average score for the whole class. Output each student’s name followed by their total score, and then output the average score for the class.

  1. How to declare arrays for above scenario? StudentNames[ 1 : 30 ] StudentMarksTest1[1: 30 ] StudentMarksTest2[1: 30 ] StudentMarksTest3[1: 30 ] StudentTotalScore[1: 30 ]
  2. Write an algorithm using pseudo code for above scenario. No need to include any validation. Sum  0 FOR Count  1 TO 30 INPUT Name StudentName[Count] Name INPUT Mark 1 , Mark 2 , Mark StudentMarksTest1[Count]Mark StudentMarksTest2[Count] Mark StudentMarksTest3[Count]  Mark Total  Mark1 + Mark2 + Mark StudentTotalScore[Count]  Total Sum  Sum + Total Keep the index of the array. Store values to a slot in a array Output values stored in a array PRINT StudentName[Count], StudentTotalScore[Count] NEXT Count ClassAverage = Sum/ 30 PRINT ClassAverage