Skip to main content

Select an OCR site

  • Log in to Interchange
  • About us
  • Facebook
  • Twitter
  • LinkedIn
  • YouTube
  • Blog
  • RSSFeed

OCR homepage

Search using filters

Main navigation

  • Home
  • Qualifications

    Qualifications

    • Apprenticeships
    • AS/A Level GCE
    • Cambridge Nationals
    • Cambridge Progression
    • Cambridge Technicals
    • Cambridge Traineeships
    • Core Maths
    • Employability
    • English Baccalaureate (EBacc)
    • Entry Level
    • Essential Skills Wales
    • Free Standing Maths Qualification (FSMQ)
    • Functional Skills
    • GCSE
    • Cambridge IGCSE
    • Life Skills
    • Offender Learning
    • Other General Qualifications
    • Principal Learning
    • Projects
    • Vocational Education and Skills
    • Vocational Qualifications (QCF, NVQ, NQF)
    • Vocational Qualifications (QCF, NVQ, NQF - Certification only)
    • Wider Key Skills
    GCSE and A Level reform

    GCSE and A Level reform

    • GCSEs and A Levels (from 2015/2016)
    • Teaching and learning resources

    Vocational Education and Skills

    Vocational Education and Skills

  • Subjects

    Subjects

    • Accounting
    • Administration
    • Advice and Guidance
    • Art and Design
    • Banking
    • Being Entrepreneurial
    • Biblical Hebrew
    • Biology
    • Building and Construction
    • Business
    • Certificates of Professional Competence
    • Chemistry
    • Child Development
    • Citizenship
    • Classics
    • Computing/Computer Science
    • Contact Centres
    • Critical Thinking
    • Customer Service
    • Design and Technology
    • Drama
    • Dutch
    • Economics
    • Electronics
    • Employability Skills
    • Engineering
    • English
    • Food Preparation and Nutrition
    • Food Technology
    • French
    • Gateway Science Suite
    • General Studies
    • Geography
    • Geology
    • German
    • Government and Politics
    • Gujarati
    • Health and Safety
    • Health and Social Care
    • History
    • Home Economics
    • Hospitality and Catering
    • Humanities
    • ICT
    • Languages
    • Law and Legal Services
    • Management and Team Leading
    • Manufacturing
    • Mathematics
    • Media and Communication
    • Music
    • Performing Arts
    • Persian
    • Personal and Social Development
    • Physical Education
    • Physics
    • Portuguese
    • Professional Services
    • Projects
    • Psychology
    • Public Services
    • Quantitative Methods
    • Religious Studies
    • Retail
    • Science
    • Sociology
    • Spanish
    • Sport and Leisure
    • Teaching and Support
    • Text Processing
    • Travel and Tourism
    • Turkish
    • Twenty First Century Science Suite
    • Warehousing and Distribution
  • OCR for

    OCR for

    • Assessors
    • Employers
    • Exams officers
    • Higher Education
    • Learners and parents
    • Teachers
    • Training providers
  • I want to

    I want to

    Download past papers

    • Download past papers, mark schemes and examiner reports
    • ExamCreator
    • Past papers policy
    • Past papers availability

    Administer exams and assessments

    • Become a centre
    • Become an assessor
    • Check key dates and timetables
    • Check fees information
    • Check results
    • Create a scheme of work
    • Download admin guides
    • Download basedata
    • Download raw mark and UMS grade boundaries
    • Find out about E-assessment
    • Replace a lost certificate
    • Request a post-results service
    • Submit entries

    Get support and updates

    • Read subject information updates
    • Receive email updates
    • Read exams officer updates
    • Visit other OCR websites
    • Find out about GCSE and A Level reform
    • Offer OCR qualifications

    Find training and development

    • Book Professional Development
  • News

    News

    • Latest news
    • Agenda newsletter
    • OCR Policy Briefing
  • Events

    Events

    • Upcoming events
    • Past events
    • Book Professional Development
  • Community
  • Contact us

    Contact us

    • Complaints policy
    • Customer support
    • Feedback
    • Freedom of information
    • Ireland and Wales
    • Our national offices
    • Press office

    Frequently asked questions

    • Answers@OCR website
  • Help

    Help

    Contact

    • Contact OCR
    • Our national offices
    • Send us feedback

    Help with…

    • Finding qualifications
    • Finding results information
    • Finding past papers
    • Replacing a certificate
    • University placement
    • GCSE and A Level reform
    • Centre approval
    • Our policies
    • Copyright
    • Finding webpages

    Frequent queries

    • Answers@OCR website
  • Log in to Interchange
  • About us
  • GCSE and A Level reform
  • Vocational Education and Skills

