Programming Fundamentals Worksheet: Algorithms and Pseudocode - Prof. Akerman, Exercises of Computer Science

This worksheet provides a practical introduction to programming fundamentals, focusing on algorithm design and pseudocode. It includes tasks such as explaining how a total monthly charge is calculated based on given conditions, completing a table to identify variables, constants, data types, and typical values, and writing pseudocode for an algorithm that formats a user's name. The worksheet also covers basic programming concepts like input, output, and calculations, making it a valuable resource for students learning the basics of programming. It is designed to enhance understanding of fundamental programming concepts and problem-solving skills. The exercises are structured to build a solid foundation in programming logic and algorithm development, essential for further studies in computer science.

Typology: Exercises

2024/2025

Uploaded on 06/27/2025

bananana-apple
bananana-apple 🇬🇧

4

(1)

25 documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Worksheet 1 Programming fundamentals
Unit 7 Programming
Name:...................................................................................................... Class: ......................
Task 1
The flowchart depicts an algorithm for computing the monthly bill for calls on a
mobile phone.
1
totalCharge = totalCharge
+ extraCharge
extraMinutes =
minutesUsed - 600
OUTPUT
totalCharge
No
Yes
minutesUsed >
600?
INPUT
minutesUsed
End
Start
extraCharge =
extraMinutes *
perMinuteRate
totalCharge =
monthlyTariff
monthlyTariff = 23.00
pf3
pf4
pf5

Partial preview of the text

Download Programming Fundamentals Worksheet: Algorithms and Pseudocode - Prof. Akerman and more Exercises Computer Science in PDF only on Docsity!

Unit 7 Programming

Name: ...................................................................................................... Class: ......................

Task 1

The flowchart depicts an algorithm for computing the monthly bill for calls on a mobile phone. totalCharge = totalCharge

  • extraCharge extraMinutes = minutesUsed - 600 OUTPUT totalCharge No Yes minutesUsed > 600? INPUT minutesUsed End Start extraCharge = extraMinutes * perMinuteRate totalCharge = monthlyTariff monthlyTariff = 23.

Unit 7 Programming

(a) Explain how the total monthly charge is calculated. (b) Complete the table below to:  State whether the identifier is a variable or constant  State the data type that would be required  Give a typical value for each identifier Identifier Variable or constant? Data type? Typical value? monthlyTariff totalCharge minutesUsed extraMinutes perMinuteRate extraCharge (c) Assume the basic monthly tariff is £23.00 per month, and that extra minutes are charged at 2p per minute. A customer makes calls totalling 700 minutes on their phone. What is their total change that month?

Unit 7 Programming

Task 3

  1. Write pseudocode for an algorithm which allows the user to enter their first name and surname. The algorithm will then output their name in the format “initial surname”. e.g. Input 1: “Jim”, Input 2: “Daley”, Output: “J Daley” The algorithm will also need to have the initial and first letter of the surname as capital letters. All other letters of the surname will need to be lowercase. e.g. Input 1: “george”, Input 2: “garlAnd”, Output: “G Garland” Assume the string in indexed from 0, so the first character in the string will be referred to as stringName[0]. Make use of concatenation and the following functions: s.length finds the length of s s.upper gives the uppercase of s s.lower gives the lowercase of s s.right(n) gives the right n characters of s s.left(n) gives the left n characters of s

Unit 7 Programming

  1. Comments are used in programs to give information about algorithms used, the author of a program or how complex parts of a program work. Generally, not every line of a program is commented, however, for this exercise, write a comment after each line of code to explain what it does. const PI = 3. radius = float(input("Enter radius: ")) area = PI * radius * radius print(area)