ICS3U Computer Science • Ontario Grade 11

Corrected exercises: computer systems, components, software, files and the environment (ICS3U)

Exercises: computer systems, components, software, files and the environment (ICS3U)

Name: Class: Date:

Solutions

Suggested time: 2 h 00 · No calculator · 10 exercises
https://www.letuteurscientifique.ca/en/exercices/ics3u-computer-systems-environment

These ten corrected exercises cover the computer environments and systems chapter of ICS3U, Introduction to Computer Science, Grade 11, University Preparation, in Ontario: computer components and their specifications related to user requirements, peripheral devices, the components involved in executing programming operations, file maintenance (organizing files with absolute and relative paths, safeguarding data from malware with a system protection plan, backing up and archiving), the integrated development environment, source code and machine code, interpreters and compilers, the functions of applications, programming languages and operating systems, and environmental stewardship and sustainability, worked out by calculation.

What the set covers, the traps it targets

The programs are in Python 3; the reasoning holds in any language, and a line of the solutions says where Java behaves differently.

By the end, you can name each part of a computer from its job and size a scan from its resolution (exercise 1), say which component runs each line of a program and why RAM is not storage (exercise 2), sort software into applications, languages and operating systems and count the translations of a compiler and of an interpreter (exercise 3), resolve absolute and relative paths on a folder tree and name files so that they sort (exercise 4), and recognize malware by its behaviour and match each one to its counter (exercise 5). Part B matches a laptop to a list of requirements and reads the bottleneck on the Task Manager (exercise 6), judges a backup plan in hours of lost work (exercise 7), corrects five statements, one on an ergonomic guideline given in the statement (exercise 8), computes the energy and the cost of a lab left on at night and debugs the program that does it (exercise 9), and computes the e-waste and the cost of a fleet of laptops kept longer (exercise 10).

The thread of the set: each part, program and copy has one job, and most lost marks give one of them the job of another. Five traps are named in the solutions: (1) taking RAM for storage, as if more RAM gave more room for files, exercises 2, 6 and 8; (2) choosing an upgrade without reading the measurement, a faster processor for a memory that is full, exercise 6; (3) calling a copy on the same drive a backup, exercises 7 and 8; (4) forgetting that a worm spreads by itself while a virus needs a host, exercises 5 and 8; (5) forgetting that a compiler translates once and an interpreter at each run, exercise 3. Also treated: twice the dpi gives four times the pixels (1), a misspelled name found only when its line runs (3), lab10.py sorted before lab2.py and a relative path that survives a move (4), the busy disk of a full memory and the minutes rounded down (6), the weekend forgotten in the hours and watt-hours taken for kilowatt-hours (9), the replaced batteries forgotten in the e-waste (10).

No calculator is needed: the numbers are chosen to be worked out by hand. Prices, power readings and masses are data of the problems, not real tariffs or measurements of a given model. The research areas, careers and community partners of the same strand of the course are not exercises and are not in this set.

  • 10 corrected exercises • 100 points • 120 minutes
  • Self-checking, 130 answers
  • No calculator
Start exercise 1 The chapter sheet
Print

Print the homework or the solutions

The homework without solutions, one exercise per page, and the solutions on their own: it comes with your free space. An email is enough, no password, and you come back here.

Create my free space

Already have one? Sign in

Course recap

  • • CPU: runs the instructions and does the arithmetic. Cache: small, fast, in the processor. RAM: holds what is running, erased at power off. ROM: firmware, kept. Storage (SSD, hard drive): keeps files.
  • • An assignment stores a value in RAM; an arithmetic operation is done in the CPU.
  • • Application: a task for its user. Programming language: words and rules to write instructions. Operating system: manages the computer for all programs.
  • • A compiler translates the source once into machine code; an interpreter translates at each run. Machine code is made for one processor family.
  • • Absolute path: from the root /. Relative path: from the current folder; .. climbs one folder.
  • • A virus needs a host that someone runs; a worm spreads by itself over the network.
  • • Full backup: everything. Incremental: the changes since the last backup. Differential: the changes since the last full backup. A backup is kept on another device.
  • • Energy in kWh = power in W × time in h / 1000; cost = energy × price per kWh.
  • • In a fleet renewed evenly, the laptops retired per year = fleet / years of use.

Part A: the basics (/50)

Exercise 1: Components and peripherals by their job

22 answers to check

A computer is a set of parts, each with one job. The internal components sit inside the case, on or next to the motherboard; the peripherals are plugged in from outside and bring data in (input), take it out (output) or keep it (storage). Name each part from what it does.

  • a) Which internal component:1)carries out the instructions of a program and does its arithmetic2)holds the programs that are running and their data, and loses them at power off3)keeps the start-up instructions, the firmware, when the power is off4)is a small, very fast memory in the processor that keeps the data used most recently5)turns the current from the wall outlet into the low voltages the parts need?
  • b) Which internal component:1)connects the CPU, the RAM and the cards, and carries data between them on its buses2)computes the images sent to the monitor3)turns sound data into a signal for speakers or headphones4)keeps files and installed programs when the power is off?
  • c) Which of these keep their contents without power: RAM, ROM, cache, SSD, USB flash drive?
  • d) Is each peripheral an input, an output or a storage device: scanner, speakers, USB flash drive, printer, microphone?
  • e) A flatbed scanner digitizes an 8 by 10 inch photo at 300 dpi, dots per inch, in 24-bit colour (3 bytes per pixel) with no compression. How many pixels does the scan hold? How many MB does it take? By what factor does the number of pixels grow at 600 dpi?

