2.2 Programming Fundamentals Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What are programs?

A

Sequences of instructions for a computer.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a variable ?

A

A named memory address that holds a value.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a global variable ?

A

Variable that can be accessed and changed throughout the program

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a local variable ?

A

variables are confined to a loop or subprogram

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the three basic programming constructs ?

A
  • Sequence
  • Selection
  • Iteration
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a sequence ?

A

A set of instructions that follow on one from another

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a selection ?

A

A decision where the program decides to move on based on the results of an event.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is an iteration ?

A

The repetition of a block of statements within a computer program.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the two types of iteration ?

A
  • Count-controlled
  • Condition-controlled
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How does a selection work ?

A

By testing a condition

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is a count-controlled iteration ?

A
  • repeatedly executes a section of code a fixed number of predetermined times
  • for loop
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a condition-controlled iteration ?

A
  • repeatedly executes a section of code until a condition is met - or no longer met
  • while loop
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is nesting ?

A

Including one programming construct within another.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are the two types of nesting ?

A
  • Nested selection
  • Nested Iteration
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is an operator ?

A

a character that determine what action is to be performed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is a data type ?

A

data is divided up and organised according to type

17
Q

What are the 5 main data types ?

A
  • Integer
  • Float
  • Character
  • String
  • Boolean
18
Q

What is casting ?

A

Changing the data type of a variable

19
Q

How to check length in Python ?

A

len()

20
Q

What is concatenation ?

A

connecting strings of characters next to each other

21
Q

How to open a file in python ?

A
  • file = open(“FileName.csv”,”a”)
  • “a” = append
  • “w” = writes
  • “r” = read
22
Q

How to write to a file in python ?

A
  • file.append() = Lists
  • file.write() = Files
23
Q

How to close a file in Python ?

A
  • file.close()
24
Q

What is SQL ?

A

Structured Query Language

25
Q

What is the structure of a SQL query ?

A
  • SELECT
  • FROM
  • WHERE
26
Q

What are the two boolean operators that can be used in a SQL query ?

A
  • AND
  • OR
27
Q

What is an array ?

A

A set of data values of the same type, stored in a sequence

28
Q

What are the two types of subprograms ?

A
  • Procedures
  • Functions
29
Q

What is a procedure ?

A

A section of code that performs a specific task.

30
Q

What is a function ?

A

code that can be called by another part of the program with the purpose of returning one single value.

31
Q

What is the difference between a function. and procedure ?

A

Function requires a return

32
Q

What is a library ?

A

A collection of functions stored in a separate file.

33
Q

How to use a random feature in python ?

A
  • import random
  • random.randint(0,9)
34
Q

What are three common built-in functions ?

A
  • int
  • str
  • asc
35
Q

What is a 2D array ?

A

An array declared using two values