Fundamentals of programming Flashcards

1
Q

concept of a data type

A

defines the type of data that a variable or object can hold

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

user defined data types

A

data types created by the programmer for a specific problem

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

what are reference data types used for

A

reference data type are used as stores for memory addresses of objects created at runtime

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

integer

A

any whole number
{8, 35)

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

real

A

numbers with a decimal point and a fractional part
{2.0, 19.234)

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

boolean

A

one of two values
{true or false}

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

character

A

a letter, number or symbol in the given character set
{h, 6, $}

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

string

A

sequence of characters
{hello world !}

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

casting

A

changing the data type

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

sequence

A

all lines are executed

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

selection

A

decisions made that determines the execution

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

iteration

A

code is repeated until specified conditions are met

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

count control loops

A

exact number of iterations known

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

condition controlled loops

A

iterates dependent on condition

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

variables

A

locations in the memory containing single values

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

constants

A

identifiers with values that remain fixed with values that remain fixed during the programs execution

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

why use constants

A

ability to update
readability
compiler optimisation

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

modulus

A

remainder
12 mod 5 gives 2

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

quotient

A

how many times
17 div 5 gives 3

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

boolean operators

A

takes boolean inputs and evaluate to a boolean value

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

example of string handling

A

string subject = “Computer Science”

subject.length = 16
subject.upper = COMPUTER SCIENCE
subject.lower = compuer science
subject.substring(0,8) = Computer

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

exceptions

A

events that occur during the executions of a program that disrupts the normal flow of the programs instructions

(sometimes cant be avoided and would normally terminate the program)

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

exception handling

A

to provide an alternative code if an exception is raised (e.g. try and catch)

24
Q

pointer

A

stores the memory address of another variable

25
records
data structure that groups together related data fields, allowing them to be treated as a single unit
26
variable declaration
process of specifying the name and data type of a variable, without assigning it a value.
27
constant declaration
process of assigning an unchangeable value to a variable, ensuring its value remains constant throughout the program's execution.
28
assignment
process of assigning a value to a variable
29
subroutine and its advantages
named section of code that can be called from anywhere for a specific task allows the same block of code to be called multiple times from different parts of a program, thus promoting efficiency and maintainability.
30
definite iteration
when a loop executes a predetermined number of times (e.g. for loop)
30
selection
allows code to be executed based on a specific condition e.g. if statement
31
indefinite iteration
when a loop continues to execute until a certain condition is met (e.g.
32
truncation
removing the fractional part of a number, resulting in an integer value
33
exponentiation
raising a number to a power
34
Be able to explain the differences between a variable and a constant.
named storage location that can hold a value that can be changed during program execution named storage location that holds a value that cannot be changed during program execution.
35
explain the advantages of using named constants.
provide meaningful names for values, enhance code readability, and make it easier to maintain and modify code in the future.
35
explain the advantages of using named constants.
provide meaningful names for values, enhance code readability, and make it easier to maintain and modify code in the future.
36
explain the advantages of using named constants.
provide meaningful names for values, enhance code readability, and make it easier to maintain and modify code in the future.
37
use of parameters
to pass data within programs.
38
local variables
exist only while the subroutine is executing are accessible only within the subroutine.
39
why is it good practice to use local variables
minimizes conflicts, enhances reliability, reduces chance of data corruption
40
explain how a stack frame is used with subroutine calls to store: return addresses parameters local variables.
Stack frames are used by computers to store return addresses, parameters and local variables for each subroutine call that occurs during the execution of a program.
41
use of recursive techniques in programming languages
it solve problems by breaking them down into smaller, simpler versions of the same problem, and solving those recursively until a base case is reached.
42
Understand the structured approach to program design and construction.
The structured approach to program design and construction involves breaking down a program into smaller, manageable tasks, using techniques such as stepwise refinement and modular design.
43
explain the advantages of the structured approach.
better code organization, modularity, and easier debugging
44
class
defines methods and attribute fields that capture the common behaviours and characteristics of objects
45
object-oriented design principles:
encapsulate what varies favour composition over inheritance program to interfaces, not implementation.
46
why is the object-oriented paradigm used.
provides programs with a clear structure that makes developing and testing programs easier for developers also allows for large projects to be divided among a team of developers.
47
how are objects created
using a constructor, implicit or explicit, and a reference to the object assigned to a reference variable of the class type
48
how is aggregation represented as
white diamond line
49
how is composition represented
black diamond line
50
encapsulation
data and methods are bundled together within a class, allowing for data hiding and the controlled access and manipulation of that data.
51
instantiation
process of creating an object of a class, allowing it to have its own unique properties and behaviours while adhering to the structure defined by the class.
52
when does polymorphism occur
when objects are processed differently depending on their class.
53
inheritance
allows one class to share the properties and methods of another class, while having its own properties and methods too.