Week3 1
Week3 1
Introduction to Computer
Programming
Violetta Cavalli-Sforza
Week 3, Lecture 1
Quiz: This Wednesday, March 14
• Covers material from Weeks 1 & 2
• Slides
• Reading (Ch 1.1-1.3)
• Combination of true/false, and short-
answer questions, long-answer question
Quiz – Be Familiar With
• Basic hardware concepts (computer
components)
• Basic hardware/software concepts
– Binary vs. decimal representations and conversion
– Binary addition and outcomes, logical operations
• Different types of software & applications
• Basic types of PLs and their differences
(assembly, machine, high-level)
– NO: details about the different programming language
paradigms (first part of Week 2, Lecture 1)
– YES: structured, imperative, modular, and object-
oriented PLs
Quiz – Be Familiar With (2)
BEGIN
writeln ('Enter three scores and press <Enter>.');
readln (Score1, Score2, Score3);
Average := (Score1 + Score2 + Score3) / 3;
writeln (Average:20:3)
END.
Mean of 20 Numbers
• INPUT: 20 numbers
• OUTPUT: Mean of 20 numbers
• PROCESSING:
Get 20 numbers one at a time, keeping a
running sum
Compute Mean as Sum / 20
Mean of 20 Numbers: Refinement
PROCESSING: