Question 1(a)

gene1= "ATCGTCCA"
gene2= "CGT"
gene1
## [1] "ATCGTCCA"
gene2
## [1] "CGT"

Question (b)

concatenation

combined = paste(gene1, gene2, sep = "")
combined
## [1] "ATCGTCCACGT"

Question 1(c)

Substring

substr(gene1, start = 2, stop = 5)
## [1] "TCGT"

Question 1(d)

Does pattern of gene2 exists in gene1?

grepl(gene2, gene1)
## [1] TRUE

Since the pattern matches, finding out the index

matches= gregexpr(gene2, gene1)

matches = unlist(matches)

matches
## [1] 3

Question 2

p= 21
q= 5
add= p+q
add
## [1] 26
substract= p-q
substract
## [1] 16
multiply= p*q
multiply
## [1] 105
divide= p/q
divide
## [1] 4.2
power= p^q
power
## [1] 4084101
modulo= p%%q
modulo
## [1] 1