Computer Science: Topic 2.2 - Programming Techniques
Computer Science: Topic 2.2 - Programming Techniques
COMPUTER SCIENCE
MCQs and answers
Topic 2.2 – Programming techniques
MCQs
The numbers after the question are an approximate estimation of relative difficulty, broadly based around the new
GCSE Numbering System. Please note that these are approximate and should be used as a rough guide only. They
are not meant to infer precise mapping to GCSE outcomes.
1 © OCR 2020
GCSE (9–1)
COMPUTER SCIENCE
MCQs and answers
Question 8: When we read or write text files, we are working with this data type ü
Integers
Booleans
Reals
Strings
Question 9: EOF is used in ü
To indicate the end of a line with a formatting delimiter
Conditional loops when writing to a file
Conditional loops when reading from a file
Destructive overwriting of the file’s data
Question 10: The following is not a valid file open mode ü
Insert
Append
Read
Write
Question 11: The following is not a reason to close files ü
The program will not run otherwise
Files kept open after we stopped needing them is wasted memory
If we don’t close a file, our program will keep on changing the data inside it
A proper EOF will not be written
Question 12: The following is true about working with text files ü
The file has to exist before we can write to it
The changes are saved when we write to it, not when we close the file
We use counter-controlled loops to read them
We read and write them one line at a time
Question 13: The following is a right way to write to a file ü
myFile.READLINE(variable)
myFile.WRITELINE(variable)
myFile.APPENDLINE(variable)
myFile.INSERTLINE(variable)
Question 14: The most appropriate file mode for creating a logbook ü
Read
Write
Append
Close
Question 15: The following is a valid way to write a 2D array to a text file ü
Concatenate each row to a string with commas and then concatenate all rows with New Line
characters, or write rows with WRITELINE
Split the text file into an array, copy all elements to this array
Use SQL to convert 2D array to records first
All of these options are valid
2 © OCR 2020
GCSE (9–1)
COMPUTER SCIENCE
MCQs and answers
MCQs Answers
Question 1: In Record structures, VARCHAR keyword means ü
A field can be any number of characters or bytes in length
A field can be up to a certain number of characters or bytes in length
A field is an integer
The name of the field is about to be changed
Question 2: The following is true about Records ü
They must have an index
Fields are made up of records
Records can combine multiple data types in their fields
Record arrays are 2D arrays
Question 3: SQL is used to work with files in this format ü
Plain text
CSV
Proprietary binary
Spreadsheets
Question 4: The following is true about SQL ü
It has loops just like any other language
SQL is case sensitive
SQL is hard to read due to a lot of abbreviated keywords
SQL usually runs on top of another language
Question 5: The purpose of SELECT * FROM Pupils WHERE Result>90 is ü
To set every Pupil’s result to 90
To retrieve a collection of records of Pupils but only those whose result is 90
To retrieve a collection of records of Pupils but only those whose result is over 90
To retrieve a collection of records of Pupils but only those whose name is over 90
Question 6: The LIKE operator is used to ü
Approve SQL statements before execution
Replace the WHERE statement
When we deal with Boolean fields
To use partial matching when searching
Question 7: Nested SELECT queries are used ü
When Boolean operators get too complex
When retrieving data from multiple tables
When using partial matching
For validation and quality control
3 © OCR 2020
GCSE (9–1)
COMPUTER SCIENCE
MCQs and answers
Question 8: When we read or write text files, we are working with this data type ü
Integers
Booleans
Reals
Strings
Question 9: EOF is used in ü
To indicate the end of a line with a formatting delimiter
Conditional loops when writing to a file
Conditional loops when reading from a file
Destructive overwriting of the file’s data
Question 10: The following is not a valid file open mode ü
Insert
Append
Read
Write
Question 11: The following is not a reason to close files ü
The program will not run otherwise
Files kept open after we stopped needing them is wasted memory
If we don’t close a file, our program will keep on changing the data inside it
A proper EOF will not be written
Question 12: The following is true about working with text files ü
The file has to exist before we can write to it
The changes are saved when we write to it, not when we close the file
We use counter-controlled loops to read them
We read and write them one line at a time
Question 13: The following is a right way to write to a file ü
myFile.READLINE(variable)
myFile.WRITELINE(variable)
myFile.APPENDLINE(variable)
myFile.INSERTLINE(variable)
Question 14: The most appropriate file mode for creating a logbook ü
Read
Write
Append
Close
Question 15: The following is a valid way to write a 2D array to a text file ü
Concatenate each row to a string with commas and then concatenate all rows with New Line
characters, or write rows with WRITELINE
Split the text file into an array, copy all elements to this array
Use SQL to convert 2D array to records first
All of these options are valid
4 © OCR 2020
GCSE (9–1)
COMPUTER SCIENCE
MCQs and answers
Whether you already offer OCR qualifications, are new to OCR, or are considering switching from your current provider/awarding organisation,
you can request more information by completing the Expression of Interest form which can be found here: www.ocr.org.uk/expression-of-interest
Looking for a resource? There is now a quick and easy search tool to help find free resources for your qualification:
www.ocr.org.uk/i-want-to/find-resources/
Our documents are updated over time. Whilst every effort is made to check all documents, there may be contradictions between published support and the specification, therefore please
use the information on the latest specification at all times. Where changes are made to specifications these will be indicated within the document, there will be a new version number
indicated, and a summary of the changes. If you do notice a discrepancy between the specification and a resource please contact us at:
[email protected].
© OCR 2020 - 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.
OCR acknowledges the use of the following content: n/a
Please get in touch if you want to discuss the accessibility of resources we offer to support delivery of our qualifications: [email protected]
5 © OCR 2020