[Unit 2.2] Problem Solving and Programming Flashcards

Algorithms and Programming

1
Q

define constant

A

a label to represent a value stored in memory that cannot change while the program is running

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

define variable

A

a label to represent a value stored in memory that can change while the program is running

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

define casting

A

changing a value from one data type to another

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

define global variables

A

can be accessed anywhere in the program. They must be stored in memory for duration of execution

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

define local variables

A

can only be accessed in a certain part of the program. Usually local to a subroutine and declared within.

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

Why don’t we use global variables?

A

they use a lot more memory. its harder to locate errors as global variables can be updated anywhere

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

difference between implicit and explicit casting?

A

implicit there is no loss of accuracy (int->long)

Explicit there may be loss of accuracy (double->int)

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

define sequence

A

program is followed one instruction after another

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

define Selection

A

Decision is made based on state of Bool (if..else)(switch..case)

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

define Iteration

A

repetition of a section of code using a loop

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

difference between count and condition controlled loop

A

count controlled runs a set number of times

condition controlled runs till a condition is met

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

difference between a pre and post check on a condition controlled loop

A

pre check - condition checked at start of loop

post check - condition checked at end of loop

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

define Function

A

subprogram that usually returns a value

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

define procedure

A

subprogram that performs some operation but does not return a value

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

define Parameter

A

variables that the subroutine receives (variable in the sub)

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

define Argument

A

variable that you pass into the subroutine (variable in the program)

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

define by value parameter

A

variable is copied, changing the value in the sub doesn’t change the original value

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

define by reference parameter

A

subroutine works with the original data/variable. If it changes, it stays changed

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

define Recursion

A

When a subprogram calls itself.

20
Q

key features of recursion (2)

A

base condition (stop the loop)

recursion statement

21
Q

(Dis)advantages of recursion

A

Dis:
-less efficient
-uses more memory
-may overflow stack due to too many calls (crashes)
-difficult to trace

Ad:
-quicker to write
-easier to read
-some problems are naturally recursive

22
Q

Features of IDE (9)

A

syntax highlighting

code editors

debugging tools

RTE

version control

automatic line numbers

keyword highlighting

automatic formatting

autocomplete

23
Q

define syntax highlighting

A

checks and highlights syntax errors

24
Q

define code editors

A

write and edit code

25
define debugging tools
tools help you find errors
26
define Run time environment
runs program, converting source code into machine code, executed by CPU
27
define Version control
records changes, allowing you to roll back to previous version if you make major mistake
28
define automatic line numbering
provides line numbers in margin of your code
29
define keyword highlighting
colours applied to code as you write
30
define automatic formatting
formats code for readability (e.g. indentations)
31
define autocomplete
tries to predict what programmer wants
32
define Iterative testing
during development of program
33
define Final testing
after program is completed
34
Types of test data
normal boundary Invalid erroneous
35
What is erroneous test data
out of the bounds of validation, should not be accepted
36
What is invalid test data
data of the wrong data type, should not be accepted
37
What is boundary test data?
data at the limit of acceptability, should be accepted
38
What is abstraction in terms of OOP
objects only reveal internal mechanisms relevant for other objects. Hiding unnecessary code
39
What is encapsulation in terms of OOP
objects do not have access to this class nor authority to change. but can call public functions.
40
what is inheritance in terms of OOP
objects with slight differences share code. child class inherit from parent class
41
what is polymorphism in terms of OOP
subroutines are flexible, depending on object.
42
what is instantiation in terms of OOP
creating an object from a class
43
what is a constructor
method that runs when class is used to create a new object
44
what is "public" in terms of OOP
attributes and methods that can be accessed outside the class
45
what is "private" in terms of OOP
attributes and methods that are not accessible outside the class (allows for encapsulation)
46
define "programming paradigm"
programming style used to create computer programs
47
what is the difference between procedural & OOP
OOP groups values together and subroutines as objects Procedural does not link values together