Type your answers, the page tells you right or wrong 0/22

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) CPU; RAM; ROM; cache; power supply
  • b) Motherboard; video card; sound card; SSD (or hard drive)
  • c) ROM, SSD and USB flash drive keep their contents; RAM and cache do not
  • d) Input; output; storage; output; input
  • e) 7200000 pixels; 21.6 MB; 4 times as many

Two questions sort every part: is it inside the case or plugged in, and what happens to its contents at power off. The memories that the CPU uses while a program runs, cache and RAM, are fast and volatile; the ones that keep data, ROM and storage, survive power off.

a)

1) The CPU, central processing unit, runs the instructions one after another; its arithmetic logic unit does the calculations.

2) RAM, random access memory: the working memory of the programs that are open.

3) ROM, read-only memory. On most of today's computers this firmware sits in a flash chip that an update can rewrite; programs do not write to it during normal use.

4) The cache, built into the processor: smaller than RAM, and faster.

5) The power supply.

b)

1) The motherboard: every part is plugged into it, and its buses carry the data.

2) The video card. On many laptops, this job is done by a graphics part built into the processor chip.

3) The sound card, or the sound chip of the motherboard.

4) Storage: an SSD, or a hard drive on older or cheaper machines.

c)

Keep their contents: ROM, SSD and USB flash drive. Lose them: RAM and cache.

Pitfall: putting ROM and RAM together because both are called memory. RAM is the working memory, erased at power off; ROM keeps the firmware.

d)

Scanner: input, it brings an image in. Speakers: output. USB flash drive: storage. Printer: output. Microphone: input.

A touchscreen is both an input and an output device.

e)

8 inches at 300 dpi give 8 × 300 = 2400 pixels; 10 inches give 10 × 300 = 3000 pixels. 2400 × 3000 = 7200000 pixels.

7200000 × 3 = 21600000 bytes = 21.6 MB, with 1 MB = 1000000 bytes.

At 600 dpi: 4800 × 6000 = 28800000 pixels, 4 times as many. The figure shows why: twice the dots along each side of the same square gives 2 × 2 = 4 times the cells.

Pitfall: answering twice as many. The resolution counts dots along ONE inch, and the photo has two directions.

300 dpi9 cells600 dpi36 cellsThe same square of the photo; one cell is 100 × 100 pixels

Tick the exercises you have done or want to review: a free account, no password, keeps your ticks and your right answers from one visit to the next, tells you which chapter to tackle next and lets you ask for the exercise you are missing. Create your space, an email is enough.

Exercise 2: Which component runs each line: RAM against storage

10 answers to check

The program below is saved in the file average.py on the SSD of a laptop. A student runs it and types Ines. For each line, say which components do the work.

Python
name = input('Name: ')             # line 1
mark1 = 78                         # line 2
mark2 = 91                         # line 3
average = (mark1 + mark2) / 2      # line 4
print(name, 'average:', average)   # line 5
  • a) While the program runs, where is the value 78 of line 2 kept? Which component computes the sum and the division of line 4?
  • b) What value does average hold after line 4? Where is that value kept?
  • c) From which device does the name of line 1 come? Where does the text of line 5 go?
  • d) Before the student runs the program, where are the five lines of average.py? Where must the program's instructions be copied for the CPU to run them?
  • e) The laptop's battery dies right after line 5. After the restart, is the file average.py still there? Is the value 84.5 still in memory?

Type your answers, the page tells you right or wrong 0/10

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) In RAM; the CPU
  • b) 84.5; in RAM
  • c) The keyboard; to the monitor, through the video card
  • d) On the SSD (storage); into RAM
  • e) Yes, the file is on the SSD; no, RAM was erased

An assignment stores a value in RAM; an arithmetic operation is done in the CPU, which reads its operands from RAM, through the cache, and writes the result back; input comes from an input device and output goes to an output device. Storage holds the program file; to run it, the operating system copies it into RAM. The figure below draws these paths.

a)

mark1 = 78 stores 78 in RAM, under the name mark1.

Line 4 brings 78 and 91 into the CPU, which adds them, 78 + 91 = 169, then divides by 2.

b)

169 / 2 = 84.5: average holds 84.5, stored in RAM like the other variables.

The program prints Ines average: 84.5.

c)

input reads what the student types on the keyboard, an input device.

print sends the text to the video card, which makes the image the monitor shows. On many laptops the video card is a graphics part of the processor chip.

d)

Before the run, average.py is a file on the SSD, in storage.

To run it, its instructions are copied into RAM: the CPU reads its instructions from RAM, not directly from the SSD.

Pitfall: thinking that a program runs from the drive where it is saved. The drive keeps it; RAM holds it while it runs.

e)

Yes: average.py is on the SSD, which keeps its contents without power.

