Computer Science - Algorithms πŸ‘©β€πŸ’» Flashcards

1
Q

What is an algorithm?

A

An algorithm is a sequence of steps for solving a problem.

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

In computer terms, what is an algorithm?

A

In computer terms, an algorithm describes the set of steps needed to carry out a software task.

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

What are the main stages of solving a problem?

A
  1. Understanding the problem
  2. Defining the scope of a solution – the extent of
    the facilities that the solution will provide
  3. Creating the solution
  4. Documenting the solution
  5. Testing the solution.
  6. Creating the solution (go back to 3 until you get it right)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

In what 3 ways can an algorithm be expressed?

A

Through natural languages, pseudocode, and flowcharts.

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

What is a variable?

A

A variable is a uniquely named location in memory (RAM), in which a single data item can be held while a program is running.

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

When can a variable change?

A

The program can change the value held in a variable during the time of the program execution. (When the program is open)

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

What is a memory location?

A

When a variable is declared, an area of the RAM is given to it.

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

What counts as a meaningful variable name?

A

A full, not shortened name that describes the variable.

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

What is a reserve name?

A

A keyword that cannot be used as a variable name. Some examples of reserve names are β€œIF”, β€œINPUT”, and β€œOUTPUT”.

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

Can special characters be used in variable names?

A

The only special character that can be used in a variable name is underscore (β€œ_”)

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

Can spaces be used in variable names?

A

No, instead, use camel case or underscores.

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

What is camelCase?

A

WhenWordsAreSeperatedByEachWordHavingCapitalLettersJustLikeThis.

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

What is an integer?

A

Integers are whole numbers, that can be positive or negative.

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

What are integers commonly used for in algorithms?

A

For counting, and whole number addition/subtraction.

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

What is a real data type?

A

Real data type is numerical data which contain decimal numbers

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

What are real data types commonly used for in algorithms?

A

Mainly used for money, weight, height, and temperature

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

What is a char data type?

A

Char data type can hold only a single character.

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

What is a char data type commonly used for in algorithms?

A

Mainly used for codes like T or F, or for single character things such as grades (S, A, B, C, D, E, F)

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

What is a string data type?

A

String data type consists of 1 or more characters (symbols)

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

What are string data types commonly used for in algorithms?

A

Mainly used for names, and address

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

What is a boolean data type?

A

Boolean data type represents a logical value. It can only represent 2 values.

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

What are boolean data types commonly used for in algorithms?

A

True or false, Yes or no, 0 or 1, etc…

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

What is a constant?

A

Constants are data values which can be introduced at beginning of the program and cannot be altered by the program during execution.

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

What is pseudocode?

A

Pseudocode is one of the methods that could be used to represent an algorithm. It is not written in a specific syntax that is used by a programming language and therefore cannot be executed in a computer.

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

What does this symbol β€œπŸ β€ mean in pseudocode.?

A

It is the assignment symbol, which assigns a value to a variable.

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

How do you represent β€œless than or equal to” in pseudocode?

A

<=

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

How do you represent β€œmore than or equal to” in pseudocode?

A

> =

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

How do you represent β€œnot equal to” in pseudocode?

A

<>

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

What is the INPUT command in pseudocode?

A

It simply accepts an input into the program, assigning it to a variable.

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

What is the format of writing an INPUT command in pseudocode?

A

[INPUT] β€œ[INPUT prompt]”, [Variable name]

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

What is an INPUT prompt?

A

A string that contains helpful text prompting the user to enter something.

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

What is the OUTPUT command in pseudocode?

A

It’s the act of returning (sending out) some information / data to the user of the program. This can be numerical, written, visual, or audio based.

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

What is the format of writing an OUTPUT command in pseudocode?

A

[OUTPUT] β€œ[OUTPUT prompt]”, [Variable name]

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

What is an OUTPUT prompt?

A

A string prompting the user to identify the result that is produced by the program.

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

What is the DECLARE command in pseudocode?

A

Any variable/s to be used in the pseudocode can be declared (create) using the keyword DECLARE.

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

What is the format of writing a DECLARE command in pseudocode?

A

[DECLARE] [Variable name]: [Data type]

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

What is a program flowchart?

A

A pictorial representation of an algorithm.

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

What are symbols/boxes in flowcharts?

A

Standard shapes that represent different types of operations.

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

What are the messages in symbols in flowcharts?

A

Things that state briefly what operations are being handled.

40
Q

What is the shape of a terminator (start/end) symbol?

A

A square with rounded corners.

41
Q

What is a terminator symbol?

A

Terminator symbols are used at the beginning and end of each flowchart.

42
Q

What is the shape of a process symbol?

A

A rectangle.

43
Q

What is a process symbol?

A

Process symbols are used to show when values are assigned to an item/variable like an assignment in pseudocode.

44
Q

What is the shape of an input/output symbol?

A

A parallelogram.

45
Q

What is an input/output symbol?

A

Input/Output symbols are used show input of data and output of information.

46
Q

What is the shape of a decision symbol?

A
A DIAMOND THINGY!!!!!
LIKE THIS::
  /\
/    \
\    /
  \/
BUT LIKE FLIP IT AROUND 90 DEGREES AND THAT'S THE SHAPE OF IT-
ALSO THEY HAVE 2 LINES COMING OUT OF THEM!!!
47
Q

What is a decision symbol?

A

Decision symbols are used to decide which action is to be taken next.
These can be used for selection and repetition/iteration.

