you will find it most convenient to learn and use the tidyverse package.
it will give you access to syntax as follows:
New <- exam %>% mutate_all(as.numeric)
reproducible example :
#example dataframe
exam <- data.frame(a=c("1","2","3"),
b=c("4","5","6"),stringsAsFactors = FALSE)
library(tidyverse)
New <- exam %>% mutate_all(as.numeric)