Data Types Flashcards

1
Q

What are data types

A

They are types of data that a variable can hold

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

What are the types of data types

A

Integer, Floating Point, String, Char, Boolean

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

Describe an Integer

A
  • Holds whole numbers (positive, negative, zero).
  • No decimals, used for counting and calculations.
  • Signed (±) or unsigned (+ only).
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Describe a floating point

A
  • Stores decimal numbers.
  • float (32-bit, less precise) vs. double (64-bit, more precise).
  • Used in finance, science, and graphics.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Describe a string

A
  • Holds text (letters, numbers, symbols, spaces).
  • Enclosed in “ “ or ‘ ‘.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Describe a char

A
  • Stores a single letter, digit, or symbol.
  • Uses single quotes (‘A’).
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Describe a Boolean

A
  • Represents true or false.
  • Used in conditions (if, while).
  • In some languages, 1 = true, 0 = false.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are variables and describe it a bit

A
  • A variable is a named storage location in memory that holds a value, which can change during execution.
  • It can store different data types (integers, floats, strings, etc.).
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the difference between Dynamically and Statically Typed Languages

A
  • Dynamically Typed (e.g., Python): Type is determined at runtime, allowing flexibility but potential type errors.
  • Statically Typed (e.g., C#, Java): Type is set at compile-time, ensuring type safety but less flexibility.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are constants

A

Constants are variables whose values cannot be changed when they’re assigned. They are used to represent values that should remain the same throughout the execution of a program, like mathematical constants (e.g., PI).

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

What is a scope

A

A scope defines where a variable or function is accessible within the code

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

What are the three types of scope?

A

Local, global and function scope

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

Describe a Local scope

A

Applies to variables inside a specific block (e.g., inside a function or loop).

Only accessible within that block.

Destroyed after the block finishes executing.

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

Describe a Global scope

A

Declared outside any function or block.

Accessible anywhere in the program after it’s declared.

Can be used or modified inside functions.

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

Describe a Function scope

A

Variables declared inside a function.

Only accessible within that function, similar to local scope.

Not available outside the function.

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

What are the three programming constructs

A

Sequence, Selection and Iteration

17
Q

What is a sequence

A

It refers to the execution of instructions or statements one after the other, in the order they appear in the program. The statement is executed step by step without skipping any.

18
Q

What is a selection

A

Selection allows the program to make decisions based on certain conditions. It uses if, elif and else to control the flow of execution depending if the conditions are true or false.

19
Q

Explain the if, elif and else statements

A

The IF statement is the starting point of a conditional logic and only executes a piece of code if the conditions are true. if the condition is false it skips over that block of code. (Give an example)

The ELIF statement is used when you want to check multiple conditions in a sequence i.e if the previous ones were false

The ELSE statement follows the if and elif statement and provides an alternative block of code if the if statement is false. it is essentially a fall back option when the initial option isn’t met

20
Q

What is Iterations

A

Iterations refers to repeating a set of instructions (loops) multiple times. It uses constructs like for and while loops. There are two types of loops which are pre conditional and post conditional loop.

21
Q

What is pre conditional loop

A

The condition is checked before each iteration.

The loop may not run at all if the condition is false initially.

Examples: while, for.

22
Q

What is post conditional loop

A

The condition is checked after each iteration.

The loop is guaranteed to run at least once, even if the condition is false initially.

Examples: do-while

23
Q

What are functions

A

Functions are blocks of reusable codes designed to perform a specific task. They help organise codes and make them more efficient. They are two types which are: inbuilt functions and customer functions.

24
Q

What are inbuilt functions

A

They are functions that are provided by the programming language itself. They are available to use without needing to define them. Examples are:

print(): Outputs text to the console.
len(): Returns the length of an object
type(): Returns the data type of an object.

25
What are customer functions
These are functions that you define yourself to perform a specific task. To define a custom function, you typically use the def keyword (in Python). SEE EXAMPLES
26
Describe parameter passing
Parameter passing refers to how data is provided to a function or method when it is called. There are two methods of passing parameters, Pass by Value, and Pass by Reference. REALLY IMPORTANT TO SEE EXAMPLES
27
What is pass by value
When you pass a parameter to a function by value, you are passing a copy of the value, not the original. When you pass a parameter by value: 1. The function works with the copy of the original 2. Changes made to this copy do not affect the original value
28
What is passing by reference
When you pass a parameter by reference, you are not passing a copy of the value. When you pass a parameter by reference: 1. The function works with the original data not the copy 2. Changes made to the parameter inside the function will affect the original value outside the function.
29
What is stepwise refinement
Stepwise refinement is a software development technique where a complex problem is broken down into smaller, more manageable parts
30
What is the bottom up approach
It is a strategy where individual components of a system are designed and built first before integrating them into larger systems
31
What is pseudocode
Pseudocode is a way to plan out a solution to a problem using simple, understandable language
32
Why use pseudocode?
1. It is easy to understand 2. Clear planning 3. Focus on logic
33
Basic elements of pseudocode are?
1. Start/End: Marks the beginning and end of the process. 2. Input: What data the program needs to start. 3. Output: What the program will give as a result. 4. Loops: Repeating steps until a condition is met.
34
Describe is Black box testing
(BEHAVIOURAL TESTING) it is the software testing method in which the internal structure/design of the item being tested is not known by the tester. It is used to find errors in this categories: 1. Incorrect or missing functions 2. Interface errors 3. Behaviour errors 4. Errors in data structures Testing levels: 1. Integration Testing 2. System Testing 3. Acceptance Testing
35
Describe is White box testing
It is the software testing method in which the internal structure/design of the item being tested is known by the tester. It is used in testing software codes for the following: 1. Internal security holes 2. Expected output 3. The functionality of conditional loops Testing levels: 1. Unit Testing 2. Integration Testing