Programming fundamentals Flashcards

1
Q

What are the two types of development approaches covered in the course?

A
  1. Waterfall - formal, structured, all steps covered sequentially.
  2. Agile - responsive to changing requirements, involves regularly releasing working versions and gaining appropriate feedback.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are some methods for determining the needs of a software project?

A
  1. Surveys to users and management
  2. Formal business analysis (this is the role of a systems analyst)
  3. Obvservation of users and current practices
  4. Interviews with users and management
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the difference between needs and requirements?

A

Needs are general in nature, while requirements are more specific and should be verifiable, so that the final product can be tested against these requirements.

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

Compare and contrast functional and non-functional specifications

A

Functional specifications refer to what the system will do, including performance and compatibility.

Non-functional specifications can be considered from the developer’s and user’s perspective and include various aspects like documentation, project management, social and ethical considerations and user interface/experience.

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

What does the Integration stage refer to in the software development cycle?

A

Integration involves adding the new code in to the new system. Part of this process will involve the code being reviewed and tested to ensure compatibility with any existing code and other systems.

Code versioning systems like Git and the website GitHub allow developers to collaborate on coding project simultaneously.

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

What testing is required after a project has been integrated?

A
  • Volume testing - to check whether the system can handle many requests.
  • Transaction types - to simulate real-world usage by using a mixture of different transation types.
  • Response times - to check whether the system processes data and responds to user interaction in a reasonable amount of time.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What does the Installation phase of the software development cycle refer to?

A

How the new software system will be adopted by users, either as a new system or as a replacement for an existing system. This involves:
* Training new users in the operation and processes associated with the system.
* Transitioning to the new system, as it may not be feasible to simply switch off the old system and start using the new one.

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

What activities are included in the maintenance stage of software development?

A
  • Fixing bugs
  • Adding new features
  • Updating the user interface
  • Supporting new hardware or software
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the 4 main data types used in programming?

A
  1. String
  2. Boolean
  3. Integer
  4. Real (decimals)

Note that the syllabus also includes:
* Date and time - these are handled by dedicated libraries.
* Single precision floating point - this is a specific way to represent real numbers.

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

What are the 3 types of errors in programming?

A
  1. Syntax error - using incorrect instructions and formatting.
  2. Runtime error - occur during execution and results from an illegal operation
  3. Logic error - a result of code that does not correctly solve the problem.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the process of converting binary numbers to their decimal equivalents?

A

Determine the place value of each bit (as a power of 2) and then sum all values

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

What is the process of converting a decimal number to its binary equivalent?

A

Moving from left to right, “fill up” the binary values as much as possible for each place value.

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

How many unique values can be stored in a byte?

A
  • A byte is 8 bits, so 2 × 2 × 2 × … = 2⁸ = 256 unique values.
  • For an unsigned integer, theses are the numbers fom 0 to 255 inclusive.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How does the hexadecimal number system work?

A
  • Hexadecimal is base-16, which means it has the digits 0-9 and then continues from A to F, before “rolling over” to 10.
  • The place value of a hexadecimal number is a power of 16.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the process of converting a binary number to its hexadecimal equivalent?

A

Each group of 4 bits corresponds to a single hexadecimal digit, so just join them together.

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

How does the 2s complement system represent negative numbers?

A
  • The highest bit of the number takes on a negative value.
  • This means that the range of values a signed byte can take on is -128 to 127 inclusive.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

How does the ASCII system work to represent characters?

A
  • Each character is represented by 7 bits, resulting in 2⁷ = 128 possible characters.
  • Some of these characters are non-printable “control characters”.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

How does the Unicode system work to represent characters?

A

Unicode uses a variable number of bits for each character, allowing it to represent a huge number of characters (≈150 000).

19
Q

How do bicimals (“binary decimals”) represent non-integer values?

A

Just like the decimal number system, every value after the decimal point (more generally called the radix point) is a decreasing power of two.

20
Q

How do most computers internally represent time?

A

As the number of seconds since the Unix epoch (1/1/1970).

You don’t need to know the exact date of the epoch.

21
Q

In the IEEE754 system for representing floating point numbers:
1. The first bit represents the sign
2. The next 8 bit represent the exponent, biased by 127
3. The remaining bits represent the mantissa.

Explain each of these aspects in further detail.

A
  1. If the first bit is 1, the number is negative.
  2. The encoded exponent is an unsigned byte - the true exponent is found by subtracting 127 from this number.
  3. The mantissa is “1.” followed by the bits in the mantissa.

See example attached.

22
Q

What are the 5 flowchart symbols?

