Chapter 3 Flashcards

1
Q

What is a Txt File

A

A structured file that contains characters of readable data

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

What are txt files commonly used for?

A

for storing small amounts of data

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

What are CSV Files?

A

A type of text file in which the elements are separated by a comma

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

What are the advantages of using CSV Files?

A

1) They allow for the storage of 2D Arrays in a more structured, readable format
2) Very useful in storing small amounts of data

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

Disadvantages of using CSV Files

A

1) Not efficient for large sets of data -> can be slow
2) Not secure, as anyone who opens the files can read its contents, which is why they are not commonly used to store sensitive data

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

What are XML Files?

A

Extensive Markup language is a method of encoding data in a file into a format that can be easily readable by both humans and the computer

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

Advantages of XML Files

A

1) Highly readable (esp by humans)
2) Makes it easier to store and transport data within, and between systems
3) The format itself defines the data and how it is structured
4) The tags (fields) can be in a different order in each record
5) The records can have different fields within them

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

Key difference between HTML and XML files

A

XML Files use pre-defined tags, created by the user.

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

When a solution needs to store array values or a record, what file type should be most used?

A

CSV. However you have to consider that:

1) The number of fields must be constant for each record

2) When writing or reading to a CSV File, the order of the fields needs to be hardcoded

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

What is Linear search and how does it work?

A

You start from the beginning of a list and go through each element one by one until you find the target element or reach the end of the list.

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

Advantages/Disadantages of Linear search

A

Advantages:
- Simple and easy to implement.
- Works on unsorted data.
Disadvantages:
- Inefficient for large datasets

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

What is Binary search and how does it work?

A

It repeatedly divides the array in half by comparing the middle element with the target value. This process continues until the element is found or the interval is empty.

DIVIDE AND DISCARD ALGORITHM RECURSIVELY, order of log N

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

Advantages/Disadantages of Binary search

A

Advantages:
- Suitable for large sets

Disadvantages:
- Requires data to be sorted.
- Implementation can be more complex compared to linear search.

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

What is selection sort?

A

Selection sort divides the list into two parts: a sorted and an unsorted array. It repeatedly selects the smallest (or largest) element from the unsorted part and moves it to the end of the sorted part.

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

What is quick sort?

A

Quick sort is a divide-and-conquer algorithm that selects a “pivot” element and partitions the array into two subarrays: elements less than the pivot and elements greater than the pivot. It then recursively sorts the subarrays.

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

What is stack overflow?

A

a circular reference in the program quickly fills up the stack causing a program
crash.

17
Q

What is memory leak?

A

when a program uses more memory than was allocated

18
Q

What is SELECTION SORT (REAL)

A

Examines each item in the array and finds the smallest one. Once the smallest element is found it is swapped with the item at the start of the array. This process is repeated with the subsequent item in the array