WorksheetsPearson 1CP2 - 1.1 - Good Programming Practice and IDEs
Total questions: 30
Worksheet time: 15mins
What is the purpose of autocomplete in an Integrated Development Environment (IDE)?
To check the syntax of the code
To help reduce the number of errors by suggesting possible word completions
To automatically indent code after typing a colon
To highlight different parts of the syntax
What does auto-indentation in an IDE help with when writing Python code?
It suggests variable names that don't exist.
It automatically indents the code after typing a colon, which is part of Python's syntax.
It checks for missing brackets or quotes in the code.
It provides suggestions for reserved words.
Which of the following is NOT a type of error that syntax checking in an IDE might highlight?
Misspelling key words
Using identifier names that don't exist
Suggesting words in a pop-up window
Missing colons
Which option best describes the role of syntax in programming languages?
The color scheme used in an IDE to highlight code
The library of functions available in a programming language
The rules governing the structure and composition of statements in a programming language
The efficiency of algorithms implemented in a programming language
Which feature of an IDE allows for the examination and modification of variables during the execution of a program?
To compile code more efficiently
To refactor code automatically
Stepping through code
To manage project files and resources
What happens when a breakpoint is set on a line in a program?
The program will skip the line and continue execution
The program will terminate immediately
The program will pause before executing the line
The program will execute the line multiple times
What does the IDE display when a program is paused on a breakpoint?
A red 'stop' icon
A green 'run' icon
A green bug icon
The line with the breakpoint highlighted
What is the purpose of the 'Step over' action in a debugger?
To execute the entire program until it completes
To execute the current line and move to the next line without entering any subprograms
To terminate the program immediately
To continue execution until the next breakpoint is encountered
What happens when you use the 'Step into' action in a debugger?
The debugger will move to the next line of code outside the current subprogram
The debugger will pause the program execution permanently
The debugger will execute the current line and enter the called subprogram
The debugger will skip over the execution of the current line
Which type of error doesn't relate to the way code has been produced.
Syntax errors
Runtime errors
Logic errors
Network errors
What type of error occurs when brackets aren't closed?
Syntax error
Type error
Compilation error
Execution error
What does IDE stand for in the context of programming?
Integrated Development Environment
Internal Drive Engine
Intelligent Design Entity
Interactive Development Execution
What type of error occurs when a programmer instructs the computer to do an operation but provides incompatible types, such as adding a number and a word?
Syntax error
Indentation error
Type error
Name error
How can you fix an indentation error in your code?
By changing the types of the data to be compatible
By only indenting the lines necessary to implement your logic and indent them to the correct level
By using an identifier that the interpreter recognizes
By ensuring all variables are initialized before use
Which of the following is an example of a type error correction?
count = 0; count = count + "Fred"
count = 0; count = count + 1
count = 0; count = lives + 33
count = 0; count = count + "1"
What type of error occurs when you try to use a variable that has not been defined?
SyntaxError
IndexError
NameError
ZeroDivisionError
How can a NameError be fixed in Python?
By resetting the value of count
By ensuring the variable is defined before it is used
By dividing the variable by zero
By spelling the variable name incorrectly
What is the result of a ZeroDivisionError in Python?
The program executes successfully
The variable becomes undefined
The program crashes because a variable is divided by zero
The variable is automatically set to zero
What is version control in the context of programming?
A system for keeping copies of code and getting them working in the same file with a new name
A database for storing user credentials
A method to control the version of the operating system
A strategy to avoid data loss by storing files on separate servers
What is the first step in the problem-solving process according to the text?
Algorithm design
Abstraction
Decomposition
Implementation
What does decomposition in computational thinking involve?
Breaking a problem into smaller, more manageable parts
Removing unnecessary details from a problem
Creating algorithms for each part of the problem
Working on different parts of the problem at the same time
Why is abstraction used when creating algorithms?
To make the algorithm run faster
To ensure the algorithm is easy to understand
To focus on the essential details and ignore the non-essential ones
To make the algorithm more complex
Which of the following is a form of abstraction in computer science?
Using a physical map to navigate a city
Writing a program that simulates weather patterns
Describing the taste of an apple
Organizing books on a shelf by genre
What is NOT considered when using abstraction to represent a die in a computer game?
The number of sides on the die
The shape of the die
The color of the dots on the die
The random number generated to simulate a die roll
What is the purpose of abstraction in programming?
To increase the complexity of the code
To focus on the high-level overview without worrying about the details
To make the program run faster
To reduce the number of lines of code
What is pattern recognition in the context of computational thinking?
Recognizing and using patterns in code to make it more efficient
Decomposing problems to notice common features and solve them
Creating visual patterns for user interfaces
Memorizing code patterns to avoid learning new programming languages
What is generalisation in the context of computational thinking and problem solving?
Writing code for a specific problem without considering future problems
Solving a problem by using a solution that applies to only one specific case
Creating a solution that solves a specific problem and cannot be applied to similar problems
Solving new, unseen problems based on your understanding of previous problems you have solved
What can pattern recognition in computational thinking help you to identify?
The differences between various problems that have no similarities
The parts, features, and requirements that a new problem has in common with an old problem
The unique aspects of a problem that have never been encountered before
The reasons why a problem cannot be solved using computational thinking
Here is an error message: IndexError: list index out of range. Identify what type of error it is from the following options.
Runtime error
Syntax error
User error
Logic error
Give three features found in an Integrated Development Environment (IDE).
Editor, syntax checker, and debugger
Compiler, command prompt, and antivirus
Web browser, email client, and media player
Spreadsheet, presentation software, and word processor
