0% found this document useful (0 votes)
4 views16 pages

Algorithms

The document outlines a series of algorithms for various tasks, including monitoring electricity usage, analyzing weather data, recording student assessments, processing retail transactions, and more. Each algorithm specifies input requirements, calculations to be performed, and the expected output. The tasks involve counting, summing, and determining averages or conditions based on user inputs.

Uploaded by

aryruparelia
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views16 pages

Algorithms

The document outlines a series of algorithms for various tasks, including monitoring electricity usage, analyzing weather data, recording student assessments, processing retail transactions, and more. Each algorithm specifies input requirements, calculations to be performed, and the expected output. The tasks involve counting, summing, and determining averages or conditions based on user inputs.

Uploaded by

aryruparelia
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Electricity Usage Monitoring

A smart meter records daily electricity usage in a household.

Write an algorithm to:


• prompt the user to enter electricity usage in kWh, or -1 to stop entering data
• continuously accept inputs until -1 is entered
• calculate the total electricity usage recorded
• output the total usage in a suitable message

[6]
Weekly Weather Analysis
A weather station collects temperature readings over a 7-day period.

Write an algorithm to:


• input 7 temperature values
• determine whether each temperature is above 25°C
• count how many temperatures exceed this threshold
• calculate the average temperature
• output both the count and the average

[6]
Student Assessment Results
A teacher records marks for a class of 10 students.

Write an algorithm to:


• input 10 student marks
• determine whether each mark is 50 or above
• count how many students achieve a pass mark
• output the total number of students who passed

[6]
Retail Transaction Processing
A shop records the prices of items purchased by a customer.

Write an algorithm to:


• input the prices of 3 items
• calculate the total cost of the items
• if the total exceeds 50, apply a 10% discount
• output the final amount payable

[6]
Tra ic Speed Enforcement System
A road monitoring system records the speed of passing vehicles.

Write an algorithm to:


• input the speeds of 8 vehicles
• determine whether each speed is above 70 mph
• count how many vehicles are speeding
• calculate a fine of £100 for each speeding vehicle
• output the number of speeding vehicles and total fine amount

[6]
Divisibility Analysis
A program processes a set of numbers entered by a user.

Write an algorithm to:


• input 6 numbers
• determine whether each number is divisible by 5
• count how many satisfy this condition
• output the final count

[6]
Rainfall Data Collection
A weather system records rainfall over a number of days.

Write an algorithm to:


• input rainfall values for 10 days
• determine whether each value is greater than 0
• count how many days had rainfall recorded
• output the total number of rainy days

[6]
Positive Value Summation
A program processes a list of numerical values.

Write an algorithm to:


• input 8 numbers
• add together only values greater than 0
• output the final sum

[6]
Character Classification
A program records a sequence of characters.

Write an algorithm to:


• input 6 characters
• determine whether each character is uppercase
• count how many uppercase characters are entered
• output the total count

[6]
Test Score Storage and Analysis
A class of 10 students completes an assessment.

Write an algorithm to:


• store 10 test scores in an array
• calculate the total and average score
• output the average score

[6]
Keyword Detection in Text
A program processes a set of sentences.

Write an algorithm to:


• input 5 sentences
• check whether each sentence contains the word "science"
• count how many sentences include this keyword
• output the final count

[6]
Random Number Simulation
A program simulates rolling a dice.

Write an algorithm to:


• generate 10 random numbers between 1 and 6
• count how many times the value 6 appears
• output the final count

[6]
File Data Processing
A file contains 20 integer values representing sensor readings.

Write an algorithm to:


• open the file
• read each value using a loop
• calculate the total of all values
• close the file
• output the total

[6]
Even Number Function Analysis

Write an algorithm to:


• define a function that returns TRUE if a number is even
• input 10 numbers
• use the function to determine how many numbers are even
• output the total count

[6]
Two-Dimensional Array Data Analysis
A school records exam results for 3 subjects across 5 students.

Write an algorithm to:


• store all results in a 2D array
• calculate the total score for each student
• identify the student with the highest total score
• output the student and their score

[6]

You might also like