Multiple Choice Question for Basics of R
Dear Readers,
Today we will go through multiple choice question for basics of R.
Introduction about R
R is the open source scripting language used for statistical computing and the building of graphs.
It provides various facilities like data manipulation, calculation and graphical display.
Why is it named as R?
It is the initial of first two authors Robert Gentleman and Ross Ihaka.
IDE’s used in R
RStudio, Microsoft R Tools for Visual Studio, R Analytic Flow, TinnR, Jupyter. All of these are free software.
R is used widely for analysis. Many of the software and visualization tools are having plugins for R like eclipse, Tableau.
CRAN: Comprehensive R Archive Network is collection of sites which carry identical material, consisting of R distribution(s).
- What is the function can be used convert data into list format?
- lapply()
- list()
- list()
- both b and c
ANS:-B
- table() is used for
- to convert data into data frame
- to convert data frame into database table format
- to find out categorical data with count
- none of the above
ANS:-C
- Which of the following is valid for checking categorical variable?
- Level
- Table
- Unique
- All of the above
ANS:-D
For Free, Demo classes Call: 8237077325
Registration Link: Click Here!
- Suppose ABC is the matrix of 3 rows and 2 columns. Choose correct option(s) to rename columns:
- Column_names(ABC)= c(“col1”,”col2”,”col3”)
- colnames(ABC)=c(“col1”,”col2”)
- columns(ABC)=c(“col1”,”col2”)
- colnames(ABC)=c(“col1”,”col2”,”col3”)
ANS:- B
- Suppose ABC is the matrix of 3 rows and 4 columns. Choose correct option(s) to rename columns:
- row_names(ABC)= c(“row1”,”row2”,”row3”)
- rownames(ABC)=c(“row1”,”row2”)
- row(ABC)=c(“row1”,”row2”)
- rownames(ABC)=c(“row”,”row2”,”row3”)
ANS:- D
- Arrange in proper order of data type:
- Logical, integer, numeric, character
- Integer, numeric, character, logical
- Character, logical, integer, numeric
- Numeric, integer, character, logical
ANS:- A
- What is the output of below code:
A=10
B=20
print(A,B)
- 10 20
- Error
- (10, 20)
- None of the above
ANS: B
- State if True or False:
Return statement is compulsory while writing function in R
- True
- False
ANS: False
- State if True or False:
Last variable in function is by default return variable in R
- True
- False
ANS: True
- What package is need to be install for reading
- Read_excel
- Readxl
- Readcsv
- read_csv
ANS: B
- what is the output of below mentioned code?
logic1=c(T,F,F,T,F,T)
print(which (logic))
- 1 4 6
- 2 3 6
- 6 4 1
- 1 2 3
ANS: A
- What will be a, if a = seq (100,to = 1000, by = 20)
- [100, 200, 400, …., 1000]
- [100, 120, 140, …., 980, 1000]
- [20, 120 ,220, …., 1000 ]
- None of the above
ANS: B
- If A = c (1, 13, 42, 13, 4) then what is A = A [ -4 ]?
- 1, 13, 42, 4
- 1, 13, 42, 13
- 13
- 1, 42, 13, 4
ANS: A
- name = “Navin, Mr. Naresh J”
what function can be used to split the string?
Output will be : “Navin” “Mr. Naresh J”
- strsplit(name,”[.]”)
- charsplit(name,”[,]”)
- stringsplit(name)
- strsplit(name,”[,]”)
ANS: D
- i=100 , how to find out data type of i
- type(i)
- type(i)
- class(i)
- none of the above
ANS: C
- Which of the following is true:
- readxl is used to read csv files
- readexcel package is used to read excel files
- readxl is used to read excel files
- both a and c
ANS: C
- If B is the data frame, how can we find out columns wise null values?
- colSums ( is.na ( B ) )
- null ( B ).sum
- na ( B )
- Both a and c
ANS: A
- What is the function used to find current date in R?
- Sysdate()
- Date()
- Now()
- All of the above
ANS: B
For Free, Demo classes Call: 8237077325
Registration Link: Click Here!
- Dt = “01-12-2020” is in the form of character. What is the option to convert date into “MM-DD-YYYY”
- To_date (dt, ”MM – DD – YYYY”)
- date( x = dt, format = “%m / %d / %Y”)
- Date ( x = dt, format = “%m / %d / %Y”)
- none of the above
ANS: C
- P is the boxplot for the data. How to find outlier from boxplot
- P$outlier
- P$whiskers
- P$box
- P$out
ANS: D
- From the above P box plot, find the odd one out about P$stats:
- It gives information about minimum value, 25 %, median, 75 %, maximum value
- It gives information about Q1, IQR, Q3
- It gives information about minimum value, 25 %, mean , 75 %, maximum value
- Outliers can be defined by Q1 -1.5*IQR
ANS: C
- Choose correct options to create two plots in plotting region
- Subplot(2,1)
- par(mfrow = c(1,2))
- par(mfrow = c(2,1))
- Subplot(1,2)
ANS: B,C
- Find odd one out:
- Bar plot
- Scatter plot
- Pie chart
- Box plot
ANS: D. As box plot is uni-variate graph
- True or False:
It is mandatory to have numeric data type to find correlation between two variables.
- True
- False
ANS: A
- Which function can be used to convert lowercase to uppercase
- upper()
- upper()
- toupper()
- to_upper()
ANS: C
- df1 and df2 are two different data frames. How to club two different data frames based on columns
- rbind(df1,df2)
- cbind(df1,df2)
- ncols(df1,df2)
- colbind(df1,df2)
ANS: B
- df1 <- data.frame(x = 1:4, y = c(‘a’, ‘b’, ‘c’))
- This code will create the data frame of 4 rows and 2 columns
- Data frame is having 2 rows and four columns
- Syntax error
- None of the above
ANS : C
- What will be the output for below mentioned code:
list_data <- list (c ( “One”, “Two”, “Three” ), matrix ( c (3, 10, 15, 14, -2, 18), nrow = 2 ), list ( “green”, 12.3) )
- Syntax error for not matching dimensions.
- Create the list
- Create the dataframe
- None of the above
ANS: B
- Choose correct options
Find the length of two vectors:
Len_a = c (1, 2, 3, 4, NA, 5, 6 )
Len_b = c (1, 2, 3, 4, NULL, 5, 6)
- Length of Len_a is 7
- Length of Len_b is 7
- Length of Len_b is 6
- Length of Len_a is 6
ANS : A, C
- a = c (1 , 2 , 3 , 4 , NA , 5 , 6 )
b= 100
success = as.factor( c (“S” , ”F” , “S” , “S” , ”F” , “S” , “F” , “F” ) )
list (a, b, success) -> success1
what will be the output of success1 [ [ 3 ] ]
- Error: elements should have same dimensions
- Levels : F S
- S F S S F S F F
- Error: Index out of bound
ANS: B
For Free, Demo classes Call: 8237077325
Registration Link: Click Here!
- Find odd one out :
Summary of the data frame provide values like
- Mean
- Median
- 1st Quartile
- Mode
ANS: D
- What is the output of nchar ( “Count Words” ):
- 11
- 10
- 1
- 2
ANS: A
- What is the output of length( “Count Words” ):
- 1
- 11
- 2
- Error
ANS: A
- What is the function to remove NA values from the data frames
- omit()
- drop()
- remove()
- pop()
ANS: A
- a = “New World”
How to extract “New” from the given string a
- substr(a,1,3)
- substring(a,1,3)
- substr(a,0,2)
- substring(a,0,2)
ANS : B
- Find odd one out related to graph:
- v
- x-label
- ylab
- main
ANS: B
- If A = matrix (1:16 , 4 , 4)
Then what is A[2,3]?
- 9
- 8
- 7
- 10
ANS : D
- If A = matrix (1:16 , 4 , 4) then how can we get below mentioned matrix?
- A [ 3 : 4 , 1 : 4 ]
- A [- c ( 1 : 2 ), -c (2 , 3 ) ]
- A [ 3 : 4 , c ( 1 , 4 ) ]
- Both b and c
ANS: D
- Choose correct option(s)
- Setwd() is used set the path for saving R code.
- Setwd() is used to set the path for accessing the file.
- Both a and b
- None of the above
ANS: B
- A=10
B=15
How to display 10 < 15?
- print ( A “ < ” B )
- paste ( A + “ < ” + B )
- paste ( A , “ < ”, B )
- print ( A + “<” + B)
ANS: C
- find_val = c(“NEW”, “New Delhi”, “NEW Year”, “Happy New”)
What is the correct option to find out string that begins with “New”
- grep ( pattern = “^New” , x = find_val)
- sub ( pattern = “^New” , x = find_val)
- grep ( pattern = “New*” , x = find_val)
- grep ( pattern = “New^” , x = find_val)
ANS: A
- find_val = c(“abc val”, “val New Delhi val”, “NEW val Year”, “val Happy New”)
What is the output of the following code?
sub(pattern = “val”,replacement = “*”,x = find_val,ignore.case = T)
- “abc *” “* New Delhi *” “NEW * Year” “* Happy New”
- “* abc *” “* New Delhi val” “NEW * Year” “* Happy New”
- “abc *” “* New Delhi val” “NEW * Year” “* Happy New”
- Error
ANS : C
Author:
Helwade, Amrita
Designation: Software Trainer
Company: Seven Mentor Pvt. Ltd.
Call the Trainer and Book your free demo Class for now!!!
© Copyright 2019 | Sevenmentor Pvt Ltd.