Problem Solving with Programming | Edexcel GCSE Computer Science (1CP2)
Problem Solving with Programming
- 170 questions
- 9 subtopics
- Paper 2
- Paper 2
Problem Solving with Programming is examined in Paper 2, Application of Computational Thinking.
It covers readable code, debugging and testing, selection and loops in Python, data types, conversion, variables and constants, string handling, lists, two-dimensional lists and records, keyboard input, screen output and CSV files, validation and authentication in Python, operators, functions and variable scope, and turtle graphics.
Sample questions from Problem Solving with Programming
Answer each one closed book first, then open the answer.
-
Readable code, debugging and testing
Explain why if total = 100: fails in Python.
Show the answer
A single = assigns a value and cannot be used as a test, so Python reports a syntax error. A comparison needs the double equals sign ==. -
Selection and loops in Python
List the values produced by range(2, 11, 3).
Show the answer
The values are 2, 5 and 8. The next value would be 11, which is the stop value and is excluded. -
Data types, conversion, variables and constants
Explain why the result of input() must be converted before it is used in arithmetic.
Show the answer
The input() function always returns a string. The string must be converted with int() or float() before any calculation. -
String handling
Explain why input is often converted to lower case before it is compared.
Show the answer
A user may type Yes, YES or yes. The lower() method turns all of them into yes, so a single comparison works. -
Lists, two-dimensional lists and records
What is the list after temps = [18, 21, 19], then temps[0] = 22?
Show the answer
The list becomes [22, 21, 19]. An assignment to an index replaces the item stored there. -
Keyboard input, screen output and CSV files
How does for line in file: read a CSV file?
Show the answer
The loop takes one line of the file on each pass, from first to last. The loop ends automatically after the last line. -
Validation and authentication in Python
Describe a pattern check.
Show the answer
A pattern check makes sure input follows a set format, such as two letters then four digits. The string methods isalpha() and isdigit() can test each part. -
Operators, functions and variable scope
Explain the difference between a function and a procedure in Python.
Show the answer
A function uses return to send a value back to the code that called it. A procedure carries out its task and returns nothing.
The 9 subtopics
One subtopic is one session. Work down the list.
| Subtopic | What it covers | Questions |
|---|---|---|
| Readable code, debugging and testing | Indentation, comments, identifiers and white space in Python, turning flowcharts into code, and finding and fixing syntax, logic and runtime errors. | 24 |
| Selection and loops in Python | if, elif and else, range() with worked values, for and while loops, iteration over lists and strings, nested loops, and single entry and exit points. | 16 |
| Data types, conversion, variables and constants | Integer, real, Boolean and string in Python, a character as a one-letter string, converting input with int() and str(), and constants in capitals. | 18 |
| String handling | len(), indexing and slicing, find() and index(), upper() and lower(), concatenation, split(), strip() and replace(), with worked outputs. | 23 |
| Lists, two-dimensional lists and records | Python lists as arrays, append, insert and del, two-dimensional lists, records as lists of fields, and worked loops over lists of lists. | 18 |
| Keyboard input, screen output and CSV files | input() and output, opening, reading, writing and closing CSV files, readline() and readlines(), splitting and stripping lines, and formatting output. | 18 |
| Validation and authentication in Python | Presence, length, range and pattern checks written in Python, validation loops, checking digits before conversion, and authentication by ID, password and lookup. | 16 |
| Operators, functions and variable scope | %, // and ** with worked results, comparisons and logical operators, functions and procedures, parameters, built-in and library subprograms, and local and global variables. | 22 |
| Turtle graphics | Creating a turtle, moving and turning it, drawing shapes with loops, lifting and lowering the pen, pen colour, size and filled shapes, circles and arcs, setting position and heading, home and reset, standard and logo modes, speed, hiding the turtle, and the screen functions. | 15 |
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.
-
Step 1 · Closed book
Cover the answers. Work through one subtopic and write down what you can. Leave blanks where you have nothing.
-
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.
-
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
Edexcel GCSE Computer Science Active Recall Guide
Every topic, not just this one. 680 questions with their answers.