Search Header Logo
Unit - II

Unit - II

Assessment

Presentation

Computers

Professional Development

Practice Problem

Medium

Created by

Dr.Adlin BHC

Used 1+ times

FREE Resource

34 Slides • 56 Questions

1

media

2

Open Ended

Explain the significance of the S language in the development of R.

3

Fill in the Blanks

Type answer...

4

Multiple Choice

What year was S Version 4 released?

1

1993

2

1998

3

2004

4

2008

5

Multiple Choice

What is R primarily used for?

1

Statistical computing and graphics

2

Web development

3

Game development

4

Mobile app development

6

Fill in the Blanks

7

media

8

Open Ended

Describe the significance of the GPL in R's global adoption.

9

media

10

Multiple Choice

What does the if...else statement provide in R?

1

An alternative block when the condition is TRUE

2

An alternative block when the condition is FALSE

3

A way to repeat code

4

A method to create functions

11

media

12

Multiple Choice

What grade will be assigned if the score is 75?

1

A

2

B

3

C

4

D

13

media

14

media

15

Multiple Choice

What does the 'break' statement do in a loop?

1

It skips the current iteration

2

It ends the loop

3

It continues to the next iteration

4

It restarts the loop

16

media

17

Multiple Choice

What is the purpose of the return statement in R?

1

To send a value back to the calling program

2

To print the result

3

To exit the program

4

To define a function

18

media

19

Multiple Choice

What will be the output of the max_value function when the inputs are 10 and 20?

1

10

2

20

3

Error

4

None of the above

20

Multiple Choice

What is the output of the function check_even when the input is 7?

1

Even Number

2

Odd Number

3

Error

4

None of the above

21

Multiple Choice

Assertion (A):- If the arguments in function call statement match the

number and order of arguments as defined in the function definition,

such arguments are called positional arguments.

Reasoning (R):- During a function call, the argument list first contains

default argument(s) followed by positional argument(s).

1

Both A and R are true and R is the correct explanation for A

2

Both A and R are true and R is not the correct explanation for A

3

A is True but R is False

4

A is false but R is True

22

media

23

Open Ended

Explain the importance of functions in R programming.

24

Fill in the Blanks

Type answer...

25

Multiple Choice

What is the purpose of using functions in R?

1

To reduce code repetition

2

To increase code size

3

To make code less readable

4

To avoid debugging

26

Multiple Choice

A function is

1

a line of code that will evalute to true or false

2

the same thing as a loop

3

a set of commands

4

a piece of code that you can easily call over and over again

27

media

28

Open Ended

Explain how anonymous functions are used in R with an example.

29

Multiple Choice

What is the output of the function call power(5, 3)?

1

5

2

25

3

125

4

2

30

Multiple Choice

What is the purpose of default arguments in R functions?

1

To make functions flexible

2

To limit the number of arguments

3

To create anonymous functions

4

To define global variables

31

media

32

media

33

Open Ended

Explain the concept of lexical scoping in R.

34

media

35

Multiple Choice

What is the search order for variables in R when a variable is referenced?

1

Inside the function (Local Environment)

2

In the Parent Environment

3

Global Environment

4

Base Package in R

36

media

37

Open Ended

Explain the difference between local and global variables in R programming.

38

Multiple Choice

What will be the output of the function f() in Example 1?

1

5

2

10

3

15

4

Error

39

Multiple Choice

In the context of R programming, what does the term 'global environment' refer to?

1

The environment inside a function

2

The environment outside of all functions

3

The environment where local variables are stored

4

The environment for global variables only

40

media

41

Multiple Choice

What is the purpose of the Super Assignment Operator (<<-) in R?

1

To assign a variable in the local environment

2

To assign a variable in the global environment

3

To modify a variable in the current function

4

To create a new variable in the local environment

42

media

43

Open Ended

What is the difference in days between the two dates defined in the example?

44

Open Ended

What function is used to get the current date in R?

45

Multiple Choice

What is the preferred storage format for date-time objects in R?

1

POSIXlt

2

POSIXct

3

Date

4

Datetime

46

Multiple Choice

What is the format used to store dates in R?

1

YYYY-MM-DD

2

MM-DD-YYYY

3

DD-MM-YYYY

4

YYYY/DD/MM

