Fundamentals of programming Flashcards

You may prefer our related Brainscape-certified 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
Q

records

A

data structure that groups together related data fields, allowing them to be treated as a single unit

26
Q

variable declaration

A

process of specifying the name and data type of a variable, without assigning it a value.

27
Q

constant declaration

A

process of assigning an unchangeable value to a variable, ensuring its value remains constant throughout the program’s execution.

28
Q

assignment

A

process of assigning a value to a variable

29
Q

subroutine and its advantages

A

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
Q

definite iteration

A

when a loop executes a predetermined number of times (e.g. for loop)

30
Q

selection

A

allows code to be executed based on a specific condition

e.g. if statement

31
Q

indefinite iteration

A

when a loop continues to execute until a certain condition is met (e.g.

32
Q

truncation

A

removing the fractional part of a number, resulting in an integer value

33
Q

exponentiation

A

raising a number to a power

34
Q

Be able to explain the differences between a variable and a constant.

A

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
Q

explain the advantages of using named constants.

A

provide meaningful names for values, enhance code readability, and make it easier to maintain and modify code in the future.

35
Q

explain the advantages of using named constants.

A

provide meaningful names for values, enhance code readability, and make it easier to maintain and modify code in the future.

36
Q

explain the advantages of using named constants.

A

provide meaningful names for values, enhance code readability, and make it easier to maintain and modify code in the future.

37
Q

use of parameters

A

to pass data within programs.

38
Q

local variables

A

exist only while the subroutine is executing

are accessible only within the subroutine.

39
Q

why is it good practice to use local variables

A

minimizes conflicts, enhances reliability, reduces chance of data corruption

40
Q

explain how a stack frame is used with subroutine calls to store:

return addresses
parameters
local variables.

A

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
Q

use of recursive techniques in programming languages

A

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
Q

Understand the structured approach to program design and construction.

A

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
Q

explain the advantages of the structured approach.

A

better code organization, modularity, and easier debugging

44
Q

class

A

defines methods and attribute fields that capture the common behaviours and characteristics of objects

45
Q

object-oriented design principles:

A

encapsulate what varies

favour composition over inheritance

program to interfaces, not implementation.

46
Q

why is the object-oriented paradigm used.

A

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
Q

how are objects created

A

using a constructor, implicit or explicit, and a reference to the object assigned to a reference variable of the class type

48
Q

how is aggregation represented as

A

white diamond line

49
Q

how is composition represented

A

black diamond line

50
Q

encapsulation

A

data and methods are bundled together within a class, allowing for data hiding and the controlled access and manipulation of that data.

51
Q

instantiation

A

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
Q

when does polymorphism occur

A

when objects are processed differently depending on their class.

53
Q

inheritance

A

allows one class to share the properties and
methods of another class, while having its own properties and methods too.