Inputs, Outputs and File Handling
Quiz by GCSE Computer Science Teacher 4
GCSE (AQA)
Computer Science
English National Curriculum
Feel free to use or edit a copy
includes Teacher and Student dashboards
Measures 1 skill from
Measures 1 skill from
Track each student's skills and progress in your Mastery dashboards
With a free account, teachers can
- edit the questions
- save a copy for later
- start a class game
- automatically assign follow-up activities based on students’ scores
- assign as homework
- share a link with colleagues
- print as a bubble sheet
10 questions
Show answers
- Q1What code would ask the user for their name?USERINPUTUSERINPUT <-- namename <-- USERINPUTconstant NAME <-- USERINPUT45s3.2.7
- Q2What line of code would you need to output a message to say they have passed?OUTPUT "Well done you've passed"USERINPUT "You've passed"OUTPUT "Please re-do the test""Well done you've passed"45s3.2.7
- Q3Which program will ask the user for their Maths score and output it to the screen?USERINPUT OUTPUT scorescore <-- USERINPUT OUTPUT scoreUSERINPUT <-- score OUTPUT scorescore OUTPUT score45s3.2.7
- Q4Which line of code will open a text file containing the scores?('scores.txt')file <-- ('scores.txt')file <-- OPEN()file <-- OPEN('scores.txt')45s3.2.7
- Q5Which line of code will close the file?CLOSE.fileCLOSE()CLOSE(file)CLOSE(score)45s3.2.7
- Q6Why do you need to use CLOSE(file)?To make sure the user is able to save the current data to fileTo write the dataTo make sure the program is able to access the fileTo make sure the file is closed and other programs or user can access the file if they need to45s3.2.7
- Q7What type of information from a gaming program would be efficient to store in a file?The current players turnCurrent players nameAny variables usedWinners scores45s3.2.7
- Q8Why would storing scores in a file be efficient, compared to in the game its self?The file contents is only accessible when the file is activeIt is permanent storage and you can access the information againThe file will take up less memoryIt it quicker to store information in a file than in an array45s3.2.7
- Q9What does it mean if a file is read only?If you write to it, the contents will be wiped each timeYou can read and write to itYou can only read and amend, not write to itYou can not write to or amend its contents45s3.2.7
- Q10How is the append mode of a file different from the write mode?Append wipes the current dataThey are the same thingAppend adds to the existing contentThe write mode allows you to add to the existing content45s3.2.7