R354 - CTAP2 Computational Thinking, Algorithms and Programming 2

studied byStudied by 0 people
0.0(0)
learn
LearnA personalized and smart learning plan
exam
Practice TestTake a test on your terms and definitions
spaced repetition
Spaced RepetitionScientifically backed study method
heart puzzle
Matching GameHow quick can you match all your cards?
flashcards
FlashcardsStudy terms and definitions

1 / 65

encourage image

There's no tags or description

Looks like no one added any tags here yet for you.

66 Terms

1

Variable

A named location in memory. Storing a single piece of data, which can be changed during run time.

New cards
2

Create a variable named year and assign it to the value of the current year as an integer

year = 2024 OR year = int(2024)

New cards
3

What is the value of num3 when this code has executed?
num1 = 5
num2 = 10
num3 = num1*num2

50

New cards
4

What is the value of num3 when this code has executed?
num1 = 21
num2 = 7
num3 = num1/num2

3.0 (results of division are stored as floats/real)

New cards
5

When programming what do we use the * operator for?

Multiplication

New cards
6

In the example below what does the + represent?
num3 = num1+num2

Addition

New cards
7

In the example below what does the + represent?
firstName = 'Ada'
surname = 'Lovelace'
fullName = firstName + ' ' + surname

Concatenation (joining of strings)

New cards
8

When programming what do we use the / operator for?

Division

New cards
9

When programming what do we use the - operator for?

Subtraction

New cards
10

When programming what do we use the == operator for?

Equal to

New cards
11

When programming what do we use the != operator for?

Not equal to

New cards
12

When programming what do we use the > operator for?

Greater than

New cards
13

When programming what do we use the >= operator for?

Greater than or equal to

New cards
14

When programming what do we use the < operator for?

Less than

New cards
15

When programming what do we use the <= operator for?

Less than or equal to

New cards
16

What python keyword do you use to accept data from user into your program?

Input

New cards
17

Write the code to ask the user for a number and store it as a variable named guess

guess = int(input("Enter your number: "))
#It doesn't matter if you wrote something else in the brackets but the "" do!

New cards
18

What python keyword do you use to output data from your program to your user?

Print

New cards
19

Complete the code below to output Hello followed by their name:

name = input("What's your name?")
#your code goes here

print("Hello", name)
OR
print("Hello "+name)

New cards
20

What type of data does an integer hold?

Whole numbers (including negative numbers and 0)

New cards
21

What type of data does a float/real hold?

Decimal numbers

New cards
22

What type of data does a string hold?

Text, punctuation, numbers, symbols - anything stored in a ""

New cards
23

What type of data does a Boolean hold?

True / False
1 / 0

New cards
24

What is the output of the code below?
print(int(101.1))

101 (casting a float as an integer will remove the decimal numbers)

New cards
25

What is the output of the code below?
print(int(42.99))

42 (casting a float as an integer will remove the decimal numbers)

New cards
26

Define the term casting

Changing a variable's data type

New cards
27

What is a list used for?

Storing multiple pieces of data under a single name.

example:
Names
Lucki
Matt
Hiten
Aoife

New cards
28

Define the term sequence

Executing instructions in order

New cards
29

Define the term syntax error

An error that does cause the program to crash. An error in the rules of the programming language.

New cards
30

Define the term logic error

An error that does not cause the program to crash or produces unexpected output

New cards
31

Define the term IDE (Integrated Development Environment)​

Allows programmers to write, test and run their programs. ​

New cards
32

Define the term selection

A comparison is made and the algorithm branches based on the result (can execute different pieces of code)

New cards
33

What is the output of this code?
number = 5
if number < 10:
number = number * 2
else:
number = number / 2
print(number)

10

New cards
34

What is the output of this code?
number = 18
if number < 10:
number = number * 2
else:
number = number / 2
print(number)

9

New cards
35

What do all selection statements start with?

if

New cards
36

What key term is missing from the code extract below?

if number < 5:
print("your number is less than 5")
____ number < 10:
print("Your number is less than 10")

elif

New cards
37

What key term is missing from the code extract below?

if number =< 5:
print("your number is 5 or less")
____:
print("Your number is greater than 5")

else

New cards
38

Does else have a condition?

No

New cards
39

How many If statements can you have in 1 block of selection statements?

1 (if starts a new selection block)

New cards
40

How many elif statements can you have in 1 block of selection statements?

Unlimited

New cards
41

Define the term iteration

Part of an algorithm is looped if a certain condition is met

New cards
42

Name the 2 types of loop

while and for

New cards
43

Name the boolean operators you can use in a program

AND, OR, NOT

New cards
44

Why should you use comments in your code?

Make it easier to follow the logic of your code.
Explain how the code works.
Add details like the version number.
To help someone else edit your code or to help someone else edit your code (maintainability)

New cards
45

What numbers will this code output?

for count in range(0,10):
print(count)

0
1
2
3
4
5
6
7
8
9

New cards
46

A for loop is what type of loop?

Counter controlled Iteration / loop

New cards
47

A while loop is what type of loop?

Conditional iteration / loop

New cards
48

Define compression

Reducing the size of a fil4

New cards
49

Name the 2 types of compression

Lossy and Lossless

New cards
50

Define lossy compression

Compression in which data is lost and cannot be retrieved in its original form.

New cards
51

Define lossless compression

Compression in which no data is lost and all data can be retrieved in its original form.

New cards
52

What type of file would you use lossy for?

Used for media (images, videos, sound) where a loss of detail isn't noticeable to the eye/ear.

New cards
53

What type of file would you use lossless for?

Text and programs as a loss of data means the file wouldn't work correctly.

New cards
54

Why do we compress files?

Reduce the file size
Less data means the file is quicker to send
Means you can store more files on secondary storage

New cards
55

Define the term bit

A single binary digit, either 1 or 0

New cards
56

Define the term byte

8 bits of data

New cards
57

Define the term nibble

4 bits of data

New cards
58

How many nibbles in a byte?

2 (1 nibble is 4 bits, 1 byte is 8 bits therefore 8 / 4 is 2)

New cards
59

When storing data, what does KB stand for?

Kilobyte

New cards
60

When storing data, what does GB stand for?

Gigabyte

New cards
61

When storing data, what does MB stand for?

Megabyte

New cards
62

How many bytes in a kilobyte?

1024

New cards
63

Order these storage units from smallest to biggest: nibble, bit, kilobyte, gigabyte, byte, megabyte

bit, nibble, byte, kilobyte, megabyte and gigabyte

New cards
64

Order these storage units from largest to smallest: nibble, bit, kilobyte, gigabyte, byte, megabyte

Gigabyte, megabyte, kilobyte, byte, nibble and bit

New cards
65

How many kilobits in a megabyte?

1024

New cards
66

How many megabytes in a gigabyte?

1024

New cards
robot