CS Flashcards
Describe the process of compiling an app:
A compiler permanently translates all of the source code into machine code instructions, identifying all of the errors in the code at the end of the translation.
Explain how a computer system organises memory:
Each piece of data is stored in a separate location which has it’s own unique address
What is the purpose of concatenation?
It joins 2 strings together
State why predefined functions are used in testing:
Because if a predefined functions is used there is no need to code your own solution, therefore it is more time efficient
Describe how extended ASCII code is used to represent characters.
Extended ASCII uses a code to represent characters as an 8-bit number, each character is given a different number to represent it
What does GDPR state about data which is being stored in databases?
GDPR states that data should be limited to that needed for the declared purpose.
How would you code to find out the number of items in an array?
event = [“hurdles”, “sprinting”, “high jump”]
Print(“there are”, len(event), “events”)
What bus is uni-directional (only can go in one direction):
Address bus (PROCESSOR —> MEMORY)
What bus is bi-directional? (Can go in both directions)
The data bus
What is the code for importing random items from a 1-d array?
Import random
chararray=[“A”, “B”,”C”, “D”,”E”, “F”,”G”, “H”,”0”, “1”,”2”, “3”, “4”]
number=[0]*6
passcode=””
for counter in range(6):
number= random.randint(0,12)
passcode = (passcode + chararray[number])
print(passcode
What does the data bus do?
- carries data from memory to be used by the processor
- carries data from the processor to be stored in memory
What does the address bus do?
-tells memory which memory location is being read from
-tells memory which memory location is being written to
Code the random function with an array:
Import random
Seats = [true, false, true, true, false]
SeatNumber = random.randint(1,60)
While Seats[SeatNumber] = false:
SeatNumber = random.randint(1,60)
Seats[SeatNumber] = false