47

media

48

Open Ended

Explain how to create a date using the `as.Date()` function in R.

49

Multiple Choice

What is the output of the command `format(d, "%d-%m-%Y")` where d is created as `d <- as.Date("2025-01-15")`?

1

15-01-2025

2

2025-01-15

3

01-15-2025

4

15-2025-01

50

Multiple Choice

What does the format code %d represent in date formatting?

1

Year

2

Month

3

Day

4

Hour

51

media

52

Multiple Choice

What is the difference in days between the dates 2025-01-01 and 2025-01-15?

1

14 days

2

15 days

3

16 days

4

13 days

53

Multiple Choice

What is the result of adding 7 days to the date 2025-01-15?

1

2025-01-22

2

2025-01-21

3

2025-01-20

4

2025-01-23

54

Multiple Choice

What are the extracted day, month, and year from the date 2025-01-15?

1

15, 01, 2025

2

01, 15, 2025

3

2025, 01, 15

4

15, 2025, 01

55

media

56

Multiple Choice

The ________ function can be used to create vectors of objects by

concatenating things together.

1

class()

2

concat()

3

c()

4

cp()

57

media

58

Fill in the Blanks

Type answer...

59

Open Ended

List two common string functions in R.

60

Multiple Choice

What is the primary use of a data frame in R?

1

To store text data

2

To represent categorical data

3

To hold tabular data with rows and columns

4

To create arrays

61

Multiple Choice

Which of the following statement is alternative to ?factors

1

help(factors)

2

print(factors)

3

cat(factors)

4

scan(factors)

62

media

63

media

64

Multiple Choice

What is the purpose of the seq() function in R?

1

To generate random numbers

2

To create sequences with control

3

To perform type coercion

4

To store Boolean values

65

media

66

Multiple Choice

What is the output of the function `seq(from = 1, to = 10, by = 2)`?

1

1 3 5 7 9

2

2 4 6 8 10

3

1 2 3 4 5

4

5 10 15 20 25

67

media

68

Multiple Choice

Using the command v[c(1, 3)], what elements are returned from the vector v <- c(10, 20, 30, 40)?

1

10 and 20

2

20 and 30

3

10 and 30

4

30 and 40

69

Multiple Choice

What does the negative index v[-1] do in the context of the vector v <- c(10, 20, 30, 40)?

1

Removes the first element

2

Removes the last element

3

Removes all elements

4

Keeps all elements

70

Multiple Choice

What is the output of the command v[2] when v is defined as v <- c(10, 20, 30, 40)?

1

10

2

20

3

30

4

40

71

Multiple Choice

What will be the output of the following R code?

x<-1:10

print(x)

1

1,10

2

1,2,3,4,5,6,7,8,9,10

3

0,1,2,3,4,5,6,7,8,9

4

1,2,3,4,5,6,7,8,9

72

Multiple Choice

What will be the output of the following R program?

x<-5:10

x[3]

1

7

2

6

3

5

4

10

73

media

74

Open Ended

Explain the significance of named indexing in R vectors.

75

Multiple Choice

What does the command v[2:4] return when v is defined as v <- c(10, 20, 30, 40)?

1

10

2

20 30 40

3

20 30

4

30 40

76

Multiple Choice

What is the output of the command v[4] when v is defined as v <- c(10, 20, 30, 40)?

1

10

2

20

3

30

4

40

77

media

78

Multiple Choice

What is the syntax for creating an array in R?

1

array(data, dim)

2

array(dim, data)

3

createArray(data, dim)

4

array(data)

79

Open Ended

Explain how to filter even numbers from a vector in R using logical conditions.

80

Multiple Choice

What does the condition v > 20 return in the example provided?

1

TRUE TRUE FALSE

2

FALSE TRUE TRUE

3

TRUE FALSE FALSE

4

FALSE FALSE TRUE

81

Multiple Choice

What is the purpose of logical subscripts in R?

1

To filter and extract elements of a vector

2

To create loops

3

To define arrays

4

To perform mathematical operations

82

media

83

media

84

media

85

media

86

media

87

media

88

media

89

media

90

Poll

How confident do you feel about this topic now?

Very confident
Somewhat confident
Not confident
media

Show answer

Auto Play

Slide 1 / 90

SLIDE