---
title: "Midterm Exam"
subtitle: "Computing in Molecular Biology 1"
author: "WRITE YOUR NAME HERE"
date: "2nd November 2016"
output:
  html_document:
    self_contained: no
---

At the course homepage you will find an *Rmarkdown* template. Please use it and send your answers by email to me.

Change the name of the `.Rmd` file to your email address. Change "`@`" by "`.`" and avoid spaces. Example: if your email is "`name@gmail.com`" then the file should be "`name.gmail.com.Rmd`".

Open the file on *Rstudio* and edit it. You should be able to **Knit HTML** and get the same results as this document. You may need to install `rmarkdown` using the *Install* button on the *Packages* window.

**All answers are strictly personal. Any failure on doing so will be maximally penalized.**

1. **(10%)** Please answer the following questions:
	+ Why we study computing in molecular biology?

    > REPLACE THIS TEXT WITH YOUR ANSWER

	+ What is a *computer*? what are computers useful for?

    > REPLACE THIS TEXT WITH YOUR ANSWER

	+ What are the parts of a computer?

    > REPLACE THIS TEXT WITH YOUR ANSWER

	+ How do computers represent information?

    > REPLACE THIS TEXT WITH YOUR ANSWER

	+ What is a *prompt*? What is the interpretation?

    > REPLACE THIS TEXT WITH YOUR ANSWER

2. **(10%)** Please answer the following questions:
	+ What is the *natural way* to represent text in a computer?
Can you use *Microsoft Word* for scientific computing?

    > REPLACE THIS TEXT WITH YOUR ANSWER

	+ What are the advantages of *Markdown* as a way to represent documents?

    > REPLACE THIS TEXT WITH YOUR ANSWER

3. **(10%)** Please answer the following questions:
    + What are the units to measure the size of data in the computer memory?

    > REPLACE THIS TEXT WITH YOUR ANSWER

    + How much memory do you need to store a 12 megapixels picture, not compressed and greyscale

    > REPLACE THIS TEXT WITH YOUR ANSWER

    + How much memory do you need to store 10 minutes of low quality audio sampled 8000 times per second with 8 bits per sample?

    > REPLACE THIS TEXT WITH YOUR ANSWER

    + How much memory do you need to store 10 minutes of high quality **stereo** audio sampled 44100 times per second with 16 bits per sample?

    > REPLACE THIS TEXT WITH YOUR ANSWER

4. **(10%)** Please answer the following questions:
	+ Which are the basic *data types in R*?

    > REPLACE THIS TEXT WITH YOUR ANSWER

	+ What is the meaning of `NA`? Why it is useful?

    > REPLACE THIS TEXT WITH YOUR ANSWER

	+ What types of data can be used as indices of vectors in R? What are the advantages of each one?

    > REPLACE THIS TEXT WITH YOUR ANSWER

5. **(15%)** Please answer the following questions:
	+ What is the difference between a *vector* and a *matrix* in R?

    > REPLACE THIS TEXT WITH YOUR ANSWER

	+ What is the difference between a *vector* and a *list* in R?

    > REPLACE THIS TEXT WITH YOUR ANSWER

	+ What is the difference between a *list* and a *data frame* in R?

    > REPLACE THIS TEXT WITH YOUR ANSWER

	+ What is the difference between a *matrix* and *data frame* in R?

    > REPLACE THIS TEXT WITH YOUR ANSWER


6. **(15%)** Write R commands to produce this output
```{r q6a}
# replace this line with your code
```

```{r q6b}
# replace this line with your code
```

```{r q6c}
# replace this line with your code
```

```{r q6d}
# replace this line with your code
```

```{r q6e}
# replace this line with your code
```

7. **(15%)** Write an R command to create the variable `x` with this content:
```{r q7a}
# complete this code
x <- list()
x
```
Using the same variable `x`, write the commands to produce this output
```{r q7b}
# replace this line with your code
```

```{r q7c}
# replace this line with your code
```

```{r q7d}
# replace this line with your code
```

8. **(15%)** Your computer has already a `longley` data frame with some macroeconomic values.

    Write an R command to get the values for the 3rd row
```{r q8a}
# replace this line with your code
```
Write an R command to get the values of GNP
```{r q8b}
# replace this line with your code
```
Write an R command to get the ywars where `Armed.Forces` was over 300
```{r q8c}
# replace this line with your code
```
