Final Exam Flashcards

1
Q

Given a pair of sequences of the same length, write a function that counts how many of the letters in the sequences match. For example, if we have the following sequences:

ACCTG
ATCGG

A

def countMatches(str1, str2):
count = 0
for i in range(str1):
if str1[i] == str2[i]:
count += 1
return count

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

Symmetric Encryption

A

Also known as private key encryption – uses a single key to encrypt and decrypt a message. Used when one party is encrypting his/her own information or when sender and receiver of a message are able to secretly share the key.

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

Asymmetric Encryption

A

Also known as public key encryption – uses two keys. The public key encrypts the message and the private key decrypts the message. Used when sender and receiver are not able to secretly share a key.

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

Using the Shortest Job First (SJF) algorithm, and assuming that the processes are represented as [ProcessID, Execution Time], show the scheduling order of the following processes:

[P1, 6]
[P2, 7]
[P3, 3]
[P4, 3]
[P5, 4]

A

Time Executing Process
0 P3
1 P3
2 P3
3 P4
4 P4
5 P4
6 P5
7 P5
8 P5
9 P5
10 P1
11 P1
12 P1
13 P1
14 P1
15 P1
16 P2
17 P2
18 P2
19 P2
20 P2
21 P2
22 P2

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

What is deadlock? What are 3 ways to prevent deadlock?

A

-Deadlock: Deadlock occurs when two or more processes are each holding a resource that the another process needs and none are willing to release the resources they have.
-You can prevent deadlock by:
-Having processes time out if they wait too long and then request resources again after waiting a random amount of time
-Requiring that processes request resources in a specified order
-Requiring that process request all resources they need and do not lock any resources unless they can get all.

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

What are 3 things that make the digital signature algorithm useful in an investigation?

A
  1. Produces a signature that is significantly smaller than the original data
  2. Always produces the same result on the same input
  3. Always produces different result on different input (avoids collisions)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Python function that searches a given list of employee IDs for a specific ID, and returns the name of the employee with that ID. If the list of IDs you were searching through was sorted from lowest to highest, what algorithm might be used?

A

If the list of IDs were sorted, we could use a binary search.

This solution would be better because binary search is a more efficient algorithm – it does not need to consider every ID in the list.

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

What is a potential worst case input for an algorithm that searches through a list?

A

if the item is not found in the list

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

Describe two kinds of algorithms that are developed by computer scientists in the field of bioinformatics.

A

-Dot plot for visualization of similarities between sequences
-Alignment algorithm for determining the optimal alignment between a pair of sequences

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

Given the following two sequences of nucleotides, show all of the possible ways that they can be aligned if 2 gaps are inserted in the second sequence? Assuming a +1 for a match, 0 for a gap and –1 for a mismatch, which alignment is best?

CGTTCA
ACTG

A

–ACTG Score = -4
-A-CTG Score = -4
-AC-TG Score = -4
-ACT-G Score = -2
-ACTG- Score = -2 Optimal
A–CTG Score = -4
A-C-TG Score = -4
A-CT-G Score = -2 Optimal
A-CTG- Score = -2 Optimal
AC–TG Score = -4
AC-T-G Score = -2 Optimal
AC-TG- Score = -2 Optimal
ACT–G Score = -2 Optimal
ACT-G- Score = -2 Optimal
ACTG– Score = -2 Optimal

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