0% found this document useful (0 votes)
14 views6 pages

21ACS482

The document outlines the examination details for the R Programming course at Basavarajeswari Group of Institutions, including instructions and a series of multiple-choice questions. The exam is designed for B.E. students in their fourth semester and covers fundamental concepts of R programming. Each question carries one mark, and candidates are instructed to follow specific guidelines while answering.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views6 pages

21ACS482

The document outlines the examination details for the R Programming course at Basavarajeswari Group of Institutions, including instructions and a series of multiple-choice questions. The exam is designed for B.E. students in their fourth semester and covers fundamental concepts of R programming. Each question carries one mark, and candidates are instructed to follow specific guidelines while answering.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Basavarajeswari Group of Institutions

BALLARI INSTITUTE OF TECHNOLOGY & MANAGEMENT


(Autonomous Institute under Visvesvaraya Technological University, Belagavi)

USN Course Code 2 1 A C S 4 8 2

Fourth Semester B.E. Degree Examinations, September/October 2023


R PROGRAMMING
(Common to CSE & AIML)
Duration: 2 hrs Max. Marks: 100
Instructions to the Candidates:
 All questions are compulsory
 Each question carries 1 mark
 Use only black ball point pen
 Darkening two circles for the same question makes the answer invalid
 Damaging/overwriting, using whiteners on the OMR are strictly prohibited.

Q. No Question
1 _____ programming language is a dialect of S.
a) B a) B a) B a) B
2 Which of the following will start the R program?
a) $ R a) $ R a) $ R a) $ R
3 In 1991, R was created by Ross Ihaka and Robert Gentleman in the ______ University.
a) John Hopkins b) California c) Harvard d) Auckland
4 Finally, in _________ R version 1.0.0 was released to the public.
a) 2000 b) 2005 c) 2010 d) 2012
5 Which of the following describes R language?
a) Free b) Paid c) Trial Version d) Testing
6 The copyright for the primary source code for R is held by the ______ Foundation
a) A b) S c) C d) R
7 Which of the following statement is alternative to _________ is? solve
a) help(solve) b) print(solve) c) bind(solve) d) matrix(solve)
8 If a command is not complete at the end of a line, R will display _______ prompt
a) * b) – c) + d) /
9 R has how many atomic classes of objects?
a) 1 b) 2 c) 3 d) 5
10 Numbers in R are generally treated as _______ precision real numbers
a) single b) double c) real d) imaginary
11 If you explicitly want an integer, you need to specify the _____ suffix
a) D b) R c) L d) K
What will be the output of the following R code?
12 > x <- vector ("numeric", length = 10), > x
a) 10 b) 0 0 0 0 0 0 0 0 0 0 c) 01 d) 00120
13 The ________ function can be used to create vectors of objects by concatenating things together
a) cp () b) c () c) concat () d) con ()