No: name, mark1, mark2 and average were in RAM, which is erased when the power goes. Running the program again recomputes 84.5.

Pitfall: confusing RAM and storage. RAM is the size of what can be open at once; storage is the size of what can be kept.

KeyboardRAMvariablesCPU+ and /SSDaverage.pyVideo cardMonitorline 1line 4at launchline 5

Exercise 3: Software: applications, languages, operating systems, compilers and interpreters

17 answers to check

Software comes in three kinds: an application does a task for its user, a programming language gives the words and rules to write instructions, and an operating system manages the computer for all the programs. A program written in a language is source code; the CPU runs only machine code, numbers made for its processor family, so the source code must be translated. A compiler translates the whole program once, into a file of machine code that then runs alone; an interpreter translates and runs the source each time the program is run. An IDE, integrated development environment, gathers the tools to write programs.

Line A below is source code. Line B is one of the machine instructions it becomes on a processor of the x86 family, which most Windows computers use, written in hexadecimal: these three bytes load a value from memory into the processor.

Line A: average = (mark1 + mark2) / 2

Line B: 8B 45 F8

  • a) Is each one an application, a programming language or an operating system: Windows 11, Java, a web browser, Android, a photo editor?
  • b) Which kind of software does each job:1)decides which running program uses the CPU next and gives each one its share of RAM2)gives the words and rules to write instructions3)turns a list of marks into a bar chart for its user?
  • c) Which part of an IDE:1)colours the keywords and underlines a misspelled one as you type2)runs the program one line at a time and shows the variables3)translates the source code so that the processor can run it?
  • d) Which line can the processor run directly? Do the bytes of line B run on a processor of another family? A program is run 40 times. How many times is its source translated with a compiler, and with an interpreter, in the model described above?
  • e) A 60-line program with no loops and no functions uses, on line 45, a variable whose name is misspelled, so it was never created. How many lines run before the error is reported if the program is written in Java and compiled? And in Python?

Type your answers, the page tells you right or wrong 0/17

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) Operating system; programming language; application; operating system; application
  • b) Operating system; programming language; application
  • c) Source code editor; debugger; compiler or interpreter
  • d) Line B; no; 1 translation; 40 translations
  • e) 0 lines in Java; 44 lines in Python

The three kinds answer three questions: who uses the computer (applications), who writes for it (languages), who runs it for everyone (the operating system). The translation answers a fourth: when is the source turned into machine code, once before all the runs (compiler) or at each run (interpreter)?

a)

Windows 11 and Android are operating systems. Java is a programming language. A web browser and a photo editor are applications.

An application is itself written in a programming language and runs on an operating system: the three kinds are layers, not rivals.

b)

1) Sharing the CPU and the RAM between programs is the operating system's job. 2) A programming language. 3) An application, such as a spreadsheet.

c)

1) The source code editor. 2) The debugger. 3) The compiler, or the interpreter, that the IDE starts when you click Run.

d)

Line B: the CPU runs machine code only. Line A is for people to read and edit.

No: machine code is made for one processor family. An ARM processor, the family of most phones and recent Macs, reads other numbers; the source must be translated again for it.

Compiler: 1 translation, then the 40 runs use the machine code file. Interpreter: 40 translations, one per run. The table below compares a few numbers of runs.

Pitfall: thinking that a compiled program needs its compiler at each run, or that an interpreted one is translated for good the first time.

Python itself first turns the source into an intermediate code, bytecode, which its interpreter runs; that detail is beyond this course.

e)

Java: the compiler checks the whole program before anything runs, and a name that was never declared stops the compilation. 0 lines run.

The Java compiler translates the whole program not into machine code but into bytecode, which the Java Virtual Machine then runs; the check of the whole program before any run is what matters here.

Python: lines 1 to 44 run, then line 45 stops the program with a NameError. 44 lines run, and their output is already on the screen.

A Python syntax error, such as a missing parenthesis, is different: Python reads the whole file before running it, so then no line runs.

RunsCompilerInterpreter1112121011040140Translations of the source code, in the textbook model

Exercise 4: Absolute and relative paths in a folder tree

11 answers to check

The figure shows Kofi's folders on his Mac and the school's shared drive, which appears under /Volumes. Folder names end with /. An absolute path starts at the root, /, and names every folder down to the file. A relative path starts from the current folder: a name goes down into a folder, and .. climbs up one folder. Kofi's current folder is /Users/kofi/school/ics3u/unit2.

Paths are written here with / as on macOS and Linux; Windows separates folders with a backslash and starts with a drive letter, and the reasoning is the same.

/Users/kofi/school/ics3u/unit1/hello.pyunit2/loops.pydata/scores.txtproject/game.pymcr3u/notes.pdfVolumes/Shared/ics3u/handouts/loops.pdfcurrent folderKofi's folders and the school's shared drive
  • a) What is the absolute path of game.py? And of loops.pdf, on the shared drive?
  • b) From the current folder, what is the relative path of scores.txt? And of hello.py?
  • c) Which file does the relative path ../../mcr3u/notes.pdf reach from the current folder? How many folders does it climb?
  • d) Kofi moves his whole ics3u folder into a new folder /Users/kofi/archive. From the moved unit2 folder, does ../unit1/hello.py still reach hello.py? Does ../../mcr3u/notes.pdf still reach notes.pdf? What is the new absolute path of game.py?
  • e) Kofi saves his twelve labs as lab1.py to lab12.py in unit2. The file window sorts names character by character. How many of the twelve names come before lab2.py? How should he name lab 7 so that the names sort in the order of the labs?

