Hello! I'm taking the paper 1 exam this Monday, I have come across some small programming issues that I don't quite understand.
1. when inputs are evaluated as strings, '06' is considered 'alphabetically' larger than '007' (this was in the additional specimen questions). I still don't understand this? How is 06 larger than 007
2. The definitions for this seem to vary, so does anyone know what is the actual difference between a function and a procedure/subroutine? Right now the way I differentiate them is that a function returns a value whereas a procedure doesn't and a procedure might not have any parameters?
3. What is the equivalent of a record in python? Is this just knowing how to use external text files?
4. What is meant by reading/writing from binary external files? I know how to do this with text files - what exactly are the binary files? The difference I learnt is that binary files contain all data types and are interpreted only by the program that created them.
In hindsight, I am posting this far too close to the exam date so I apologize and anyone who has an answer please get back to me as soon as possible!! All help is greatly appreciated.
Computer Science AQA - programming theory questions watch
- Thread Starter
- 04-06-2016 11:16
- 04-06-2016 22:16
1. Think of it this way. " A B C D E F G..." in terms of alphabetical sorting, you will say A is the highest value. The alphabet continues to characters such as " A B C... 0 1 2 3 4 5..." So now if we compare let's say 1 and 2, 1 is "alphabetically larger than 2 so it will output 1 is larger than two. (but numerically, 2 is larger than 1) The program converts the number into machine readable form and gives you its position in the ASCII alphabet. If you look at the ASCII table, the character 1 has a decimal-ASCII equivilant of 49 where as the character has a decimal of 50. The character A has a decimal equivilant of 65. So the lower the number, the more "alphabetic they are.
2, A solid way of answering this question would be: A function returns a value (1 mark) where as a procedure does not HAVE TO return a value (1 Mark).
3. A record is a user-defined data structure which don't need to have the same data type. Hence in Python these may be known as lists? More info here :http://www.thomas-cokelaer.info/tuto...tructures.html
4. A text file has an extension of .txt and stores the content when opened can be read by a human. A binary file has an extension of .bin and stores values in machine-code (such as ASCII), if you were to store let's say the string "AQA" and then store it in a binary file and then open it using notepad.exe, you will see a bunch of 1's and 0s as opposed to a .txt file where you see "AQA".
What you've learnt is pretty much correct!