Comprehensive Multiple Choice Quiz.pdf

Full Transcript

### Comprehensive Multiple Choice Quiz #### Section 1: Basic R Programming Theoretical Questions 1. **Question:** What function in R is used to combine multiple elements into a vector? - A) `c()` - B) `combine()` - C) `concat()` - D) `vector()` **Answer:** A) `c()` 2. **Question:** Whic...

### Comprehensive Multiple Choice Quiz #### Section 1: Basic R Programming Theoretical Questions 1. **Question:** What function in R is used to combine multiple elements into a vector? - A) `c()` - B) `combine()` - C) `concat()` - D) `vector()` **Answer:** A) `c()` 2. **Question:** Which function in R creates a sequence of numbers? - A) `seq()` - B) `sequence()` - C) `range()` - D) `series()` **Answer:** A) `seq()` 3. **Question:** How do you read a CSV file into R? - A) `read.csv(file)` - B) `readFile(file)` - C) `open.csv(file)` - D) `load.csv(file)` **Answer:** A) `read.csv(file)` 4. **Question:** What function is used to install packages in R? - A) `install()` - B) `install.packages()` - C) `load.packages()` - D) `library()` **Answer:** B) `install.packages()` 5. **Question:** Which function in R returns the structure of an object? - A) `summary()` - B) `structure()` - C) `str()` - D) `info()` **Answer:** C) `str()` 6. **Question:** How do you create a data frame in R? - A) `data.frame()` - B) `data()` - C) `frame()` - D) `df()` **Answer:** A) `data.frame()` 7. **Question:** What does the function `mean(x, na.rm=TRUE)` do in R? - A) Calculates the mean of `x` including `NA` values. - B) Removes `NA` values from `x`. - C) Calculates the mean of `x` ignoring `NA` values. - D) Returns `NA` if there are any `NA` values in `x`. **Answer:** C) Calculates the mean of `x` ignoring `NA` values. 8. **Question:** How do you check the type of a variable in R? - A) `typeof()` - B) `class()` - C) `type()` - D) `var()` **Answer:** B) `class()` 9. **Question:** Which function would you use to combine data frames by rows? - A) `cbind()` - B) `rbind()` - C) `bind_rows()` - D) `merge()` **Answer:** B) `rbind()` 10. **Question:** How can you remove a variable from the workspace in R? - A) `delete(var)` - B) `remove(var)` - C) `rm(var)` - D) `clear(var)` **Answer:** C) `rm(var)` #### Section 2: Linux Theoretical Questions 11. **Question:** Which command lists all files, including hidden ones, in a directory? - A) `ls` - B) `ls -a` - C) `ls -l` - D) `ls -al` **Answer:** D) `ls -al` 12. **Question:** What is the command to change the permissions of a file? - A) `chmod` - B) `chperm` - C) `chown` - D) `perm` **Answer:** A) `chmod` 13. **Question:** How do you display the contents of a file in Linux? - A) `cat` - B) `show` - C) `display` - D) `open` **Answer:** A) `cat` 14. **Question:** What command is used to find patterns in files? - A) `find` - B) `search` - C) `grep` - D) `pattern` **Answer:** C) `grep` 15. **Question:** How do you check the current directory you are in? - A) `dir` - B) `pwd` - C) `cd` - D) `ls` **Answer:** B) `pwd` 16. **Question:** Which command in Linux is used to move or rename a file? - A) `mv` - B) `rename` - C) `move` - D) `rm` **Answer:** A) `mv` 17. **Question:** How do you create a new directory in Linux? - A) `mkdir` - B) `newdir` - C) `createdir` - D) `dircreate` **Answer:** A) `mkdir` 18. **Question:** What does the `chmod 755` command do? - A) Sets the file's permissions to read, write, and execute for all users. - B) Sets the file's permissions to read, write, and execute for the owner, and read and execute for others. - C) Sets the file's permissions to read and write for the owner, and execute for others. - D) Removes all permissions from the file. **Answer:** B) Sets the file's permissions to read, write, and execute for the owner, and read and execute for others. 19. **Question:** How can you find the manual page for a specific command in Linux? - A) `man` - B) `help` - C) `info` - D) `guide` **Answer:** A) `man` 20. **Question:** What is the purpose of the `ps` command in Linux? - A) To list all processes currently running. - B) To list all files in a directory. - C) To print the system's path. - D) To display system information. **Answer:** A) To list all processes currently running. #### Section 3: Git Theoretical Questions 21. **Question:** What command do you use to initialize a new Git repository? - A) `git start` - B) `git init` - C) `git new` - D) `git create` **Answer:** B) `git init` 22. **Question:** How do you clone a repository from GitHub? - A) `git clone url` - B) `git copy url` - C) `git fetch url` - D) `git pull url` **Answer:** A) `git clone url` 23. **Question:** What command stages changes for the next commit? - A) `git stage` - B) `git add` - C) `git commit` - D) `git push` **Answer:** B) `git add` 24. **Question:** How do you view the commit history in Git? - A) `git history` - B) `git log` - C) `git commits` - D) `git list` **Answer:** B) `git log` 25. **Question:** Which command creates a new branch in Git? - A) `git branch new_branch` - B) `git create new_branch` - C) `git new new_branch` - D) `git checkout new_branch` **Answer:** A) `git branch new_branch` 26. **Question:** What is the purpose of the `git pull` command? - A) To fetch and merge changes from the remote repository to the local repository. - B) To push changes from the local repository to the remote repository. - C) To initialize a new repository. - D) To delete a branch. **Answer:** A) To fetch and merge changes from the remote repository to the local repository. 27. **Question:** How do you permanently delete a file from the Git repository and the filesystem? - A) `git delete` - B) `git remove` - C) `git rm` - D) `git erase` **Answer:** C) `git rm` 28. **Question:** What command would you use to see the differences between the working directory and the staging area in Git? - A) `git diff` - B) `git status` - C) `git log` - D) `git show` **Answer:** A) `git diff` 29. **Question:** Which command undoes the last commit while keeping the changes in the working directory? - A) `git revert` - B) `git reset --soft HEAD~1` - C) `git reset --hard HEAD~1` - D) `git checkout HEAD~1` **Answer:** B) `git reset --soft HEAD~1` 30. **Question:** How do you create a tag in Git? - A) `git create tag` - B) `git new tag` - C) `git add tag` - D) `git tag` **Answer:** D) `git tag` #### Section 4: Simple Code Debugging Questions 31. **Question:** What is wrong with the following R code that tries to calculate the mean of a vector? ```r data

Use Quizgecko on...
Browser
Browser