Type your answers, the page tells you right or wrong 0/11

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) /Users/kofi/school/ics3u/project/game.py; /Volumes/Shared/ics3u/handouts/loops.pdf
  • b) data/scores.txt; ../unit1/hello.py
  • c) /Users/kofi/school/mcr3u/notes.pdf; 2 folders
  • d) Yes; no; /Users/kofi/archive/ics3u/project/game.py
  • e) 4 names; lab07.py

Read a path one piece at a time, with your finger on the tree: an absolute path starts at /, a relative path at the current folder, and each .. climbs one folder. A relative path depends on where you stand, an absolute path does not.

a)

From the root: Users, kofi, school, ics3u, project, then the file: /Users/kofi/school/ics3u/project/game.py.

The shared drive has its own branch: /Volumes/Shared/ics3u/handouts/loops.pdf.

Pitfall: taking the ics3u folder of the shared drive for Kofi's. Two folders can have the same name in different places; their absolute paths differ.

b)

scores.txt is inside data, which is inside unit2: data/scores.txt, with no .. since the file is below the current folder.

hello.py is in unit1, a sister folder of unit2: climb once to ics3u, then go down: ../unit1/hello.py.

c)

The table below follows the pieces: .. gives ics3u, a second .. gives school, then mcr3u, then the file. The path reaches /Users/kofi/school/mcr3u/notes.pdf and climbs 2 folders.

d)

The move keeps everything inside ics3u together: unit2 and unit1 are still sisters, so ../unit1/hello.py still works.

../../mcr3u/notes.pdf now climbs from unit2 to ics3u, then to archive, and looks for /Users/kofi/archive/mcr3u/notes.pdf, which does not exist: this path breaks, because it leaves the moved folder.

game.py is now /Users/kofi/archive/ics3u/project/game.py. Every absolute path written before the move is broken; relative paths that stay inside the moved folder keep working.

e)

Sorting character by character compares lab1 and lab10 on their first different character: lab1.py, lab10.py, lab11.py, lab12.py, then lab2.py. 4 names come before lab2.py.

With two digits for every number, lab01.py to lab12.py sort in the order of the labs: lab 7 is lab07.py.

The same habit holds for dates: 2026-03-09 sorts in time order, 9-3-2026 does not.

PieceWhere you are after itstart/Users/kofi/school/ics3u/unit2../Users/kofi/school/ics3u../Users/kofi/schoolmcr3u/Users/kofi/school/mcr3unotes.pdf/Users/kofi/school/mcr3u/notes.pdfReading ../../mcr3u/notes.pdf one piece at a time

Exercise 5: Malware by its behaviour, and the protection plan

17 answers to check

Malware is software written to harm a computer or its user. Each kind is recognized by how it gets in and what it does. A school network links 300 computers. To compare a worm with a virus, a student writes the model below: a worm that starts on one computer and doubles the number of infected computers every 15 minutes, up to the whole network.

Python
infected = 1                          # line 1
minutes = 0                           # line 2
while infected < 300:                 # line 3
    infected = min(infected * 2, 300) # line 4
    minutes = minutes + 15            # line 5
print(minutes, infected)              # line 6
  • a) Name each malware:1)it copies itself into other program files on the same computer, and runs when one of them is opened2)it spreads from computer to computer through a security flaw, with no one opening anything3)a free download that works as promised, but also lets a stranger control the computer4)it records the websites visited and the keys typed, and sends them to a stranger5)it fills the browser with pop-up ads and changes its home page.
  • b) A spreadsheet received by email asks to enable content; once enabled, it deletes files. Which malware is it? Of the virus and the worm, which one spreads with no host file and no user action?
  • c) What does the program print? How many computers are infected after 60 minutes?
  • d) For each malware, which measure closes the way in described in a) and b): the worm, the virus, the Trojan horse, the macro, the adware?
  • e) A lab computer shows signs of a worm. What is the first step? Which measure saves the files even when every other measure has failed?

Type your answers, the page tells you right or wrong 0/17

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) Virus; worm; Trojan horse; spyware; adware
  • b) Malevolent macro; the worm
  • c) 135 300; 16 computers
  • d) Updates (patches); antivirus scan; official sources only; macros disabled; remove unknown extensions
  • e) Disconnect it from the network; a recent backup kept disconnected

Each kind of malware has its way in, and a protection plan closes each way: that is what makes a plan thorough. The difference between a virus and a worm is the host: a virus rides in a file or a program that someone runs, a worm travels by itself through the network.

a)

1) A virus: it needs a host, another program, and spreads when that host is run.

2) A worm: it spreads by itself over the network.

3) A Trojan horse: it hides a harmful part behind a useful program that the user installs.

4) Spyware. 5) Adware.

b)

A malevolent macro: a small program inside a document, run when the user enables the content.

The worm spreads with no host file and no user action.