48
Q

How are flowchart symbols connected?

A

With arrows called flow lines.

49
Q

What is a control structure?

A

Depending on what a program is required to do, different control structures are used to control the flow of a program’s operations.

50
Q

What are the 3 basic control structures?

A

Sequences, Selections, and Repetitions.

51
Q

What is a Sequence control structure?

A

A set of instructions executed in order.

52
Q

What is a Selection control structure?

A

A decision made based on some strict condition.

53
Q

What is a Repetition control structure?

A

A set of actions repeated a number of times.

54
Q

What is a logic circuit?

A

A logic circuit is an electronic circuit that combines a number of logic gates. The gates in the logic circuit will control the flow of electricity through the circuit.

55
Q

What is a logic gate?

A

A model of an operation that has one or more binary inputs.

56
Q

What is a truth table?

A

A table that is used to check the output from a logic gate/logic circuit.

57
Q

What is the shape of a NOT gate?

A

A NOT gate is shaped as a triangle with one line leading into it and one leading out of it. (βŽ―β–·βš¬βŽ―)

58
Q

What is a NOT gate?

A

A logic gate that inverts the Boolean value that is input.

59
Q

What is the Boolean expression for the NOT gate?

A

X = Δ€

60
Q

What is the logic notation of a NOT gate?

A

X = NOT A

61
Q

What is the shape of an AND gate?

A

An AND gate is shaped like a stretched letter D with two lines leading to it and one leading out. (=D⎯)

62
Q

What is an AND gate?

A

A logic gate that only outputs a β€œ1” if both Boolean values leading to it are a β€œ1”.

63
Q

What is the Boolean expression for the AND gate?

A

X = A β‹… B

64
Q

What is the logic notation of an AND gate?

A

X = A AND B

65
Q

What is the shape of an OR gate?

A

An OR gate is shaped like.. a AND gate with it’s rounded part at the right of it becoming a point, while keeping the curvature, as well as the left of it becoming rounded inwards, there are two lines leading into it and one leading out. (==)=>⎯)

66
Q

What is an OR gate?

A

A logic gate that only outputs a β€œ1” if at least one of the two Boolean values is a β€œ1”.

67
Q

What is the Boolean expression for the OR gate?

A

X = A + B

68
Q

What is the logic notation of an OR gate?

A

X = A OR B

69
Q

What is different about the shape of a NAND/NOR gate, compared to their counterparts?

A

They have the same basic shape, but with a β€œβš¬β€ at the end of them.

70
Q

What is a NAND/NOR gate?

A

They have the opposite outputs of their AND/OR counterparts.

71
Q

What is the difference of the Boolean expressions of NAND/NOR gates compared to their counterparts?

A

They have a line over the expression.

72
Q

What is the logic notation for a NAND gate?

A

X = A NAND B

73
Q

What is the logic notation for a NOR gate?

A

X = A NOR B

74
Q

What is small basic?

A

Small basic is a programming language by Microsoft that is a simplified version of BASIC, designed to help students transition from visual-based programming languages such as scratch and app inventor to text-based programming languages

75
Q

Where do you write your small basic programs?

A

In the editor.

76
Q

What is the toolbar on small basic?

A

An area that allows you to run various commands.

77
Q

What is the help window in small basic?

A

An area that as you write code, gets updated with helpful information about commands.

78
Q

What is the InteliSense list in small basic?

A

A smart scrollable area that helps you write your programs faster, that can be scrolled using the DOWN or UP keys, and the ENTER key can be used to insert the highlighted command.

79
Q

What is the small basic command to output a line of text on the screen?

A

TextWindow.Write() or TextWindow.Writeline()

80
Q

What is the difference between TextWindow.Write() and TextWindow.Writeline()?

A

TextWindow.Write() does not create a new line, unlike TextWindow.Writeline().

81
Q

What is the small basic command to read data to a variable and store it for use in a command?

A

= TextWindow.Read()

82
Q

What is a statement?

A

An instruction to the computer; a program can be created with only statements.

83
Q

What are the 2 kinds of statements?

A

Properties and operations.

84
Q

What is a property?

A

A statement to change the window looks. (textwindow.title..)

85
Q

What is an operation?

A

A statement to carry out an action (textwindow.write..)

86
Q

How are values assigned in small basic?

A

With an = sign instead of an arrow.

87
Q

How do you write a comment that does not show in the executing program in small basic?

A

With a single apostrophe at the start of a line.

88
Q

How do operations work in small basic?

A
* - multiplying
/ - dividing
\+ - addition
- - subtraction
< - less than
> - more than
89
Q

What is the command for changing the background colour of the text window in small basic?

A

TextWindow.BackgroundColor = β€œβ€

90
Q

What is the command for changing the text colour of the text window in small basic?

A

TextWindow.ForegroundColor = β€œβ€

91
Q

What is the command for changing the title of the text window in small basic?

A

TextWindow.Title = β€œβ€

92
Q

What are the commands to change the position of the text window on screen in small basic?

A

TextWindow.Top =
TextWindow.Left =
Don’t make the value too much or it will be off screen!

93
Q

What are the commands to change the position of the cursor on the text window in small basic?

A

TextWindow.CursorTop =

TextWindow.CursorLeft =

94
Q

How are different kinds of values joined together in small basic? (Constant String, Constant Integer, Variables)

A

With a simple β€œ+”!

95
Q

What is used to show that something is of the string data type in small basic?

A

It is put in quotations.