Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

51.

______is used to view all packages installed.(a) library()(b) search()(c) .libPaths()(d) stringr()I have been asked this question during an interview.This key question is from Packages in chapter Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer»

The CORRECT OPTION is (a) library()

EASIEST EXPLANATION: Both REQUIRE() and library() can load (strictly speaking, attach) an R package.

52.

Which of the following is uniform distribution?(a) dunif(x, min=0, max=1, log = FALSE)(b) punif(q, min=0, max=1, lower.tail = TRUE, log.p = FALSE)(c) qunif(p, min=0, max=1, lower.tail = TRUE, log.p = FALSE)(d) runif(n, min=0, max=1)This question was posed to me in an interview.My question comes from Commands in chapter Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer»

The correct answer is (a) dunif(x, MIN=0, max=1, log = FALSE)

EXPLANATION: These functions provide information about the uniform DISTRIBUTION on the interval from min to max.

53.

Which of the following sort a dataframe by the order of the elements in B?(a) x[rev(order(x$B)),](b) x[ordersort(x$B),](c) x[order(x$B),](d) x[rev(x$B),]The question was posed to me in a job interview.Question is from Commands topic in section Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer»

Correct OPTION is (a) x[rev(order(x$B)),]

To ELABORATE: x[rev(order(x$B)),] SORT the dataframe in REVERSE order.

54.

_________ involves predicting a response with meaningful magnitude, such as quantity sold, stock price, or return on investment.(a) Regression(b) Summarization(c) Clustering(d) ClassificationThe question was asked during an interview for a job.I need to ask this question from Predictive Analytics in chapter Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer»

Right ANSWER is (a) Regression

To explain I would say: Regression and CLASSIFICATION are TWO COMMON TYPES predictive models.

55.

The purpose of fisher.test() is _______ test for contingency table.(a) Chisq(b) Fisher(c) Prop(d) StemThe question was asked during an online exam.My doubt is from Visualizing Data in division Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer» CORRECT answer is (B) Fisher

Explanation: prop.test() is used to INFERENCE for 1 proportion using normal approx.
56.

Which of the following syntax is used to install forecast package?(a) install.pack(“forecast”)(b) install.packages(“cast”)(c) install.packages(“forecast”)(d) install.pack(“forecastcast”)The question was posed to me in a national level competition.My question is based upon Packages in division Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer»

Right choice is (c) install.packages(“FORECAST”)

The EXPLANATION is: forecast is used for TIME SERIES analysis.

57.

________ provides needed string operators in R.(a) str(b) forecast(c) stringr(d) sqldfI got this question during an online interview.This interesting question is from Packages topic in section Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer» RIGHT choice is (c) stringr

For EXPLANATION: stringr is remarkably EASY to use.
58.

Which of the following function is used for plotting histogram?(a) hist()(b) histog()(c) histg()(d) histo()The question was posed to me in a national level competition.I need to ask this question from Commands in portion Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer»

Correct ANSWER is (a) hist()

Easiest EXPLANATION: The generic function hist COMPUTES a histogram of the given data values.

59.

Which of the following statement find cases with no missing values?(a) complete

Answer»