Pitfall: calling every malware a virus. A virus waits for someone to open its host; a worm does not wait, which is why it can reach a whole network in an afternoon.

c)

infected goes 1, 2, 4, 8, 16, 32, 64, 128, 256, then min(512, 300) = 300, which stops the loop: 9 passes of 15 minutes. The program prints 135 300.

After 60 minutes, 4 doublings: 2 ** 4 = 16 computers. The table below follows the model.

A virus in a file shared by email reaches only the people who open it: its spread follows the users, not the clock.

d)

Worm: install the operating system updates, the patches that close the flaw it uses.

Virus: scan files and attachments with up-to-date antivirus software.

Trojan horse: install software only from its maker's site or an official store.

Macro: keep macros disabled in documents from outside.

Adware: remove unknown browser extensions and refuse the extra programs bundled with a download.

e)

First, disconnect the computer from the network, so that the worm cannot reach other computers; then scan and clean it, and install the missing updates.

A recent backup kept disconnected from the computer saves the files whatever the malware did: it is the last line of a protection plan, the one that still works when the others have failed.

MinutesInfected01152304458601675329064105128120256135300The model of the program: doubling every 15 min

Part B: problems and reasoning (/50)

Exercise 6: Specifications against requirements, and reading the bottleneck

11 answers to check

A Grade 11 student who edits videos for a school club is choosing a laptop. Her video editor asks for at least 16 GB of RAM; she wants an SSD of at least 500 GB, a laptop of at most 1.8 kg that she carries every day, and a price of at most 1200 dollars. The table gives the three laptops of the store.

Laptop PLaptop QLaptop R
Processor4 cores, 2.4 GHz6 cores, 3.2 GHz8 cores, 3.2 GHz
Memory (RAM)8 GB16 GB32 GB
Storage1 TB hard drive512 GB SSD1 TB SSD
Mass1.9 kg1.5 kg2.3 kg
Price749 dollars1099 dollars1899 dollars
100 %CPU48 %Memory6 %Disk25 %CPU96 %Memory88 %DiskSituation 1: exportSituation 2: 40 tabs
  • a) Does each laptop meet the four requirements: P, Q, R?
  • b) A salesperson says that P has more memory than Q, 1 TB against 512 GB. Is he right? Which requirements does R fail?
  • c) On Q, 430 GB are free once the system and the software are installed. Her camera setting records 0.15 GB of video per minute. How many whole minutes of video fit in the free space?
  • d) The figure shows the Task Manager of her old laptop in two situations: exporting a video (situation 1), and editing with 40 browser tabs open (situation 2). Which component is the bottleneck in each situation? Which upgrade helps situation 2?
  • e) The export of a video takes 14 min on Q. On R, whose 8 cores run at the same speed, how long does it take if the editor shares the work evenly between all the cores, the best case? In situation 2, would a processor with more cores, with the same amount of RAM, end the slowdown?

Type your answers, the page tells you right or wrong 0/11

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) P: no; Q: yes; R: no
  • b) No: 1 TB is storage, P has 8 GB of memory; the mass and the price
  • c) 2866 minutes
  • d) The CPU; the memory (RAM); more RAM
  • e) 10.5 min; no

A specification answers a requirement when it is the same kind of number: memory against memory, storage against storage. A slowdown is solved by the component that the measurements show saturated, near 100 %, not by the one with the most impressive number.

a)

P fails three requirements: 8 GB of RAM, a hard drive instead of an SSD, 1.9 kg.

Q meets all four: 16 GB, a 512 GB SSD, 1.5 kg, 1099 dollars.

R fails two: 2.3 kg and 1899 dollars. The best specifications do not make the best answer to these requirements.

b)

No. 1 TB and 512 GB are storage capacities, the space for files. The memory is the RAM: 8 GB on P, 16 GB on Q, so Q has twice the memory.

R fails the mass and the price.

Pitfall: calling storage memory. More storage keeps more files; more RAM keeps more open at once.

c)

430 / 0.15 = 2866.67 minutes: 2866 whole minutes fit, about 47 hours of video.

Rounding up to 2867 would not fit: a count of files or minutes that fit is rounded down.

d)

Situation 1: the CPU is at 100 % while the memory and the disk have room: the processor is the bottleneck. A long export keeps every core busy.

Situation 2: the memory is at 96 %. The disk at 88 % is a consequence: when RAM is full, the operating system moves parts of the open programs to the drive and back, which keeps the drive busy and slows everything. The bottleneck is the memory, and more RAM is the upgrade that helps.

Pitfall: buying a faster processor for situation 2. The CPU is at 25 %: it is waiting, not working.

e)

8 cores share the work 8 ways instead of 6: 14 × 6 / 8 = 10.5 min, at best. Part of an export often runs on one core, so the real time is usually longer.

No: in situation 2 the CPU is at 25 %, so more cores would wait as well. More RAM, or fewer tabs open, ends that slowdown.

Exercise 7: A backup plan in hours of lost work

11 answers to check