A
  1. Terminator (begin/end) - rounded rectangle
  2. Process - rectangle
  3. Decision - diamond
  4. Input/output - parallelogram
  5. Subroutine - rectangle with tracks (“doubles tennis court”)
23
Q

Identify two reasons why pseudocode and flowcharts might be used to represent algorithms instead of simply coding the solution.

A
  1. The algorithm might be easier to understand since pseudocode rules are not as strict as programming languages, and flowcharts show a more visual representation of program flow.
  2. The algorithm might need to be implemented in different languages, or the developer might not know ahead of time which language it is going to be implemented in.
24
Q

What are the 4 control structures, used to control program flow.

A
  1. Sequence
  2. Decision (branching)
  3. Looping (iteration)
  4. Subroutines (functions)
25
Q

What is the main way that control structures in pseudocode differ from their implementation in Python?

A

Both pseudocode and Python use similar keywords for many control structures (e.g. if, else and while). However, pseudocode control structures come in pairs (opening and closing) while Python relies on indentation to indicate the end of a control structure.

26
Q

How are binary decisions represented in pseudocode and flowcharts?

A

Using keywords IF, ELSE and ENDIF

27
Q

What are the two ways that multiway decisions are represented in pseudocode and flowcharts?

A
  1. Using IF, ELSE IFs, and ENDIF
  2. Using CASEWHERE and END CASE.
28
Q

What are the two types of conditional loops in pseudocode and flowcharts?

A
  1. Pre-test loop
  2. Post-test loop
29
Q

How do counting loops work in pseudocode and how can they be implemented using flowcharts?

A

Using the for keyword, but not in the same way as in Python.

30
Q

What is a subroutine?

A

A named block of code that performs a particular operation. Might also be referred to as a subprogram, procedure or function.

Subroutines might use:
* parameters - information passed to the subroutine.
* return values - information passed back to the calling code.

31
Q

Why are subroutines used in code?

A
  1. For re-use: a subroutine can be called multiple times, often by different parts of the program.
  2. For more modular code: assisting with testing and maintaining.
32
Q

Compare and contrast the array and record data structures.

A

Arrays
* Items are accessed/modified using numerical indexes.
* In pseudocode, round brackets are used with indexes starting at 1.

Records
* Each item is associated with a key.
* “Dot-notation” is used to access/modify values.

In Python, arrays are implemented with the list data type and records with the dictionary data data type.

33
Q

Write a subroutine in pseudocode to print out all items in an array called Names.

A

This highlights that a counting loop should be used (or a while loop with extra steps), that indexes start at 1, and that the length of an array is not found with a dedicated function like len() in Python.

34
Q

Write a subroutine in pseudocode to print out all values in a record.

A

Trick question! There is no way to do this in pseudocode, you need to know each individual key to access the corresponding value (using “dot-notation”).

35
Q

What is a structure chart used for?

A

A structure chart is used to model the hierarchy of modules/subroutines or processes within a system (from top-down), together with the movement of data between subroutines and the order of their execution (from left to right).

36
Q

What symbols are used in a structure chart?

A
37
Q

What is a desk check?

A

A manual process to track the values of variables and output through the execution of an algorithm. It is set out as a table with a column for each variable. Each time a variable’s value is modified, its new value is updated in the table.

Conditions and their results are also optional columns in the table and may assist in understanding algorithms with complex conditions (e.g. in loops).

38
Q

What are boundary values?

A

Boundary values are on the limit of comparisons in code. It is essential to include boundary values when testing algorithms.

39
Q

What is path coverage?

A

Refers to choosing test data that ensure that all pathways through an algorithm are followed.

40
Q

What test data should be chosen when testing algorithms?

A
  • Above and below boundary values
  • Boundary values
  • Unexpected inputs
41
Q

What is recursion?

A

A programming technique where a function calls itself. It is often used in backtracking and divide-and-conquer approaches, and is a key component in functional programming.

42
Q

What is backtracking?

A

A problem solving technique that involves systematically exploring different options to solve a problem.

Two examples investigated in class were the N-queens problem and the Sudoku puzzle.

43
Q

What is the divide and conquer approach?

A

A problem solving approach that consists of the following 3 stages:
1. Progressively breaks down a complex problem into smaller, more manageable subproblems.
2. Solves each of these subproblems independently.
3. Combines the subsolutions to obtain the final solution.

In class, we looked at the Merge sort algorithm as an example of a divide and conquer approach.

44
Q

What are the key aspects of each of the 4 programming paradigms covered in class?

A
  1. Imperative - variables and functions are separate.
  2. Object-oriented - functionality and data are combined into objects.
  3. Functional - Only pure functions are used (no side effects), new variables can be created but not changed.
  4. Logic - data is represented as facts and rules using formal logic which can then be queried.