[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
Q

define debugging tools

A

tools help you find errors

26
Q

define Run time environment

A

runs program, converting source code into machine code, executed by CPU

27
Q

define Version control

A

records changes, allowing you to roll back to previous version if you make major mistake

28
Q

define automatic line numbering

A

provides line numbers in margin of your code

29
Q

define keyword highlighting

A

colours applied to code as you write

30
Q

define automatic formatting

A

formats code for readability (e.g. indentations)

31
Q

define autocomplete

A

tries to predict what programmer wants

32
Q

define Iterative testing

A

during development of program

33
Q

define Final testing

A

after program is completed

34
Q

Types of test data

A

normal

boundary

Invalid

erroneous

35
Q

What is erroneous test data

A

out of the bounds of validation, should not be accepted

36
Q

What is invalid test data

A

data of the wrong data type, should not be accepted

37
Q

What is boundary test data?

A

data at the limit of acceptability, should be accepted

38
Q

What is abstraction in terms of OOP

A

objects only reveal internal mechanisms relevant for other objects. Hiding unnecessary code

39
Q

What is encapsulation in terms of OOP

A

objects do not have access to this class nor authority to change. but can call public functions.

40
Q

what is inheritance in terms of OOP

A

objects with slight differences share code. child class inherit from parent class

41
Q

what is polymorphism in terms of OOP

A

subroutines are flexible, depending on object.

42
Q

what is instantiation in terms of OOP

A

creating an object from a class

43
Q

what is a constructor

A

method that runs when class is used to create a new object

44
Q

what is “public” in terms of OOP

A

attributes and methods that can be accessed outside the class

45
Q

what is “private” in terms of OOP

A

attributes and methods that are not accessible outside the class (allows for encapsulation)

46
Q

define “programming paradigm”

A

programming style used to create computer programs

47
Q

what is the difference between procedural & OOP

A

OOP groups values together and subroutines as objects
Procedural does not link values together