Right OPTION is (a) complete<-subset(data.df,complete.cases(data.df)

To explain: new <- OLD[n1:N2,N3:n4] select the n1 through n2 rows of VARIABLES n3 through n4.

60.

________ is a simple approach to supervised learning. It assumes that the dependence of Y on X1, X2, . . . Xp is linear.(a) Linear regression(b) Logistic regression(c) Gradient Descent(d) Greedy algorithmsI have been asked this question in class test.This key question is from Linear Regression topic in section Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer» RIGHT option is (a) Linear regression

For explanation I would SAY: Linear regression is a simple approach to SUPERVISED learning. It assumes that the dependence of Y on X1, X2, . . . Xp is linear. linear regression is an incredibly POWERFUL tool for ANALYSING data.
61.

Which of the following is called a one-line description of the package?(a) Function(b) Title(c) Interface(d) ClassThis question was posed to me in class test.The question is from Packages topic in chapter Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer»

The correct option is (b) Title

The best I can explain: Title is a one-line description of the PACKAGE, and is OFTEN ALSO shown in package listing. It should be plain text, capitalised like a title, and NOT END in a PERIOD.

62.

________ contains tools for Approximate Bayesian Computation (ABC).(a) str(b) abc(c) zyz(d) yxqThe question was posed to me in examination.My doubt is from Packages topic in section Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer»

Correct answer is (b) ABC

Easy explanation: The package IMPLEMENTS several ABC ALGORITHMS for performing parameter ESTIMATION and MODEL selection.

63.

______let’s you perform SQL queries on your R data frames.(a) sqldf(b) plyr(c) forecast(d) daplyI had been asked this question in an online interview.I'd like to ask this question from Packages in chapter Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer»

Right choice is (B) plyr

To elaborate: sqldf uses SQLITE syntax. Plyr will split-apply-combine PARADIGM for R. Forecast is a generic function for forecasting from time series or time series MODELS. The function invokes particular methods which depend on the class of the first argument.

64.

Which of the following is used to plot multiple histograms?(a) multi.plot()(b) multi.hist(c) xyplot.multi()(d) poly()I got this question in an internship interview.The question is from Linear Regression topic in chapter Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer»

The correct option is (B) multi.hist

Best EXPLANATION: A histogram is a graphical REPRESENTATION of the distribution of NUMERICAL DATA.

65.

__________ is proprietary tool for predictive analytics.(a) R(b) SAS(c) SSAS(d) EDRThis question was posed to me during an online exam.Origin of the question is Predictive Analytics topic in division Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer»

The correct OPTION is (B) SAS

For explanation I would say: SAS (STATISTICAL Analysis System) is a software suite DEVELOPED by SAS INSTITUTE for advanced analytics.

66.

________ function carries out a chi-square test.(a) chisq.test()(b) t.test()(c) prop.test()(d) fisher.test()The question was posed to me by my school teacher while I was bunking the class.This interesting question is from Visualizing Data topic in chapter Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer» RIGHT answer is (a) chisq.test()

Easiest explanation: prop.test() is USED to inference for 1 PROPORTION using NORMAL approx.
67.

Which of the following function cross-tabulate tables using formulas?(a) table(b) stem(c) xtabs(d) readI had been asked this question in exam.I need to ask this question from Visualizing Data in portion Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer» RIGHT CHOICE is (d) read

Explanation: table() list all VALUES of a variable with FREQUENCIES.
68.

_____ package version is the sequence of atleast two integers separated by either. or -.(a) Java(b) C(c) R(d) PythonThis question was posed to me in an online quiz.This question is from Packages in chapter Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer»

The correct ANSWER is (C) R

For explanation: R package version is the SEQUENCE of atleast two integers SEPARATED by either. or -. When you first start writing packages, you’ll mostly use these metadata to record what packages are needed to RUN your package.

69.

______ is used for Visualisation, verification and calibration of ternary probabilistic forecasts.(a) toss(b) termstrc(c) ternvis(d) satinI got this question by my school teacher while I was bunking the class.My question comes from Packages topic in chapter Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer»

Correct CHOICE is (C) ternvis

Easiest EXPLANATION: TESS is USED for faster simulation of reconstructed phylogenetic trees under time-dependent birth-death processes.

70.

__________ is used for the analysis of air pollution data.(a) air(b) openair(c) opena(d) openaraThe question was asked during a job interview.I would like to ask this question from Packages topic in section Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer»

Correct CHOICE is (B) openair

Explanation: Data are TYPICALLY hourly time SERIES and both monitoring data and DISPERSION model output can be analysed.

71.

________ performs class prediction based on microarray data and clinical parameters(a) M3(b) M2(c) MAclinical(d) M5This question was addressed to me in exam.This key question is from Packages in portion Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer» RIGHT OPTION is (b) M2

Explanation: M3 is used for READING M3 files.
72.

______ finds K best paths in a given graph.(a) kBestShortestPaths(b) kcirt(c) ktrees(d) kmapThe question was posed to me in an online interview.Asked question is from Packages topic in portion Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer»

The correct OPTION is (a) kBestShortestPaths

The EXPLANATION is: This package provides some ROUTINES to conduct the K-adaptive partitioning (kaps) and recursive partitioning (lrtree) for SURVIVAL DATA.

73.

______ specializes in converting data from wide to long format.(a) gcc(b) reshape(c) reshape2(d) gcc2The question was posed to me by my college professor while I was bunking the class.Asked question is from Packages in division Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer»

The CORRECT CHOICE is (C) RESHAPE2

The EXPLANATION: reshape2 is used in conjunction with ggplot2 and plyr.

74.

Which of the following sets the size of the outer margins for the graph?(a) par(mfrow=c(nrow,mcol))(b) par(ask=TRUE)(c) par(omi=c(0,0,1,0) )(d) par(ask=False)The question was asked in an online interview.The above asked question is from Commands in portion Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer»

Correct choice is (C) par(omi=c(0,0,1,0) )

The BEST EXPLANATION: par can be used to SET or QUERY graphical parameters.

75.

Which of the following truncates real x to integers?(a) as.order(x)(b) as.integer(x)(c) as.numeric(x)(d) as.character(x)I have been asked this question in an interview for internship.The origin of the question is Commands topic in chapter Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer» CORRECT OPTION is (b) as.INTEGER(x)

To elaborate: as.integer for object of class truncates decimal part of image VALUES and then CONVERTS to type integer.
76.

Which of the following statement can read csv files?(a) read.table(filename,header=TRUE,sep=’,’)(b) read.csv(filename,header=TRUE,sep=’,’)(c) read.tab(filename,header=TRUE,sep=’,’)(d) read.tab(filename,header=False,sep=’,’)The question was asked in an interview.The doubt is from Commands in division Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer»

Correct option is (a) read.table(filename,header=TRUE,sep=’,’)

Best EXPLANATION: Each ROW of the table APPEARS as one LINE of the file.

77.

Which of the following convert a matrix of phi coefficients to polychoric correlations?(a) poly()(b) qline()(c) phi2poly(d) multi.plot()This question was addressed to me in final exam.Query is from Linear Regression in portion Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer»

Right answer is (c) phi2poly

Explanation: In statistics, POLYCHORIC CORRELATION is a technique for estimating the correlation between two theorized normally DISTRIBUTED CONTINUOUS LATENT variables, from two observed ordinal variables.

78.

___________ are the most commonly documented object.(a) Interface(b) Class(c) Functions(d) LibrariesThis question was addressed to me during an online interview.The question is from Packages in chapter Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer» CORRECT ANSWER is (c) Functions

The explanation is: Function is very most commonly documented object. The introduction block, most functions have three TAGS namely @param, @EXAMPLES and @return.
79.

To release a package to _____ you must pick a standard license.(a) R(b) CRAN(c) CRON(d) StudioI have been asked this question in an interview.Origin of the question is Packages in portion Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer»

The CORRECT answer is (b) CRAN

The best explanation: To release your PACKAGE to CRAN, you must pick a standard license. Otherwise, it’s difficult for CRAN to DETERMINE WHETHER or not it’s legal to distribute your package.

80.

________ is a package for parsing, applying, and manipulating data cleaning rules(a) edr(b) editrules(c) edrGraphicalTools(d) edrtoolsI got this question in an online interview.I would like to ask this question from Packages topic in division Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer»

Right option is (b) editrules

To elaborate: editrules is a PACKAGE for parsing, APPLYING, and manipulating DATA cleaning rules. EDRGRAPHICALTOOLS provides tools for dimension reduction METHODS.

81.

__________ is used for selecting regression transformations.(a) gac()(b) gpl()(c) avas()(d) ggc()I had been asked this question by my school principal while I was bunking the class.This is a very interesting question from Packages topic in portion Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer»

Correct OPTION is (c) avas()

Explanation: ace() and avas() both are USED for selecting REGRESSION TRANSFORMATIONS.

82.

______ is used to get library location in R.(a) library()(b) search()(c) .libPaths()(d) stringr()The question was posed to me in homework.The origin of the question is Packages in chapter Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer»

Right ANSWER is (C) .libPaths()

Easy explanation: libPaths() can ADD new paths to set of library trees searched.

83.

Which of the following may be used for linear regression?(a) X %*% Y(b) solve(A)(c) solve(A,B)(d) X $*$ YThe question was posed to me by my college professor while I was bunking the class.This is a very interesting question from Commands in chapter Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer»

The correct choice is (C) solve(A,B)

Easy explanation: solve(A,B) IMPLIES inverse of A * B.

84.

Which of the following statement read a tab or space delimited file?(a) read.table(filename,header=TRUE)(b) read.CSV(filename,header=TRUE)(c) read.table(filename,header=FALSE)(d) read.tableall(filename,header=TRUE)This question was posed to me in quiz.This intriguing question originated from Commands topic in division Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer»

Right ANSWER is (a) read.table(filename,header=TRUE)

The EXPLANATION is: read.csv and read.csv2 are IDENTICAL to read.table except for the defaults.

85.

In syntax of linear model lm(formula,data,..), data refers to ______(a) Matrix(b) Vector(c) Array(d) ListThis question was posed to me in an online quiz.My doubt is from Linear Regression topic in section Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer» CORRECT ANSWER is (b) Vector

To explain: Formula is just a symbol to show the RELATIONSHIP and is APPLIED on data which is a vector. In General, data.frame are used for data.
86.

Which of the following builds empirical cumulative distribution function?(a) ecdf()(b) cum(c) cumsum(d) lm()I got this question at a job interview.Query is from Visualizing Data topic in section Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer»

The CORRECT choice is (a) ecdf()

To ELABORATE: cumsum() is used to produce RUNNING TOTAL of values for input vector.

87.

Which of the following is used to view dataset in a spreadsheet-type format ?(a) Disp()(b) View()(c) Seq()(d) lm()I got this question in my homework.Question is taken from Visualizing Data in section Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer»

Right ANSWER is (B) View()

EASY explanation: seq() MAKE arithmetic progression vector.

88.

Which of the following compute proportions from a contingency table?(a) par()(b) prop.table()(c) anova()(d) mosaicplot()The question was asked in semester exam.My doubt stems from Visualizing Data topic in division Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer»

The correct CHOICE is (b) prop.table()

EXPLANATION: par() is USED toquery and edit GRAPHICAL SETTINGS.

89.

Which of the following is most important when releasing the package?(a) Versioning(b) Developing(c) Redundancy(d) FunctioningThe question was asked in exam.My doubt is from Packages topic in chapter Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer»

Right ANSWER is (a) VERSIONING

Explanation: Versioning is most important when you release your package. Usually, PEOPLE don’t have EXACTLY the same versions of packages INSTALLED that you do.

90.

To start with the new package in RStudio, double-click the pkgname.Rproj file that _______(a) Delete()(b) Create()(c) Run()(d) Exit()I have been asked this question in an interview for internship.This interesting question is from Packages in chapter Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer»

The correct choice is (B) CREATE()

To elaborate: To GET started with your new PACKAGE in RStudio, double-click the pkgname.Rproj file that create() just made. This will open a new RStudio project for your package. Projects are the way to develop packages.

91.

______ splits a data frame and results an array (hence the da). Hopefully you’re getting the idea here.(a) apply(b) daply(c) stats(d) plyrThis question was addressed to me in a national level competition.My query is from Packages topic in portion Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer»

The correct choice is (B) daply

Explanation: ddply splits a DATA FRAME and RETURNS a data frame.

92.

Which of the following statement finds the maximum for each column?(a) apply(x,2,max)(b) col.max(x)(c) which.min(x)(d) which.max(x)I had been asked this question during an interview for a job.Asked question is from Commands topic in chapter Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer»

The CORRECT answer is (a) apply(x,2,MAX)

The BEST I can explain: col.max(x) is another way to find which COLUMN has the maximum value for each row.

93.

Which of the following produces the variance covariance matrix?(a) sd(x, na.rm=TRUE)(b) mad(x, na.rm=TRUE)(c) fivenum(x, na.rm=TRUE)(d) var(x, na.rm=TRUE)The question was asked in my homework.My doubt stems from Commands in chapter Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer»

Correct answer is (d) VAR(x, na.rm=TRUE)

The BEST explanation: mad(x, na.rm=TRUE) gives median absolute deviation.var(y) instructs R to calculate the sample variance of Y. In other words it uses n-1 ‘degrees of freedom’, where n is the number of OBSERVATIONS in Y.sd(y) instructs R to return the sample standard deviation of y, USING n-1 degrees of freedom.

94.

_____ list the variables in the workspace.(a) rm(x)(b) rm(list=ls())(c) ls()(d) attach(mat)This question was addressed to me in semester exam.The doubt is from Commands topic in portion Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer»

Right answer is (c) LS()

For EXPLANATION I would SAY: rm(X) removes x from the workspace.

95.

Which of the following statement is another way to get a subset?(a) subsetcon(dataset,logical)(b) data.df[data.df=logical](c) sub(dataset,logical)(d) subcon(dataset,logical)The question was posed to me by my college director while I was bunking the class.I want to ask this question from Commands in division Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer» CORRECT choice is (B) data.df[data.df=logical]

Explanation: SUBSET(data.df,select=variables,logical) get those objects from a data frame that MEET a criterion.
96.

Which of the following code create n samples of size “size” with probability prob from the binomial?(a) z

Answer»

The correct option is (b) z <- rbinom(N,size,prob)

Easy explanation: To use the rbinom() FUNCTION, you NEED to define three parameters.

97.

When hypothesis tests and confidence limits are to be used, the residuals are assumed to follow the __________distribution.(a) Formal(b) Mutual(c) Normal(d) AbnormalI have been asked this question in a job interview.The origin of the question is Linear Regression in division Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer»

The correct answer is (C) Normal

For EXPLANATION: When hypothesis TESTS and confidence limits are to be USED, the residuals are assumed to follow the normal DISTRIBUTION.

98.

What is predicting y for a value of x that is within the interval of points that we saw in the original data called?(a) Regression(b) Extrapolation(c) Intra polation(d) PolationThe question was posed to me at a job interview.I need to ask this question from Linear Regression topic in chapter Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer» CORRECT answer is (c) Intra polation

For EXPLANATION I would say: Predicting y for a value of x that is within the interval of points that we SAW in the original DATA is called interpolation. Predicting y for a value of x that’s OUTSIDE the range of values we actually saw for x in the original data is called extrapolation.
99.

Which of the following lists names of variables in a data.frame?(a) quantile()(b) names()(c) barchart()(d) par()This question was addressed to me in an interview for job.I need to ask this question from Visualizing Data topic in division Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer»

Right option is (a) QUANTILE()

For EXPLANATION I would say: NAMES function is used to associate name with the VALUE in the vector.

100.

________ is an incredibly powerful tool for analyzing data.(a) Linear regression(b) Logistic regression(c) Gradient Descent(d) Greedy algorithmsThe question was posed to me in an international level competition.My question is taken from Linear Regression in section Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer» CORRECT answer is (a) LINEAR regression

Easy explanation: Linear regression is an incredibly powerful tool for ANALYSING data. we’ll focus on FINDING one of the simplest type of RELATIONSHIP: linear. This process is unsurprisingly called linear regression, and it has many applications.