The school newspaper keeps its 48 GB folder on the SSD of the club's computer. Four students edit it every school day from 15:30 to 18:30. This year's plan, in the figure, writes a full backup on Sunday at 23:00 and an incremental backup each weeknight at 23:00 to an external drive kept in another room. A full backup copies the whole folder; an incremental backup copies only the files changed since the last backup, of any kind. Each day, different files change, and no file changes twice in a week, so the folder stays at 48 GB.

Last year's plan made one full backup on Sunday nights, and nothing else. On Thursday at 17:00 this year, the computer's SSD fails.

Sunfull48 GBMonincr.3.5 GBTueincr.1.5 GBWedincr.6.0 GBThuincr.2.0 GBFriincr.4.0 GBBackups at 23:00 to the external drive (incr.: incremental)
  • a) How many GB does this year's plan write to the external drive in one week? How many would a full backup every night, Sunday to Friday, write?
  • b) How many backups must be restored after the failure? In which order?
  • c) How many hours of editing sessions are lost with this year's plan? With last year's plan? How many student-hours does last year's plan lose for the four students?
  • d) A differential backup copies every file changed since the last FULL backup. With a differential each weeknight instead, what is the size of Wednesday's? How many backups would be restored after the failure?
  • e) A third plan copies the folder every night into a Backup folder on the same SSD. How many copies of the newspaper survive the failure? In June, the 30 GB of last year's issues are archived: moved to an archive drive and removed from the folder. What is the size of the next Sunday's full backup?

Type your answers, the page tells you right or wrong 0/11

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) 65 GB; 288 GB
  • b) 4 backups: Sunday's full, then Monday's, Tuesday's and Wednesday's incrementals
  • c) 1.5 h; 10.5 h; 42 student-hours
  • d) 11 GB; 2 backups
  • e) 0 copies; 18 GB

A backup plan is judged by two numbers: what it costs to store, and what it loses at the worst moment. The work lost is everything done since the last backup that survives the failure; a copy that shares the drive of the original does not survive it.

a)

48 + 3.5 + 1.5 + 6.0 + 2.0 + 4.0 = 65 GB in the week.

A full backup every night, Sunday to Friday: 6 × 48 = 288 GB, more than four times as much for the same protection each night.

b)

The last backup before Thursday 17:00 is Wednesday's at 23:00. Restore Sunday's full backup, then the incrementals of Monday, Tuesday and Wednesday, in that order: 4 backups.

Each incremental holds only the changes of its day, so none can be skipped, and restoring them out of order puts older versions of the files back on top of newer ones.

c)

This year: Wednesday's backup holds Wednesday's session, so only Thursday 15:30 to 17:00 is lost: 1.5 h.

Last year: the last copy is Sunday's, so the sessions of Monday, Tuesday and Wednesday, 3 × 3 h, and Thursday's 1.5 h are lost: 10.5 h.

For four students: 4 × 10.5 = 42 student-hours of work to redo. The table below compares the three plans.

d)

Wednesday's differential holds the changes of Monday, Tuesday and Wednesday: 3.5 + 1.5 + 6.0 = 11 GB.

Restore Sunday's full, then only Wednesday's differential: 2 backups. A differential grows during the week but restores faster; the work lost is the same 1.5 h.

e)

0 copies: the folder and its copy were on the same SSD, which failed. Such a copy protects against a file deleted by mistake, not against a failure of the drive, nor a theft or a fire.

Pitfall: calling a copy on the same drive a backup. A backup is kept on another device, ideally in another place.

After the archive, the folder holds 48 - 30 = 18 GB: next Sunday's full backup is 18 GB. Archiving removes the files from the working folder; the archive drive is kept, and backed up, as well.

PlanLast usable copySessions lostLostnightly incrementalsWed 23:00Thu 15:30 to 17:001.5 hSunday full onlySun 23:00Mon, Tue, Wed, Thu10.5 hcopy on the same SSDnone surviveseverythingthe whole folderFailure on Thursday at 17:00: what each plan loses

Exercise 8: Five statements to correct

10 answers to check

Each statement below was written by a student revising this chapter. Say whether it is true or false, then answer the question that follows it. Each false statement is corrected in the solution. For e), the computer lab's posted guideline says: the screen 50 to 75 cm from the eyes, its top at or slightly below eye level, and every 20 minutes a look at something about 6 m away for 20 seconds.

  • a) « Adding 8 GB of RAM gives 8 GB more room to save files. » A laptop has a 256 GB SSD with 241 GB used, and its RAM goes from 8 GB to 16 GB. How many GB are free on the SSD after the upgrade?
  • b) « A worm needs someone to open an infected file before it can spread. » Which of these malware needs a host file or program?
  • c) « A copy of my project in a second folder of the same SSD is a backup. » If that SSD fails, how many copies of the project survive?
  • d) « The cache is faster than RAM, and smaller. » Which order goes from the fastest to the slowest?
  • e) « The closer the screen, the less the eyes strain. » A student's monitor is 38 cm from her eyes. By at least how many cm must she move it back to follow the guideline?

Type your answers, the page tells you right or wrong 0/10

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) False; 15 GB
  • b) False; the virus
  • c) False; 0 copies
  • d) True; cache, RAM, SSD
  • e) False; 12 cm

Each statement gives a part the job of another, or reads a guideline backwards; one exact fact settles each.

a)