AS and A Level OCR AS/A Level Computer Science

  • Home
  • Qualifications
  • By type
  • AS and A Level
  • OCR AS/A Level Computer Science
  • Programming techniques (2.2.1)
  • 02 Algorithms and programming
  • Thinking abstractly (2.1.1)
  • Thinking ahead (2.1.2)
  • Thinking concurrently (2.1.5)
  • Programming techniques (2.2.1)
  • Computational techniques (2.2.2)

Share

Programming techniques (2.2.1)

Navigate to resources by choosing units within one of the unit groups shown below.

Introduction

Overview

Delivery guides are designed to represent a body of knowledge about teaching a particular topic and contain:

  • Content: A clear outline of the content covered by the delivery guide;
  • Thinking Conceptually: Expert guidance on the key concepts involved, common difficulties students may have, approaches to teaching that can help students understand these concepts and how this topic links conceptually to other areas of the subject;
  • Thinking Contextually: A range of suggested teaching activities using a variety of themes so that different activities can be selected which best suit particular classes, learning styles or teaching approaches.

Curriculum content

Overview

Content (from A-level)

Software programs exist to solve problems. So, programming is a highly structured way of problem solving. Students should develop the ability to:

Break the problem down into smaller manageable chunks and understand how these interact

Plan the program before coding it using pseudocode and flowcharts

Visualise the flow of data and understand its types, as well as the process of user interaction with the program

Be aware of the facilities of the chosen language and how well they match the problem at hand

Create efficient code without logical or syntax errors

Be aware of the facilities of the chosen IDE to debug and construct interfaces

2.2.1 Programming techniques

a) Programming constructs: sequence, iteration, branching.

b) Recursion, how it can be used and compares to an iterative approach.

c) Global and local variables.

d) Modularity, functions and procedures, parameter passing by value and by reference.

e) Use of an IDE to develop/debug a program.

f ) Use of object-oriented techniques.

a) Programming constructs: sequence, iteration, branching.

How to Think Like a Computer Scientist:

Learning with Python: Interactive Edition 2.0 (the Runestone Interactive Project at Luther College, led by Brad Miller and David Ranum, based on the original work by: Jeffrey Elkner, Allen B. Downey and Chris Meyers) –

Link 1

Link 2 and specifically:

Link 3

Link 4

Link 5

Think Python textbook: An interactive online textbook that uses Python to illustrate programming concepts. It has interactive code but is also available as a PDF. The original book is available on Amazon and direct from the publisher.

Controlling Program Flow in Plain English (John G. McGuinn): Explaining these concepts using everyday actions of making coffee.

MIT Electrical Engineering and Computer Science website provides a good overview but can be a bit dry (but surprisingly accessible).

b) Recursion, how it can be used and compares to an iterative approach.

Recursion link 1

Recursion link 2

c) Global and local variables.

d) Modularity, functions and procedures, parameter passing by value and by reference.

Functions link 1

e) Use of an IDE to develop/debug a program.

Debugging link 1

f ) Use of object-oriented techniques.

Classes and objects link 1

Thinking conceptually

Overview

Common misconceptions or difficulties students may have

Conceptual links to other areas of the specification – useful ways to approach this topic to set students up for topics later in the course.

The most important technique is the ability to break down a complex task into simple sub-tasks and write (or recycle) selfcontained code in the form of functions and procedures (and classes/objects at the higher end of ability). The code that isn’t made modular becomes quickly overwhelming and leads to endless debugging rather than program improvement, despite having an added benefit of learners becoming familiar with the debugging tools of their IDE.

It is advisable to introduce functions and procedures as early as possible, before branching and iteration. Left too late, modular programming tends to put learners under stress as it requires them to relearn the skills they have just become comfortable with. Teaching learners that we define our routines in one place and trigger them in another place in a program is great for focusing them and reduces the number of blocks they need to track at any one time. While it might be easier to introduce procedures before functions, it is important that learners get a chance to use both, so they can later use the most appropriate ones for the task at hand.

The use of functions requires more planning and confidence in coding and will not come easy to all learners. Objectoriented programming takes modularity to a new level and introduces another layer of variables – object variables. It is important that learners understand that every task can be done either through procedures with global/local variables, or functions with local variables only and parameter passing between the functions, or with objects and it is advisable to ask pupils to produce multiple versions of the same program using all three paradigms.

