WorksheetsComputer Science P2 Prep
Total questions: 61
Worksheet time: 31mins
Which logic gate is shown here?
OR
NOT
AND
NAND
The Boolean expression for this circuit is:
output = A (a) B (b) C
Choose the correct circuit for the following expression: P = (A V B) ∧ ¬C
Which of the following code is used to cast a string to an integer?
bool("False")
str("False")
integer("123")
int("123")
Identify the code which outputs 10 numbers correctly
for i in range(0,11)
for i in range(0,10)
for i in range(1,9)
for i in range(1,10)
Which of the following is the correct code to create an array to store some integers?
age = (2, 3, 1)
age = ["2", "3", "1"]
age = ["2" "3" "1"]
age = [2, 3, 1]
What is the correct value after this calculation? 5 mod 2
1
2
2.5
3
What is the correct value after this calculation? 5 div 2
1
2
2.5
3
What is the purpose of the following code?
Hide Answers
Opens a file for you to write into it
Opens a file for you to read the first line
Opens a file called name to store in an array
Opens a file called name to store in an array
In the following code how many parameters are used?
1
2
3
4
In the following code how many local variables are there?
1
2
3
4
What is the most suitable data type to store someone's name?
String
Character
Integer
Boolean
What is the most suitable data type to store the cost of an item?
String
Real/Float
Integer
Boolean
What is the following value that will be extracted using the code?
Mr
Liu
Com
Sci
Which of the following best describes a constant?
A memory store that store data that can be changed during the program
A memory store that store data that cannot be changed during the program
A memory store to store the value of an integer
A memory store to store the value of a string
What type of error is in the following code?
Syntax
Logical
Data Type error
Sequence program
What type of error is in the following code?
Syntax
Logical
Data Type Error
Sequence problem
What name will be printed?
Messi
Salah
Mbappe
Ronaldo
What type of subprogram is the following?
Function
Array
Iteration
Procedure
What is the correct value that will be extracted from the following code?
Salah
Liverpool
Ronaldo
Man Utd
What type of data structure is the following?
Constant
Variable
1D Array
2D Array
The IF STATEMENT belongs to which programming construct?
Selection
Sequencing
Iteration
Data Structure
The WHILE STATEMENT belongs to which programming construct?
Selection
Squencing
Iteration
Data Structure
Which of the following can be used to help with maintainability?
Use of sub programs
Input validation
Authentication
Iterative Testing
Which of the following can be used to help with maintainability?
Naming conventions for variables
Input validation
Authentication
Iterative Testing
Which of the following can be used to help with maintainability?
Commenting
Input validation
Authentication
Iterative Testing
Which of the following can be used to help with maintainability
Indentation
Input validation
Authentication
Iterative Testing
What best describes the following? Testing while developing your program.
Iterative Testing
Use of sub programs
Authentication
Anticipating Misuse
What best describes the following? Testing at the end of development.
Final Testing
Use of sub programs
Authentication
Anticipating Misuse
Which of the following data would be classed as normal test data?
17
abc
-1
15
Which of the following data would be classed as boundary test data?
17
abc
-1
15
Which of the following data would be classed as invalid/erroneous test data?
17
abc
-1
15
Which is the meaning of input validation?
Checking whether the user can log in or not
Checking if an input value fits in with the rules
Checking if the input is maintainable
Checking if the input is correct for test data
Which of the SQL statements will correctly output one row of information?
SELECT * FROM teachers WHERE year group > 7
SELECT * FROM teachers WHERE subject = "Art" and subject = "Business"
SELECT * FROM teachers WHERE subject = "Art"
SELECT * FROM teachers WHERE name = "Mr Liu" or name = "Mr Prior"
Which of the SQL statements will correctly output year groups between 12 and 13?
SELECT * FROM teachers WHERE year group > 11 and year group < 14
SELECT * FROM teachers WHERE year group > 7
SELECT * FROM teachers WHERE year group > 12 and year group < 13
SELECT * FROM teachers WHERE year group > "11" and year group < "14"
Compilers will....
Convert source code in one go
Convert source code line by line
Convert source code so that it is maintainable
Check for authentication
Which of the following is classed as low level language?
Machine Code
Python
C++
Javascript
Interpreter will....
Convert source code in one go
Convert source code line by line
Convert source code so that it is maintainable
Check for authentication
IDE stands for?
Information Development Environment
Integrated Development Environment
Integrated Design Environment
Information Design Environment
Editors are provided within an IDE what are they used for?
To input source code
To check for errors
To compile your program
To provide tools such as variable tracing and breakpoints
Translators are provided within an IDE what are they used for?
To input source code
To check for errors
To compile your program
To provide tools such as variable tracing and breakpoints
Error diagnostics are provided within an IDE what are they used for?
To input source code
To check for errors
To compile your program
To provide tools such as variable tracing and breakpoints
Run time environment is provided within an IDE what are they used for?
To input source code
To check for errors
To compile your program
To provide tools such as variable tracing and breakpoints
One instruction of high-level code represents many instructions of machine code
High-level languages
Low-level languages
Usually written for one type of machine or processor and won't work on any others.
High-Level Languages
Low-Level Languages
Code is very difficult to read, understand and modify.
High-Level Languages
Low-Level Languages
Commands in machine code can be executed directly without the need for a translator.
High-Level Languages
Low-Level Languages
(a) is a check made by a computer to ensure that the data entered is sensible or reasonable.
What type of validation would be used on a field to enter a mobile phone number to ensure it contains 11 digits
Spell check
Lookup table
Presence check
Length check
What type of validation would be used on a field to check that data has been entered?
Spell check
Lookup table
Presence check
Length check
What type of validation is used to check that a value falls within the specified range
Spell check
Range check
Presence check
Length check
What type of validation should be used to ensure a National Insurance number is in the form LL 99 99 99 L where L is any letter and 9 is any number?
Format check
Range check
Presence check
Length check
What does 'Defensive Design' mean?
A method of planning a program using shapes.
A method of planning a program using plain English.
A method of designing a program so that it functions properly and doesn't crash.
A method of checking that an input matches the criteria.
What does 'Input Validation' mean?
A method of removing unwanted characters from an input.
A method of planning a program using plain English.
A method of designing a program so that it functions properly and doesn't crash.
A method of checking that an input matches the criteria.