False. RAM holds what is open; files are kept in storage. 256 - 241 = 15 GB are free before the upgrade, and still 15 GB after it.

Correct statement: « Adding RAM lets more programs and data be open at once; it adds no room for files. »

b)

False. A worm spreads by itself through the network; the virus is the one that needs a host, a program or a file that someone runs.

Correct statement: « A virus needs someone to run its host file; a worm spreads on its own. »

c)

False. The two folders share the same drive: if it fails, 0 copies survive.

Correct statement: « A backup is a copy on another device, ideally kept in another place. »

d)

True. The cache sits in the processor and keeps a small part of what is in RAM, which is why it can be fast; RAM is much larger and slower; an SSD is larger still and slower than RAM. From the fastest: cache, RAM, SSD.

e)

False. The guideline sets a range, 50 to 75 cm: a screen too close makes the eyes work harder to focus. From 38 cm, she must move it back by at least 50 - 38 = 12 cm.

Correct statement: « The screen goes 50 to 75 cm from the eyes, its top at or slightly below eye level, as the lab's guideline says. »

Exercise 9: Problem: the energy of a computer lab left on at night

11 answers to check

A school's computer lab has 30 computers, used from 8:00 to 16:00, Monday to Friday, and left on, idle, the rest of the week. The class measured one computer and its monitor with a plug-in power meter; the figure gives the readings. Energy is power times time: a power in watts, W, times a time in hours gives watt-hours, and 1 kWh = 1000 Wh. Take 0.12 dollar per kWh as the price of electricity in this problem. A student writes this program for the weekly cost.

DevicePowercomputer, on and idle55 Wmonitor, on18 Wcomputer, asleep2 Wmonitor, asleep0.5 WReadings of the class's plug-in power meter
Python
COMPUTERS = 30                                   # line 1
watts = COMPUTERS * (55 + 18)                    # line 2: computer and monitor, idle
hours = 16 * 5                                   # line 3: 16:00 to 8:00, five nights
energy = watts * hours                           # line 4
cost = energy * 0.12                             # line 5
print(energy, 'kWh', round(cost, 2), 'dollars')  # line 6
  • a) What does line 6 print?
  • b) How many hours a week is the lab really left on, outside class time? How many hours does line 3 miss?
  • c) Which line 4 gives kilowatt-hours? With both lines corrected, what are the energy and the cost of one week?
  • d) What are the energy and the cost over the 36 weeks of the school year?
  • e) The technician's script now puts every computer and monitor to sleep at 16:15. How many kWh do the 30 sets use in a week asleep? How many dollars does the policy save over the 36 weeks? Ignore the 15 minutes before sleep.

Type your answers, the page tells you right or wrong 0/11

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) 175200 kWh 21024.0 dollars
  • b) 128 h; 48 h
  • c) energy = watts * hours / 1000; 280.32 kWh and 33.64 dollars
  • d) 10091.52 kWh; 1210.98 dollars
  • e) 9.6 kWh; 1169.51 dollars

An energy is a power multiplied by a duration, so both must be complete: every device that draws power, and every hour it is on. Then watts times hours give watt-hours, divided by 1000 for kilowatt-hours, the unit of the price.

a)

watts = 30 × (55 + 18) = 30 × 73 = 2190; hours = 80; energy = 2190 × 80 = 175200; cost = 175200 × 0.12 = 21024.0.

Line 6 prints 175200 kWh 21024.0 dollars: twenty thousand dollars a week for a lab at night, a number that should make anyone check the program.

b)

A week has 7 × 24 = 168 h, and class takes 5 × 8 = 40 h: the lab is left on 168 - 40 = 128 h.

16 × 5 = 80 h counts five nights, but from Friday 16:00 to Monday 8:00 the lab is on for 64 h, not 16 h: line 3 misses 128 - 80 = 48 h, the Saturday and Sunday daytimes and the Sunday night. The table below counts them.

Pitfall: counting the nights and forgetting the weekend, which is half of the off-hours.

c)

watts × hours is in watt-hours: energy = watts * hours / 1000.

2190 × 128 = 280320 Wh = 280.32 kWh a week; 280.32 × 0.12 = 33.6384, so 33.64 dollars a week. The corrected program is below.

Pitfall: multiplying watts by hours and calling the result kWh. The answer is then 1000 times too large.

d)

36 × 280.32 = 10091.52 kWh, and 36 × 33.6384 = 1210.98 dollars for the school year, to the cent.

e)

Asleep, one set draws 2 + 0.5 = 2.5 W; 30 × 2.5 = 75 W; 75 × 128 = 9600 Wh = 9.6 kWh a week.

Saved: 280.32 - 9.6 = 270.72 kWh a week, about 96.6 % of the night use; over 36 weeks, 270.72 × 36 = 9745.92 kWh, and 9745.92 × 0.12 = 1169.51 dollars.

Here a program cuts the use of a resource: the sleep script saves this energy without anyone having to remember to turn the lab off.