Sequence, iteration and branching are best introduced through the various validation routines and any mistakes, especially logical mistakes, become obvious quite soon, simplifying the debugging. Nested branching (an if statement inside another if statement) is not trivial but the process of validating input data requires it, e.g., the type check often needs to be performed before range check and needs planning and sequencing of nested branching.

Non-conditional Iteration is best illustrated through lists/ arrays, especially 2d arrays. Being able to generate a times table or read a CSV file are the rights of passage, while conditional Iteration lends itself to validation and user interface duties.

Understanding recursion requires confident knowledge of functions, parameter passing, selection and iteration. In other words, it brings together almost all of the concepts of this section. While recursion can always be replaced by simple iteration, conceptually, it requires more meticulous program planning and hence is a good discriminator in assessment and is also needed for efficient sorting and searching. 

Thinking contextually

Activity 1: Branching

Little Man Computer makes heavy use of branching under three conditions: positive accumulator, zero accumulator and always. Branching effectively replaces iteration.

The explanation can be found within the Branching resource.

As LMC doesn’t have a division operator, it has to rely on repeated subtraction and counting how many times one number can be subtracted from another without making the result zero. This is analogous to the main point of division – to find out how many times can we fit one number inside the other.

Task 1: Create a flow chart for dividing 15 into 3 without the use of division.

Task 2: Pretend that your favourite high-level programming language doesn’t have division or multiplication. How would you implement this example?

Task 3: Implement this program in LMC

Task 4: Write out a dry trace table for dividing 15 into 3 (see Learner resource 1.1 for table).

Share activity

  • Copy URL
  • Email

Resources

  • Branching
    • Copy URL
    • Email
  • Learner Resource 1.1 - Task 4 table
    • Copy URL
    • Email

Activity 2: Sorting a nested list

Nested lists can’t be easily sorted by the second column in Python (or most other languages).

Task A: Design a solution that can sort a 2-column nested list alphabetically by the second, not first column.

Save in the same folder as your Python program will be.

Output:

Need to remove the empty last element:

Populate the nested (2d) list n:

Output:

Display the list in tabulated form:

Output:

Share activity

  • Copy URL
  • Email

Activity 3: Iterative vs recursive printing out of a list

Task A: Given a list a=[2,9,6,8,3], develop at least two iterative solutions to print out every item on this list, from the first to the last.

Task B: Given a list a=[2,9,6,8,3], develop at least two iterative solutions to print out every item on this list, from the last to the first.

Task C: Given a list a=[2,9,6,8,3], develop at least one recursive solution to print out every item on this list, from the first to the least and one recursive solution to print out every item from the last to the first.

Share activity

  • Copy URL
  • Email

Acknowledgements

Overview

OCR’s resources are provided to support the teaching of OCR specifications, but in no way constitute an endorsed teaching method that is required by the Board and the decision to use them lies with the individual teacher. Whilst every effort is made to ensure the accuracy of the content, OCR cannot be held responsible for any errors or omissions within these resources. We update our resources on a regular basis, so please check the OCR website to ensure you have the most up to date version.

© OCR 2015 - This resource may be freely copied and distributed, as long as the OCR logo and this message remain intact and OCR is acknowledged as the originator of this work.

About us

  • Contact us
  • Jobs
  • Our policies
  • What we do
  • Who we are

Help and support

  • Answers@OCR website
  • OCR Blogs
  • OCR Community
  • OCR CPD Hub

I want to

  • Book Professional Development
  • Check key dates and timetables
  • Check results
  • Download past papers, mark schemes and examiner reports
  • Find out about GCSE and A Level reform
  • Submit entries

Part of

  • Cambridge Assessment logo
  • LRQA logo

Select an OCR site

Administration

  • Interchange Opens in new window

Support

  • Answers@OCR website Opens in new window
  • OCR Blogs Opens in new window
  • OCR Community Opens in new window
  • OCR CPD Hub Opens in new window

Qualifications

  • Cambridge GCSE Computing Online Opens in new window
  • OCR STEM Developing skills and knowledge across the STEM spectrum.
  • TIME Training in Maths and English for post 16 learners

© OCR

  • Sitemap
  • Privacy policy
  • Terms and conditions
  • Accessibility
  • Copyright statement
  • Use of cookies
Back to top