Professional Documents
Culture Documents
reviewer4@nptel.iitm.ac.in ▼
Unit 4 - Week
3 - Conditional executions and loops, data management
with sequences.
Course
outline
ASSIGNMENT 3
The due date for submitting this assignment has passed.
How to access As per our records you have not submitted this Due on 2018-09-05, 23:59 IST.
the portal assignment.
Week - 1 - Basic 1) If x = 23 then which one of the following is the correct outcome of y where 1 point
fundamentals, y=if ( x==23 ) { x <- x^3+3 } else { x <- x^2-3 } ?
installation and
use of software,
12164
data editing, use
of R as a 12170
calculator,
functions and 526
assignments.
123
Week 2 - Use of
No, the answer is incorrect.
R as a
calculator, Score: 0
functions and Accepted Answers:
matrix
12170
operations,
missing data 2) Which one of the following is the correct syntax to compute y for the following function? 1 point
and logical
⎧ 2x 2 + |x4 − 66|,
operators. 3
if x ≤ 0
y=⎨
⎩ x3 √ 52
Week 3 - −−
−
Conditional 3e − x if x > 0
executions and
loops, data
if ( x <= 0 ) { y <- 2 * x^(3/2) + abs(x^4 - 66) } else { y <- 3 *
management
with sequences. exp(x^3) - sqrt(x^(5/2))}
3) Suppose xPowered
= c(12,4,16,8,20,5,14)
by then which one of the following is the correct 1 point
Lecture 15 -
Data output of
management : ifelse(x < 10, 2+x, 2*x) ?
sequences
[1] 14 8 18 16 22 10 16
Lecture 16 -
Data
[1] 14 6 18 10 22 7 16
management :
Repeats [1] 24 8 32 16 40 10 28
Lecture 17 - [1] 24 6 32 10 40 7 28
Data
management : No, the answer is incorrect.
Sorting and Score: 0
Ordering
Accepted Answers:
Quiz : [1] 24 6 32 10 40 7 28
ASSIGNMENT
3 4) Which one of the following is the correct outcome of 1 point
WEEK-3 for(i in 12:14) {print(1 - 2i + i^2)} ?
FEEDBACK
Assignment_3_Answer_keys
[1] 121
Week 4 - Data [1] 144
management [1] 169
with repeats,
sorting,
ordering, and [1] -23 + i2
lists [1] -25 + i2
[1] -27 + i2
Week 5 - Vector
indexing,
factors, Data [1] 145-2i
management
[1] 170-2i
with strings,
display and [1] 197-2i
formatting.
[1] 169
Week 6 - Data
management [1] 144
with display [1] 121
paste, split, find
and
replacement, No, the answer is incorrect.
manipulations Score: 0
with alphabets,
evaluation of Accepted Answers:
strings, data [1] 145-2i
frames. [1] 170-2i
[1] 197-2i
Week 7 - Data
frames, import 5) Which one of the following is the correct outcome of 1 point
of external data for(i in 10:14) {print(i + 2*i + 3*i**3)} ?
in various file
formats,
statistical
functions, [1] i + 2*i + 3*i**3
compilation of [1] i + 2*i + 3*i**3
data. [1] i + 2*i + 3*i**3
[1] i + 2*i + 3*i**3
Week 8 -
Graphics and
plots, statistical
functions for
[1] 3030
central
tendency, [1] 4026
variation, [1] 5220
skewness and [1] 6630
Error...
DOWNLOAD
VIDEOS
No, the answer is incorrect.
Score: 0
Accepted Answers:
[1] 3030
[1] 4026
[1] 5220
[1] 6630
[1] 8274
6) Which one of the following is the correct outcome of the following commands about while 1 point
loop?
y <- 5
7) Which one of the following is the correct outcome of the following while loop? 1 point
x <- 20
while(x < 35) {x <- x^2+10; if (x == 30) break; print(x); }
[1] 410
[1] 20
[1] 410
[1] 410
[1] 20
[1] 20
[1] 35
[1] 35
8) Which one of the following is the correct outcome of the command 1 point
abs(seq(-30,-35))?
[1] 30 31 32 33 34 35
[1] 35 34 33 32 31 30
9) Which one of the following is the correct output of the command 1 point
sqrt(abs(seq(-15,15, by = 6))) ?
10)Which one of the following is the correct output of the command seq(20,-20, by = 1 point
-4)?
11) Which one of the following is the correct output of the command 1 point
seq(to = 200, length = 10)?
[1] -209 -208 -207 -206 -205 -204 -203 -202 -201 -200
[1] 191 192 193 194 195 196 197 198 199 200
[1] -191 -192 -193 -194 -195 -196 -197 -198 -199 -200
[1] 200 201 202 203 204 205 206 207 208 209
12)Which one of the following is the correct output of the command seq(to = -100, 1 point
length = 10) ?
[1] -109 -108 -107 -106 -105 -104 -103 -102 -101 -100
[1] 109 108 107 106 105 104 103 102 101 100
[1] 100 101 102 103 104 105 106 107 108 109
[1] -100 -101 -102 -103 -104 -105 -106 -107 -108 -109
13)Which one of the following is the correct output of the command 1 point
seq(to = 112, length = 11, by = 12) ?
Accepted Answers:
[1] -8 4 16 28 40 52 64 76 88 100 112
14)Which one of the following is the correct output of the command 1 point
seq(from = -5, length = 5, by = -0.5) ?
15)Which one of the following is the correct output of Y for the following commands 1 point
X <- c(78, 67, 15, 120, 3, 160, 20, 48, 9)
Y <- seq(along = X) ?
[1] 1 2 3 4 5 6 7 8 9
[1] 7 6 3 8 1 9 4 5 2
[1] 2 5 4 9 1 8 3 6 7
[1] 9 8 7 6 5 4 3 2 1
16)Which one of the following is the correct output of Y[X[3]] and Y[X[7]] for the 1 point
command
Y <- c(90, 17, 51, 80, 32, 60, 87)
X <- c(5, 7, 1, 4, 6, 3, 2) ?
51 and 87 respectively.
1 and 2 respectively.
17 and 90 respectively.
90 and 17 respectively.
17)Which one of the following is the correct command to generate a sequence of three yearly 1 point
dates 1-March-2016, 1- March-2017 and 1- March-2018?
seq(as.date("2016-03-01"), as.date("2017-03-01"),
as.date("2018-03-01"),by = "years")
Score: 0
Accepted Answers:
seq(as.Date("2016-03-01"), as.Date("2018-03-01"), by = "years")
18)Which one of the following is the correct command to generate the same dates (15 th ) 1 point
of 6 consecutive months starting from 15 March 2017?
19)Which one of the following is the correct outcome of the command letter[2:7] ? 1 point
Error...
20)Which one of the following is the correct outcome of the command LETTERS[15:10] ? 1 point
21)Which one of the following is the correct outcome of the command rep(5:9,3)? 1 point
[1] 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9
[1] 5 6 6 7 7 7 8 8 8 8 9 9 9 9 9
[1] 5 6 7 8 9 5 6 7 8 9 5 6 7 8 9
[1] 9 8 7 6 5 9 8 7 6 5 9 8 7 6 5
22)Which one of the following is the correct outcome of the command 1 point
rep(50:46, times=4) ?
1] 50 49 48 47 46 50 49 48 47 46 50 49 48 47 46 50 49 48 47 46
[1] 46 47 48 49 50 46 47 48 49 50 46 47 48 49 50 46 47 48 49 50
[1] 50 50 50 50 49 49 49 49 48 48 48 48 47 47 47 47 46 46 46 46
[1] 46 46 46 46 47 47 47 47 48 48 48 48 49 49 49 49 50 50 50 50
23)Which one of the following is the correct outcome of the command rep(35:40, 1 point
each=4) ?
[1] 35 36 37 38 39 40 35 36 37 38 39 40 35 36 37 38 39 40 35 36 37
38 39 40
[1] 35 35 35 35 36 36 36 36 37 37 37 37 38 38 38 38 39 39 39 39 40
40 40 40
[1] 40 40 40 40 39 39 39 39 38 38 38 38 37 37 37 37 36 36 36 36 35
35 35 35
[1] 40 39 38 37 36 35 40 39 38 37 36 35 40 39 38 37 36 35 40 39 38
37 36 35
24)Which one of the following is the correct outcome of the commands 1 point
x <- matrix(nrow=3, ncol=3, data=1:9, byrow=F)
rep(x, each=2) ?
[1] 9 9 8 8 7 7 6 6 5 5 4 4 3 3 2 2 1 1
[1] 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9
[1] 9 8 7 6 5 4 3 2 1 9 8 7 6 5 4 3 2 1
[1] 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
25)Which one of the following is the correct outcome of the command rep(c("CLASS1", " 1 point
CLASS2", " CLASS3"), each=3) ?
[1] "CLASS1" "CLASS1" "CLASS1" " CLASS2" " CLASS2" " CLASS2" "
CLASS3" " CLASS3" " CLASS3"
[1] "CLASS1" "CLASS2" "CLASS3" " CLASS1" " CLASS2" " CLASS3" "
CLASS1" " CLASS2" " CLASS3"
[1] "CLASS1" "CLASS1" "CLASS1" " CLASS2" " CLASS2" " CLASS2" " CLASS3" "
CLASS3" " CLASS3"