Note: (RBTL - Revised Bloom’s Taxonomy Level: CO - Course Outcome: PI - Performance Indicator)
Page 1 of 6
14 A single element of a character vector is referred as_____________
a) Character string b) String c) Data strings d) Raw data
15 R files has an extension ______
a). R b). S c). Rp d) .c
16 The longer programs are called ____________
a) Files b) Structures c) Scripts d) Data
17 In the expression x <- 4 in R, what is the class of ‘x’ as determined by the `class ()’ function?
a) Character b) Numeric c) Integer d) Word

18 What is the output of the following code?


seq (from = 1, to = 9, by = 2)
a) 1 3 5 7 9 b) 1 3 5 7 9 11 c) 1 2 3 4 5 6 7 8 9 d) Error
What is the output generated by the following code?
19 seq (by = -2, 9, 1)
97531 b) 1 3 5 7 9 c) 1 3 9 7 5 d) 5 7 9 3 1
20 What is the output generated by the following function? > (y <- rep (3, 4))
a) 3 3 3 3 b) 4 4 4 4 c) 3333 d) 4444
21 Write a function to get the following output: 100 101 102 103 104 105 106 107 108 109 110
a) x <- (100:110) b) x<- seq (100,110,2) c) c (100,110) d) x<-(110,110, -2)
22 What is the output generated by the following expression: c(1, 2, 3, 4) + c(1, 2)
2446 b) 1 2 3 4 1 2 c)1 2 1 2 3 4 d)2 4 6 4
23 What is the output of the function: > mean (1:6)
6 b) 3 c) 3.5 d) 4
24 What is the command to print the sorted list in reverse order?
> sort(y) b) > rev(sort(y)) c) sort(rev(y)) d) rev(y)
What is the output for the following function?
25 > x <- c (1, 1, 2, 3, 5, 8, 13)
> which (x%%2 = = 0)
a) 2, 8 b) 3, 6 c) 2, 3, 8 d) 5, 6
26 Functionality of R is divided into a number of __________
Functions Domains Packages Files
27 Which of the following is a valid variable name in R?
a) 2var b) var2 c) var_2 d) var#2
What is the output of the following code in R?
28 x <- 1:5 y <- x^2 plot (x, y)
a) A scatterplot of x b) A line plot of x c) A histogram of x d) An error message
versus y versus y
29 What is the meaning of “<-“ ?
a) Functions b) Loops c) Addition d) Assignment
30 Which of the following functions in R can be used to remove missing values from a vector?
a) na.rm () b) na. omit () c) na. fill () d) na. exclude ()
31 Which statement is used to stop a loop?
a) Stop b) exit c) break d) return
32 Which function is used to add additional columns in a matrix?
a) add () b) cbind () c) join () d) append item()

Note: (RBTL - Revised Bloom’s Taxonomy Level: CO - Course Outcome: PI - Performance Indicator)
Page 2 of 6
33 What is the output of the following code: pmin (c (1,2,3), c (3,2,1), c (2,2,2))
a) 1 2 1 b) 2 1 2 c) 1 2 3 d) 3 2 1
34 What is the output of the following code: pmax (c (1,2,3), c(3,2,1), c(2,2,2))
a) List all objects b) Removes all c) Remove current d) None of the
35 ___________________is used to objects object
skip an iteration of a loop.
a) Next b) skip c) group d) cancel
What will be the output of the following R code?
36
>y <- "fruit" > switch (y, fruit = "banana", vegetable = "broccoli", "Neither")
a) “banana” b) “Neither” c) “broccoli” d) Error
What will be the output of the following R code?
37 > x <- 3
> switch (x,2+2, mean(1:10),sum(1:5))

a) 15 b) 5.5 c) NULL d) Error


What will be the output of the following R code?
38
sum ((1:3) ^2)
a) 12 b) 13 c) 14 d) 11
39 Point out the correct statement? Note: (A: True and B: False)
a) ifelse (test, B, A) b) elseif (test, A, B) c) if (test, A, B) d) ifelse(test, A, B)
40 Which function is used to display output.
a) show () b) read () c) printf() d) display ()
41 cat () function is used to concatenate two or more strings?
a) Yes b) No
What will be the output of the following R code?
42 > x <- data. Frame (foo = 1:4, bar = c(T, T, F, F))
> ncol(x)
a) 2 b) 7 c) 4 d) 9
43 Name the function to create a data frame?
a) df() b) dframe() c) dataframe () d) data.frame()
44 Collection of objects currently stored in R is called as
a) list b) task c) workspace d) package
The_________stores the nominal values as a vector of integers in the range of 1 to unique values
45 in the nominal variable.
a) Lists b) Factor c) Matrix d) Functions
46 The following values: 10.5, 55 and 787, belongs to which data type?
a) numeric b) integer c) complex d) All of the
above
47 --------------Function is used to enter in data from the terminal?
a) SCAN( ) b) Scan; c) scan( ) d) Scandata( )
48 To bind a row onto an already existing matrix, the______________________ function can be used.
a) Sbnd( ) b) Sbind( ) c) ) rbind ( ) d) Gbind( )
49 A______________is a two-dimensional rectangular data set
a) Vector b) Lists c) Matrix d) Functions
50 Data frames can be converted to a matrix by calling data
a) as.mat() b) as.matr() c) as.mat() d) as.matrix()
51 Which function is used to find the amount of rows and columns in an array?
a) dim() b) nchar() c) length() d) dim_len()
Note: (RBTL - Revised Bloom’s Taxonomy Level: CO - Course Outcome: PI - Performance Indicator)
Page 3 of 6
52 ___________ is used to apply a function over subsets of a vector.
a) mapply() b) lapply() c) apply() d) tapply()
53 lappy functions takes____________
a) two b) three c) four d) five
54 Identify the function which is used to return a subset of the columns of a data frame?
a) select b) retrieve c) get d) set
55 ___________ remove all the variables from the workspace.
a) rm(list=ls()) b) ls() c) rm(x) d) attach(mat)
56 Data frames can contain which of the following types of data?

a) Integers only b) Integers and c) Any type of d) Integers,


numeric only data numeric and
character only
57 Identify the command to select the first row of a data frame named df in R?
a) df[0,] b) df[1,] c) df[,1] d) df[,0]
58 The ______________________ is used for reading tabular data?
a) read.csv ( ) b) dget c) readLines d) writeline
59 Which function in R is used to remove missing values from a vector?
a) na.rm() b) na.omit() c) na.fill() d) na.exclude()
60 Which function is used to determine the names assigned to a list?
a) names b) name c) nam d) nem
Consider the following code: for (x 1:10). Which keyword is missing inside the for loop to
61 output the numbers 1 to 10?
a) in b) seq c) list d) inside
62 Collection of objects currently stored in R is called as
a) list b) task c) workspace d) package
What is the meaning of the following R function?
63 x <- c(4, 5, 1, 2, 3, 3, 4, 4, 5, 6)
x <- as.factor(x)
a) x becomes a factor b) x is a factor c) x is not a vector d) x does not exist
The four most frequently used types of data objects in R are vectors, matrices, data frames
64 and __________
a) Lists b) Function c) Interfaces d) Packages
65 Lists can be created using the__________ function
a) Lists.atrix b) Matrix.li c) Matrix.lists d) list
66 Joining two lists can be achieved either using the ___________function
a) join() b) c() c) delete() d) reduce()
67 The length of a list is ___________to the number of components in that list
a) Equal b) Triple c) Double d) One fourth
68 Individual R objects can be saved to a file using the function
a) save b) put c) get d) save_image
69 An ordered collection of objects or components are called
a) Datasets b)Lists c)Databases d)Data frames
70 If the function in a console is.matrix(X) returns true then X can be considered as a ______
a) Vector b) Matrix Vector c) Matrix Object d) Matrix data
object
Note: (RBTL - Revised Bloom’s Taxonomy Level: CO - Course Outcome: PI - Performance Indicator)
Page 4 of 6
71 Warnings are generated by the __________function
a) run() b)warning() c) error() d) message()
72 Factors are the r-objects which are created using a
a) Vector b) Matrix c) Lists d) Array
73 A data frame is a special type of list where every element of the list has__________length
a) Same b) Different c) May be different d) May be same
74 We can dump() R objects to a file by passing
a) character vector of b) object name c) arguments d) file name
their names
Unlike writing out a table or CSV file, dump() and dput() preserve the_________so that another r
75 user doesn’t have to specify the all over again
a) attribute data b) backup data c) metadata normal data
76 _______ function is used to apply an expression for a given dataset
a) That() b) This() c) With() d) Unwith()
77 The ________ function can be used to remove a row of a data frame
a) select b) rename c) subset d) set
78 Individual R objects can be saved to a file using the _____ function
a) Save b) Put c) Get d) save_image
79 The process of changing the object type from one to another is __________
a) Coercion b) Conversion c) Casting d) None of the
above
80 Which function is used to draw points (markers) in a diagram?
a) d() b) draw() c) plot() d) canvas()
81 Functions are defined using the _________ directive and are stored as R objects
a) function() b) funct() c) functions() d) fun()
What will be the output of the following R code?
f <- function() {
82 ## This is an empty function
}
f()
a) 0 b) No result c) NULL d) 1
What will be the output of the following R code?
f <- function() {
83 ## This is an empty function
}
class(f)
a) “function” b) “class” c) “procedure” d) “system”
84 The __________ function returns a list of all the formal arguments of a function
a) formals() b)funct() c) formal() d) fun()
85 A function can have ____________ number(max) of arguments
a) 1 b) 2 c) 3 d) n
86 If the function comprises more than one expression, then braces are necessary
a) True b) False
87 An argument is
a) Place holder b)variable c) function d) None of the
above
Note: (RBTL - Revised Bloom’s Taxonomy Level: CO - Course Outcome: PI - Performance Indicator)
Page 5 of 6
88 Arguments can have default values
a) True b) False
89 A function always returns a value
a) True b) False
_________ function in R programming are predefined functions that are available to perform
90 common task or operations
a) variable b)constant c) user defined d) built-in
91 What is the output of the function print(sum(4:6))
a) 10 b) 15 c) 4 d) 6
92 What is the output of the function print(max(4:6))
a) 4 b) 5 c) 6 d) 15
93 The expression if(x%%2==0) then it returns the value which is ______ number
a) even b) odd
2
94 F=function(x) x *4+x/3 is _________ function
a) Inline b) Built-in c) user defined d) None of the
above
What will be the output of the following R code snippet?
95 lm <- function(x) { x * x }
> lm
a) function(x) { x * x } b) func(x) { x * x } c) function(x) { x / x d) function { x $ x }
96 A function, together with an environment, makes up what} is called a ______ closure
a) formal b) function c) reflective d) symmetry
Which of the variable in the following R code is variable?
> f <- function(x, y) {
97 x^2 + y / z
}
a) x b) y c) z d) yy
________ functions can be “built which contain all of the necessary data for evaluating the
98 function
a) objective b) reflective c) nested d) symmetry
99 _________ require you to pass a function whose argument is a vector of parameters
a) optimize() b) optimise() c) opt() d) opm()
What will be the output of the following R code?
> g <- function(x) {
a <- 3
x+a+y
100 ## 'y' is a free variable
}
> y <- 3
> g(2)
a) 9 b) 42 c) 8 d) Error

** ** **

Note: (RBTL - Revised Bloom’s Taxonomy Level: CO - Course Outcome: PI - Performance Indicator)
Page 6 of 6

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy