⌨️Computer Science 2 Flashcards
comp 2.1: what is decomposition
breaking the problem down into smaller parts to simplify it, the smaller problems can be called sub-problems
comp 2.1: what is a structure diagram
they are used to represent decomposition, they are divided into nodes, the smallest node contains one task
comp 2.1: what is algorithmic thinking
this is a way of finding a solution by finding the individual steps needed
comp 2.1: what is abstraction
where you remove the unnecessary details from a problem
comp 2.1: what is a linear search
this searches through a dataset and matches the first letter and then the next and the next until it finds a match
comp 2.1: what is a binary search
finds a midpoint in the data sees if what you want is higher or lower and then half again until it finds a match, only works in an ordered list
comp: what is a logic error
it is an error in which an unexpected output occurs, they do not stop the program from working
comp: what is a trace table
it is a method of checking a program that involves going through it and recording each change in a new column of the table
comp 2.4: how do transistors function
by using semiconductors
comp 2.4: what component in the computer uses transistors to temporarily store data
the RAM (primary storage)
comp 2.4: what are electrically controlled switches called
transistors
comp 2.4: what are logic circuits composed of, where are they in the computer and what do they do
transistors, CPU and they perform calculations
comp 2.4: what form logic gates or “switches”
transistors
comp 2.4: how many transistors are in the CPU
3 bn
comp 2.4: true or false, logic gates selectively allow electrisity to flow
true
comp 2.4: what do logic gates form in the CPU
logic circuits that perform calculations
comp 2.4: do you perform the operations in brackets first in Boolean order of operations
yes
Comp 2.4: what is this symbol in Boolean logic ^
It is AND
Comp 2.4: what is this symbol in Boolean logic ¬
NOT
Comp 2.4: what is this symbol is Boolean logic V
It is OR
comp 2.4: what is the order of precedence for Boolean logic
Not, And, Or
comp 2.5: what is a HLL
it is a high level language and often resembles English, they can be very portable
comp 2.5: what are the pros and cons of HLLs
pro: they often resemble English
con: they are not always as fast as they require more translation
comp 2.5: what is an LLL
it is a low level language, they require less translation (lowe levels of abstraction from machine language)
comp 2.5: what are compilers
they translate a whole code at once, errors do not stop the code from being compiled and will all show up when the compiling is done, they create an exicutable file
comp 2.5: what is an interpreter
they translate high level code into executable programs one line at a time, they stop when they find and error
comp 2.5: what is an assembler
they translate assembly code into binary, they run fast.
comp 2.5: what is an IDE
Integrated development environments, they are software that facilitate software development
comp 2.5: in terms of IDEs what are debug tools
error diagnostics that highlight errors in code
comp 2.5: in terms of IDEs what are code editors
they allow code to be written
comp 2.5: in terms of IDEs what are translators
a program that converts source code into object code
they also facilitate the ‘RUN’ button
comp 2.5: what are the pros and cons of LLL
pros: faster, they need less translation
cons: they are hard to read
comp 2.5: what are the pros and cons of Compilers
pros:
- they provide a list of errors and aren’t stopped by a single one
- this can make debugging easier
- they produce an executable program that can help to protect copyright
cons:
- they can be very slow
comp 2.5: what are the pros and cons of Assemblers
pro:
- they only work on assembly language
- they provide direct control over the hardware
con:
- they are very difficult to use
comp 2.5: what are 3 features of IDEs
debug tools, code editors, translators
comp 2.5: what are 3 types of translators
compilers, interpreters, assemblers
comp 2.2: in python, how do you find the length of a string
len(var)
comp 2.2: in python, how do you return a string in upper case
var = “hi”
var.upper()
print(var)
comp 2.2: in python, how to transform a string into lower case
var.lower()
comp 2.2: in python, how do you return the 5th character of a string
print(var[4])
comp 2.2: in python, how do you print characters 1 to 5 of a variable
var = “hello world”
print(var[0:4])
output is hello
comp 2.2: in python, what is the code that allows you to open write to, append data(add a new file) and read a file
f = open(“myfile.txt”, “w”)
f.write(“hi”)
f = open(“myfile.txt”, “a”)
f. write(“hi”)
f = open(“myfile.txt”, “r”)
print(f.read())
f.close
comp 2.2: what do you have to do after opening a file in python
close it (f.close)
comp 2.2: what is does the SELECT function sql do
the field (column) of the text that you are selecting
comp 2.2: what does the FROM function in sql do
it defines the table you are selecting from
comp 2.2: what does the WHERE function do in sql
it defines the conditions that must be met for the data to be returned
comp 2.2: what does the ORDER BY function do in sql
it orders the returned data in an order, either asc(ascending) desc(descending) order
comp 2.2: what does the AND function do in SQL
it adds a condition that must be met for the data to be returned
comp 2.2: what does WHERE LIKE “A%”
return anything where the first letter is A% can be followed by anything.
comp 2.2: what is casting
it is the process of change one form of data into another
comp 2.2: how do you do a single line comment in python
#
comp 2.2: how do you do a multi line comment in python
”””
comment
“””
comp 2.1: how is the dataset divided in a binary search
by using integer division which is dividing without including a fractional part 8/ 3 = 2 not 2.6666
comp python: how do you write a number to the power of another
num1 ** num2
comp python: how do you figure out if a number is even or odd
if number % 2 == 0 then its even
comp: what is a zero indexed array
the first item is an index of zero
comp 2.2: how do you do integer division in python
//
comp 2.1: what is a bubble sort
first 2 items are checked, they are swapped if the are in the wrong order, then this process repeats until the end of the items. Then this process is repeated until the set is sorted
comp 2: what is a function
a piece of code that can be called from anywhere that returns a value
comp 2: what is a procedure
it is a piece of code that can be called from anywhere and does not return a value
comp 2.1: what is an insertion sort
it is a sort where the first point is entered and then the next and then the next in order until the set is sorted.
comp 2.1: what is a merge sort
2 ordered lists are taken, these lists are then split into lists of size one, the size one lists from the ordered lists are compared and ordered, then the 2 lists are compared and again until the list is sorted.
comp 2.1: what does a merge sort sort
it merges together 2 lists
comp 2.1: what are the pros and cons of a merge sort
pros:
- efficiency
cons:
- can be slower
- needs more memory
comp 2.1: what are the pros and cons of an insertion sort
pros:
- easy to implement
- little memory
cons:
- inefficient
comp 2.1: what are the pros and cons of a bubble sort
pros:
- easy to implement
- little memory
cons:
- inefficient
comp 2.3: what is defensive design
it is an approach to software development by which program is designed to be robust
comp 2.3: what is a robust program
it is a program that can handle unexpected inputs without crashing or without being manipulated into malicious actions
comp 2.3: what is validation
of inputs
it making sure inputs meet a certain criteria
comp 2.3: what is sanitation
of inputs
the removal of unwanted characters from a dataset
comp 2.3: what is authentication
it is the process of checking whether a certain used should be able to access a certain system
comp 2.3: what are contingencies
planning for contingencies such as a user accesing un-assigned systems
comp 2.3: what is an exeption
rather than letting a program crash, an error can be “thrown” and can be “caught” and handled instead of making the program crash
comp 2.3: what is itterative testing
it is testing while a code is being developed
comp 2.3: what is terminal testing
it is testing at the end of development
comp 2.3: what is a runtime error
they are errors that happen while the code is running
comp 2.3: what is blackbox testing
testing where the tester does not know the internal structure of a program
comp 2.3: what is whitebox testing
testing where the tester does know the internal structure of a program
comp: what is a variable
it is a piece of data with an identifier and that can change while a program is running
comp 2.1: what do structure diagrams look like
comp 2.2: how to cast data as a string or int
str(data)
int(data)
comp 2.2: what is a constant
it is a piece of data that does not change
make flshacards on ehat different types of flow dioagram images are
Comp 2: what does the line do in a flow diagram
It represents the flow between each part of the diagram
Comp 2: what does the square do in a flow diagram
it is a process
Comp 2: what does this do in a flow diagram
Represents the start or end of a process
Comp 2: what does this do in a flow diagram
It is a point requiring yes or no
Comp 2: what does this do in flow diagram
It calls a suborutine
What does this do in a flow diagram
It is an input or output operation
Comp 2: What is a real (number)
A float (decimal)
Comp 2: what is null data (in error testing)
It is where no data is entered
Comp 2: what is erronius data (in error testing)
It is the wrong data altogether
Comp 2: what is invalid data (in error testing)
It is data not within the acceptable range or of an invalid format
Comp 2: what is valid data (in error testing)
Correct data
Comp 2: what is casting
It is changing data from one type to another
comp 2.1: what is selection
it is where a piece of code is only executed if/when a condition is met
comp: why must files be handled in the way that they must
to prevent accidentally corrupting them
comp: how do you close a file in python
f.close()
comp: what is structured data
it is that resides within a fixed field in a record, this makes it easy for the data to be entered, stored, queried, and analyzed
comp: when editing files what does write (‘w’) do in python
it overwrites the entire file
comp: when editing files what does write (‘a’) do in python
it adds to the file