Programming Flashcards

1
Q

Explain what a check digit mean.

A

It refers to extra digits added as part of a numeric data item (like a barcode or a stock number).
They are worked out from the other digits in a way that can be repeated, enabling the data to be checked at a later stage by working out the check digit again and comparing the results.

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

Explain what a checksum do.

A

Checksum is used to ensure that a block of data has been transferred within the system correctly. Extra words of data are added to a block that are worked out from the value of the data in the block. At later stages the checksum is worked out again, and compared with the original, to ensure that the data has not been corrupted at some stage in the system.

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

What leads to a Syntax Error?

A

It occurs either when program statements cannot be understood because they do not follow the rules laid down by the programming language, or when program structures are incorrectly nested.

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

What leads to a Logic Error?

A

This happens when there is an error in the planning of the program’s results. It is usually caused by not using control structures correctly or using an inappropriate formula. The system will not show an error as it will still run through, but the output is not the expected output.

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

What leads to a Run-Time Error?

A

This occurs when execution of the program has begun but external effects not catered by the program occurs, such as lack of memory or unusual data.

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

What is a static array?

A

Allocates the memory in a contiguous series of blocks. This is an inefficient use of memory as the memory is reserved regardless of whether it’s needed or not. This is because large memory size is initiated to ensure that it can hold all the data of the program. Memory allocation is fixed so there will be no memory overflow.

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

What is a dynamic array?

A

Allocate additional memory when is required, in disjointed pages, at random. This is an efficient use of memory as memory is allocated and released as and when required. However, memory might overflow if data structure is too large.

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

What is a free space list?

A

It is a linked list to connect unused/free nodes.

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

Steps for 2 child node deletion.

A
  1. Traverse down left sub tree to get the largest value at the left sub tree to act as the substitute node. Replace the value of the node to be deleted with the substitute node. Delete the substitute node.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the use of stacks in a recursive program.

A

When a procedure is called, a frame gets pushed onto the call stack as procedure data. When a recursive call happens, a new frame gets pushed onto the call stack and control is given over to the new frame. When the recursive completes, the frame is popped off the call stack and control is returned to the calling frame.

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

What is data verification?

A

It is to check that the data produced by the program matches the exact expected output. It is performed to ensure that the data entered exactly matches the original source and is not corrupted.

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

What are the advantages and disadvantages of a flowchart?

A

Advantages: Very easy to understand and learn to use.
DisadvantagesL It can be very lengthy for complex problems and it is difficult to alter when used for complex problem.

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

What are the advantages and disadvantages of psuedocode?

A

Advantages: Much more compact form of expression than Flowcharts. Easier to alter, especially when used for complex problems. Easier to convert into program code.
Disadvantages: More difficult to learn and understand than Flowcharts.

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

What are the advantages and disadvantages of decision table/trees?

A

Advantages: Concise description of logically complex situation. Easier to draw and change than flowcharts.
Disadvantages: Large decision tables can become incomprehensible and difficult to modify. More difficult to understand than Flowcharts.

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

What are the benefits of using BST over hashtable?

A

We can get all keys in sorted order by just doing Inorder Traversal of BST. This is not a natural operation in Hash Tables and requires extra efforts.
With Self-Balancing BSTs, all operations are guaranteed to work in O(Logn) time. But with Hashing, Θ(1) is average time and some
particular operations

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