Python
COMPUTERS = 30
watts = COMPUTERS * (55 + 18)      # computer and monitor, idle
hours = 7 * 24 - 5 * 8             # every hour outside 8:00 to 16:00, Monday to Friday
energy = watts * hours / 1000      # watt-hours to kilowatt-hours
cost = energy * 0.12
print(energy, 'kWh', round(cost, 2), 'dollars')
PeriodHoursTotalMonday to Thursday nights4 × 16 h64 hFriday 16:00 to Monday 8:0016 h + 24 h + 24 h64 hin class, 8:00 to 16:005 × 8 h40 hwhole week7 × 24 h168 hOff-hours of one week: 64 + 64 = 128 = 168 - 40

Exercise 10: Problem: e-waste and cost of a fleet of laptops

10 answers to check

A school board lends 2400 laptops to its students. A laptop has a mass of 1.3 kg and costs 450 dollars. The fleet is renewed evenly: each year, the same number of laptops reaches the end of its life. Policy A replaces each laptop after 4 years. Policy B keeps each laptop 6 years, with a new battery after 4 years; a battery costs 90 dollars, and the old one, 0.2 kg, becomes e-waste too. Every retired laptop and battery is counted as e-waste unless the statement says otherwise.

  • a) Under policy A, how many laptops are replaced each year? How many kg of e-waste does that make each year?
  • b) Under policy B, how many laptops are replaced each year? How many kg of e-waste, batteries included? By what percentage is that less than under A, to the tenth?
  • c) What does each policy cost per year, in new laptops and batteries?
  • d) Under policy B, a refurbishing company takes the retired laptops and gives 60 % of them a second life; the other laptops and all the old batteries are e-waste. How many kg of e-waste does the board make each year?
  • e) Write a program that reads the number of laptops, the years of use, the mass of a laptop and the mass of the battery replaced (0 if none), then displays the laptops replaced per year and the kg of e-waste per year. What does it display for 2400 laptops kept 5 years, 1.3 kg each, with no battery replaced?

Type your answers, the page tells you right or wrong 0/10

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) 600 laptops; 780 kg
  • b) 400 laptops; 600 kg; 23.1 % less
  • c) A: 270000 dollars; B: 216000 dollars
  • d) 288 kg
  • e) 480.0 laptops per year, 624.0 kg per year

In a fleet renewed evenly, the laptops retired each year are the fleet divided by the years of use. Everything that leaves the board each year counts in the e-waste: the laptops, and the parts replaced to make them last.

a)

2400 / 4 = 600 laptops a year; 600 × 1.3 = 780 kg of e-waste a year.

b)

2400 / 6 = 400 laptops a year, so 400 × 1.3 = 520 kg; each of them had one battery replaced, so 400 × 0.2 = 80 kg more: 600 kg a year.

(780 - 600) / 780 = 180 / 780 = 0.2308, that is 23.1 % less.

Pitfall: forgetting the batteries, which gives 520 kg and 33.3 % less. A longer life reduces the waste, but by less than the count of laptops alone suggests.

c)

A: 600 × 450 = 270000 dollars a year.

B: 400 × 450 = 180000 dollars of laptops and 400 × 90 = 36000 dollars of batteries: 216000 dollars a year, 54000 dollars less than A.

d)

40 % of the 400 laptops are e-waste: 0.4 × 400 = 160 laptops, 160 × 1.3 = 208 kg; with the 80 kg of batteries, 288 kg a year. The figure below compares the three cases.

The 240 refurbished laptops will become e-waste later, at the end of their second life: reuse delays the waste and replaces a new laptop that would have had to be built.

e)

The program below divides the fleet by the years of use, then multiplies by the mass of a laptop and of its battery.

For 2400, 5, 1.3 and 0: 2400 / 5 = 480.0 laptops a year, and 480 × 1.3 = 624.0 kg. It displays 480.0 laptops per year, 624.0 kg per year.

Tested on policy B, with 2400, 6, 1.3 and 0.2, it displays 400.0 and 600.0, the result of question b).

Python
fleet = int(input('Laptops in the fleet: '))
years = int(input('Years of use: '))
laptop_kg = float(input('Mass of a laptop (kg): '))
battery_kg = float(input('Mass of the replaced battery (kg), 0 if none: '))
per_year = fleet / years                     # the same number retires each year
waste = per_year * (laptop_kg + battery_kg)
print(per_year, 'laptops per year,', round(waste, 1), 'kg per year')
780 kgA600 kgB288 kgB + reuseE-waste of the board per year, batteries included
Something missing from this set? A type of exercise your teacher gives, a problem you are stuck on, a mistake you spotted: tell me, I read every request.

Sending goes through your free space: that is how I can answer you and tell you when the exercise is added. An email is enough, no password. Create your space. Rather not create an account? Write to me directly.

What is it about?
I read every request myself, nobody else sees it. No need to write your name or your school.
When your request is dealt with, you hear about it by email and in your space.

By sending, you agree that I read your request to answer it. It is kept with your account, erased with it, and never published: privacy policy.

© Ahmed Squalli Houssaini. Exercise set published at www.letuteurscientifique.ca/en/exercices/ics3u-computer-systems-environment. Free for personal and classroom use; republishing it elsewhere requires written permission (legal notice).

Preparing for an ICS3U unit test?

I tutor Grade 11 computer science in English or in French, online. Get in touch for a first session: components, files, backups and energy come back on the final exam.

Site by Studio Squalli