Programming Fundamentals | OCR GCSE Computer Science (J277)

Programming Fundamentals

  • 99 questions
  • 6 subtopics
  • J277/02
  • J277/02

Programming Fundamentals is examined in J277/02, Computational thinking, algorithms and programming.

It covers variables, constants, operators and assignment, sequence, selection and iteration, data types and casting, string manipulation and file handling, arrays, records and SQL and functions, procedures and random numbers.

Sample questions from Programming Fundamentals

Answer each one closed book first, then open the answer.

  1. Variables, constants, operators and assignment

    What is output by x = 4, then x = x + 3, then x = x * 2, then x = x - 5, then print(x)?

    Show the answer
    The code outputs 9. The value of x goes from 4 to 7, then to 14, then to 9.
  2. Variables, constants, operators and assignment

    How can MOD test whether the number held in n is even?

    Show the answer
    The test n MOD 2 == 0 is True when n is even. An odd number always leaves a remainder of 1 when divided by 2.
  3. Sequence, selection and iteration

    How many times is Hi printed by for i = 3 to 7, print("Hi"), next i?

    Show the answer
    The word Hi is printed 5 times. The variable i takes the values 3, 4, 5, 6 and 7, and both ends are included.
  4. Sequence, selection and iteration

    What is output by mark = 65, if mark >= 70 then print("Merit") elseif mark >= 50 then print("Pass") else print("Fail") endif?

    Show the answer
    The code outputs Pass. The first test, 65 >= 70, is False, so the elseif test 65 >= 50 is checked and is True.
  5. Data types and casting

    Which data type suits the price of a sandwich, such as £3.49?

    Show the answer
    The price should be stored as a real. The value has a fractional part, so an integer cannot hold it.
  6. Data types and casting

    What do int("7") + 3 and "7" + "3" give?

    Show the answer
    The expression int("7") + 3 gives the integer 10. The expression "7" + "3" joins two strings to give "73".
  7. String manipulation and file handling

    With word = "Keyboard", what do word.left(3) and word.right(4) return?

    Show the answer
    The call word.left(3) returns "Key". The call word.right(4) returns "oard".
  8. String manipulation and file handling

    Where does myFile.writeLine("Level 3") place its text?

    Show the answer
    The method adds the line Level 3 at the end of the file. The lines already in the file are kept.

The 6 subtopics

One subtopic is one session. Work down the list.

Subtopic What it covers Questions
Variables, constants, operators and assignment Variables, constants and assignment, = against ==, input, MOD, DIV and exponent operators with worked results, comparison operators and Boolean conditions. 16
Sequence, selection and iteration The three programming constructs, count-controlled and condition-controlled loops, the output of for, while and do … until loops, if … elseif, and switch … case. 16
Data types and casting Integer, real, Boolean, character and string, choosing the right type for phone numbers, prices and grades, and casting with worked results. 18
String manipulation and file handling Concatenation, length, substring, left, right, upper, lower, ASC and CHR with worked results, and opening, reading, writing and closing text files. 16
Arrays, records and SQL One- and two-dimensional arrays indexed from zero, records and fields, and SELECT, FROM and WHERE queries on a small table with worked results. 16
Functions, procedures and random numbers Sub programs, functions and procedures, parameters and return values, local and global variables, worked function results, and random number generation. 17
Programming Fundamentals is 99 of the 740 questions in the guide.Get the guide, £7

How the guide is worked

Answering a question from memory stores it far better than reading the answer again. The guide runs that as a fixed procedure on one subtopic at a time, about twenty minutes a session.

  1. Step 1 · Closed book

    Cover the answers. Work through one subtopic and write down what you can. Leave blanks where you have nothing.

  2. Step 2 · Open book

    Go back to the top. Read each printed answer and write it out in full, including the ones you had right.

  3. Step 3 · Closed book again

    Same questions, same order, from memory. The gap between pass one and pass three is the session result.

Read the full method, the return schedule and the research behind it.

Nearby topics

All 11 topics Guide overview

OCR GCSE Computer Science Active Recall Guide

Every topic, not just this one. 740 questions with their answers.

£7 GBP
Get the guide

Digital PDF, sent to the email address on your order.