computer science paper 2 - algorithms

studied byStudied by 0 people
0.0(0)
Get a hint
Hint

how to print uppercase

1 / 48

flashcard set

Earn XP

Description and Tags

send help

49 Terms

1

how to print uppercase

print(Name.upper())

New cards
2

how to print lowercase

print(Name.lower())

New cards
3

how to print length of a string

len(password)

New cards
4

what is slicing a string called

substring

New cards
5

wat does word[2:5] mean

substring beginning at 2 and ending at 5 forms

New cards
6

if [4:], what?

4 characters of the string from the right

New cards
7

if [:4], what?

4 characters of the string from the left

New cards
8

how to close a file

file.close()

New cards
9

how to read txt in file

file.readline()

New cards
10

how to write a file

file.write(“text\n”)

New cards
11

how to show end a file

endofFile = false

New cards
12

how to open a file

file = open(“file.txt”, ”r”)

New cards
13

how to make new file

file = open(“file.txt” , “w”)

New cards
14

how to append file

file = open(“file.txt” , “a”)

New cards
15

a file is the __ of the table

a record is the __ of the table

column ; row

New cards
16

what is put at the end of an SELECT FROM WHERE command

;

New cards
17

how to create 2D array

array = [],[]

New cards
18

how does sub program simplify a program

by breaking it into smaller more managle partsw

New cards
19

hat are parameters

values that are passed into a sub program

New cards
20

what is the difference bewteen a function and a procedure

functions return values while a procedure doesn’tho

New cards
21

how do you call a function

just the name of the function but with the ()

New cards
22

2 stepper for using random number generator in python

inport random

random.randint(1,10)

New cards
23

A variable is a ___ location that holds data that during the execution of a program, can change

named memory

New cards
24

how to find the remainder after division

MOD

New cards
25

how to find the whole number after division

DIV

New cards
26

is it <= and >= or =< and =>

< is always first

New cards
27

what are the 3 core programming constructs and explain their uses

Sequence - lines of code and run int he order that they are written

Selection - the flow of a program is changed depending on conditions

Iteration - loop (for i=0 to )

New cards
28

3 qualities of low level language

directly translates to machine code

direct control over hardware

written for specific processors

New cards
29

compare 3 differences between machine code and assembly code

  1. first generation vs second generation

  2. directly executable (binary) vs translates to machine code

  3. binary vs text abbreviations of commands

New cards
30

translator turns … into …

source code into machine code

New cards
31

example of one low level translator

assembler

New cards
32

examples of 2 high level translators

compiler and interpreter

New cards
33

what is the difference between a compiler and an interpreter

compiler translates the source code all in one go while interpreter does it line by line

New cards
34

IDE makes writing … more ….

high level languages more efficient

New cards
35

what are 4 components of an IDE

  1. editor

  2. error diagnostics

  3. run time environment

  4. translator

New cards
36

4 functions contained within editor

  1. code text font size

  2. colour of text

  3. comments

  4. autocomplete ()

New cards
37

2 functions with error diagnostics

identifier - syntax errors

debugging - logic errors

New cards
38

what does run time environment do

allow the IDE to run the program

New cards
39

what does translator do

inbuilt software for compiling and interpreting code

New cards
40

3 examples of potential errors

Peripheral, Disk, Communication errors

New cards
41

what is defensive design

when every possible input from the user is considered

New cards
42

5 types of input validation

- length - of string 

- type - of data

- range - of number 

- presence - of whether any data present 

- format - of whether data is in the correct format 

New cards
43

program maintainability means

programmers can understand each other’s code

New cards
44

iterative testing: each … tested during development

final testing: all … of program function as intended 

pathway; modules

New cards
45

types of tests [4]

normal, boundary, erroneous ( wrong data type) , invalid

New cards
46

syntax error is an error that breaks the … rules of a programming language and stops it from running

grammatical

New cards
47

3 main principles of computational thinking:

Abstraction - removing unnecessary details

Decomposition - breaking into smaller tasks

Algorithmic thinking - creating step-by-step instructions in order to produce a solution to a problem

New cards
48

A binary search keeps … a dataset by comparing the target value with the … value, going left if smaller, right if bigger, until it finds the value or realises it's not there

halving; middle;

New cards
49

… sort starts at the beginning and checks values in pair; if not correct order = swapped

bubble

New cards

Explore top notes

note Note
studied byStudied by 21 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 38 people
Updated ... ago
5.0 Stars(2)
note Note
studied byStudied by 11 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 15 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 14 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 448 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 2 people
Updated ... ago
5.0 Stars(2)
note Note
studied byStudied by 15 people
Updated ... ago
5.0 Stars(1)

Explore top flashcards

flashcards Flashcard78 terms
studied byStudied by 4 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard45 terms
studied byStudied by 8 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard54 terms
studied byStudied by 41 people
Updated ... ago
5.0 Stars(2)
flashcards Flashcard28 terms
studied byStudied by 1 person
Updated ... ago
5.0 Stars(1)
flashcards Flashcard65 terms
studied byStudied by 24 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard31 terms
studied byStudied by 2 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard29 terms
studied byStudied by 4 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard31 terms
studied byStudied by 1 person
Updated ... ago
4.0 Stars(1)