0% found this document useful (0 votes)
8 views2 pages

? R Programming

Uploaded by

takkartanmay22
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)
8 views2 pages

? R Programming

Uploaded by

takkartanmay22
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/ 2

BCM ARYA MODEL SR SEC SCHOOL, Shastri Nagar

Subject Data Sc Class _XI

📄 R Programming – Assignment: Week 1


Name: ____________________ Class: XI Date: __________
Instructions: Answer all questions. Use RStudio to test code-based questions.

Attempt all sections.

� Section A – Multiple Choice Questions (1 mark each)

(Attempt all 10 questions)

1. Which function is used to create a vector in R?


a) array() b) matrix() c) c() d) list()
2. R is primarily used for:
a) Web development b) Statistical computing c) Graphics design d) Game
development
3. What will be the output of this code: class(10L)?
a) "double" b) "numeric" c) "integer" d) "character"
4. What is the correct way to assign value 5 to a variable x?
a) x <- 5 b) 5 <- x c) x => 5 d) assign(5, x)
5. Which of the following data types is NOT an atomic vector?
a) Logical b) Integer c) List d) Character
6. What does setwd() do in R?
a) Sets working directory
b) Creates a new function
c) Sets plot width
d) None of the above
7. What is the starting index for a vector in R?
a) 0 b) 1 c) -1 d) Any number
8. Which operator is used for integer division?
a) / b) %/% c) %% d) ^
9. Which of the following is TRUE about vectors in R?
a) They can contain mixed types
b) They are always of type character
c) All elements are of the same type
d) Vectors start from index 0
10. Which of the following will access the third element of a vector v?
a) v[2] b) v[3] c) v(3) d) v[0]

✍� Section B – True or False (1 mark each)

11. R is an open-source software. __________


12. The function getwd() helps to get the current working directory. __________
13. In R, we can use = and <- interchangeably for assignment. __________
14. Indexing in R starts from 0. __________
15. A list in R can contain different types of data. __________

� Section C – Short Answer (2 marks each)

Answer in 2–3 lines.

16. Define a vector and list one method to create it in R.


17. Explain the difference between %% and %/% operators.
18. What is the purpose of typeof() function in R?
19. Write the output of:

v <- c(2, 4, 6, 8)
v[v > 4]

20. What happens if you try to add two vectors of different lengths?

💻 Section D – Code Writing (3 marks each)

Write correct R code for the following.

21. Create a vector of first 10 even numbers using the seq() function.
22. Create a list with your name, age, and favorite subject.
23. Assign a value to a variable using both <- and = and print both.
24. Create two vectors v1 = c(3, 6, 9) and v2 = c(1, 2, 3) and perform all
arithmetic operations.
25. Write a program to store 5 city temperatures and display only those above 30°C.

🌍 Section E – Interdisciplinary/Application Based (3 marks each)

Apply R programming to real-world or subject-integrated contexts.

26. Use R to represent the first 5 multiples of 7 using vector. (Math)


27. Write a list to store a student’s profile with name, age, interest, and average marks.
(English)
28. A vector contains daily study hours: hours <- c(2, 3, 1.5, 4, 0).
Find out on which days the student studied more than 2 hours.
29. Use setwd() to set the working directory to "C:/Projects/RWork" (write code).
30. Create a vector of rainfall data in mm for 7 days and find days with rainfall < 10 mm.
(Geography)

Compiled by Mrs Ambica Soni


Verified By: Mr Nikhil Sharma

You might also like