1. In R, which function is used to create a list?
A . list()
B . vector()
C . matrix()
D . array()
2. Lists in R can contain elements of _____ types.
A . same
B . different
C . only numeric
D . only character
3. How do you access the second element of a list named mylist?
A . mylist(2)
B . mylist[2]
C . mylist[[2]]
D . mylist{2}
4. Which operator is used to access components of a list by name?
A . #
B . $
C . @
D . &
5. To add an element to a list, you assign it to a ______.
A . vector
B . matrix
C . new index
D . NULL
6. What happens when you assign NULL to a list element?
A . Element gets deleted
B . Element becomes zero
C . List doubles
D . List becomes vector
7. Which function is used to apply a function to each element of a list?
A . apply()
B . lapply()
C . sapply()
D . tapply()
8. What will length(list) return if the list is empty?
A . 0
B . 1
C . NULL
D . Error
9. What is the function to find the size of a list?
A . sizeof()
B . length()
C . size()
D . dim()
10. Which function gives the structure of a list?
A . str()
B . structure()
C . summary()
D . print()
11. In a text concordance, lists are used to store:
A . Only numbers
B . Only text
C . Words and positions
D . Paragraphs
12. How do you delete the second element of a list x?
A . x[2] <- NULL
B . x[[2]] <- NULL
C . delete(x[2])
D . remove(x[2])
13. Which function reads a list from a file?
A . read.list()
B . readLines()
C . read.table()
D . scan()
14. The default indexing of a list is:
A . Name based
B . Position based
C . Both
D . Neither
15. Which function is used to create a data frame?
A . data.frame()
B . create.frame()
C . frame()
D . list()
16. A data frame is most similar to which structure?
A . List
B . Matrix
C . Array
D . Vector
17. In a data frame, each column is:
A . Matrix
B . Vector
C . List
D . Array
18. How do you access a column of a data frame by name?
A . @
B . $
C . &
D . *
19. What is the data type of a data frame?
A . list
B . vector
C . data.frame
D . matrix
20. How to get the number of rows and columns of a data frame?
A . length()
B . size()
C . dim()
D . shape()
21. How to get the first few rows of a data frame?
A . head()
B . top()
C . start()
D . first()
22. df[,2] in R returns:
A . Second row
B . Second column
C . First row
D . First column
23. To add a new column to a data frame df, you use:
A . add_column()
B . append()
C . df$newcol<- vector
D . insert()
24. To remove a column from a data frame, assign it:
A . NA
B . 0
C . NULL
D . FALSE
25. Which function applies a function across rows or columns in a data frame?
A . apply()
B . lapply()
C . sapply()
D . mapply()
26. In matrix-like operations on data frames, which function is used to transpose?
A . reverse()
B . transpose()
C . t()
D . turn()
27. To combine two data frames vertically, we use:
A . merge()
B . cbind()
C . rbind()
D . join()
28. Which function is used to merge two data frames by common columns?
A . merge()
B . cbind()
C . append()
D . combine()
29. Lists can contain another list inside (TRUE or FALSE)______________.
30. All columns in a data frame must be of the same type(TRUE or FALSE )_______.
☞ R - Programming MCQs - Unit-1 - [ R-Programming ]
☞ R - Programming MCQs - Unit-2 - [ R-Programming ]
☞ R - Programming MCQs - Unit-3 - [ R-Programming ]
☞ R - Programming MCQs - Unit-4 - [ R-Programming ]
☞ R - Programming MCQs - Unit-5 - [ R-Programming ]
☞ Formal Languages and Automata Theory (FLAT) MCQs - Unit-1 - [ FLAT ]
☞ Formal Languages and Automata Theory (FLAT) MCQs - Unit-2 - [ FLAT ]
☞ Formal Languages and Automata Theory (FLAT) MCQs - Unit-3 - [ FLAT ]
☞ Formal Languages and Automata Theory (FLAT) MCQs - Unit-4 - [ FLAT ]
☞ Formal Languages and Automata Theory (FLAT) MCQs - Unit-5 - [ FLAT ]
☞ Artificial Intelligence (AI) MCQs - Unit-1 - [ Artificial Intelligence ]
☞ Artificial Intelligence (AI) MCQs - Unit-2 - [ Artificial Intelligence ]
☞ Artificial Intelligence (AI) MCQs - Unit-3 - [ Artificial Intelligence ]
☞ Artificial Intelligence (AI) MCQs - Unit-4 - [ Artificial Intelligence ]
☞ Artificial Intelligence (AI) MCQs - Unit-5 - [ Artificial Intelligence ]
☞ PPS MCQs - Unit-1 - [ PPS ]
☞ PPS MCQs - Unit-2 - [ PPS ]
☞ PPS MCQs - Unit-3 - [ PPS ]
☞ PPS MCQs - Unit-4 - [ PPS ]
☞ PPS MCQs - Unit-5 - [ PPS ]
☞ Object Oriented Programming through Java MCQs - Unit-1 - [ OOP_JAVA ]
☞ Object Oriented Programming through Java MCQs - Unit-2 - [ OOP_JAVA ]
☞ Object Oriented Programming through Java MCQs - Unit-3 - [ OOP_JAVA ]
☞ Object Oriented Programming through Java MCQs - Unit-4 - [ OOP_JAVA ]
☞ Object Oriented Programming through Java MCQs - Unit-5 - [ OOP_JAVA ]
☞ Design and Analysis of Algorithms MCQs - Unit-1 - [ DAA ]
☞ Design and Analysis of Algorithms MCQs - Unit-2 - [ DAA ]
☞ Design and Analysis of Algorithms MCQs - Unit-3 - [ DAA ]
☞ Design and Analysis of Algorithms MCQs - Unit-4 - [ DAA ]
☞ Design and Analysis of Algorithms MCQs - Unit-5 - [ DAA ]
☞ Software Engineering MCQs - Unit-1 - [ SE ]
☞ Software Engineering MCQs - Unit-2 - [ SE ]
☞ Software Engineering MCQs - Unit-3 - [ SE ]
☞ Software Engineering MCQs - Unit-4 - [ SE ]
☞ Software Engineering MCQs - Unit-5 - [ SE ]
☞ Data Mining MCQs - Unit-1 - [ DM ]
☞ Data Mining MCQs - Unit-2 - [ DM ]
☞ Data Mining MCQs - Unit-3 - [ DM ]
☞ Data Mining MCQs - Unit-4 - [ DM ]
☞ Data Mining MCQs - Unit-5 - [ DM ]
☞ Computer Organization and Architecture (COA) Objective Question Bank-Unit-1 - [ COA ]
☞ Computer Organization and Architecture (COA) Objective Question Bank-Unit-2 - [ COA ]
☞ Computer Organization and Architecture (COA) Objective Question Bank-Unit-3 - [ COA ]
☞ Computer Organization and Architecture (COA) Objective Question Bank-Unit-4 - [ COA ]
☞ Computer Organization and Architecture (COA) Objective Question Bank-Unit-5 - [ COA ]
☞ Data Structures Objective Type Question Bank-Unit-1 - [ DS ]
☞ Data Structures Objective Type Question Bank-Unit-2 - [ DS ]
☞ Data Structures Objective Type Question Bank-Unit-3 - [ DS ]
☞ Data Structures Objective Type Question Bank-Unit-4 - [ DS ]
☞ Data Structures Objective Type Question Bank-Unit-5 - [ DS ]
☞ Database Management System Objective Type Question Bank-Unit-1 - [ DBMS ]
☞ Database Management System Objective Type Question Bank-Unit-2 - [ DBMS ]
☞ Database Management System Objective Type Question Bank-Unit-3 - [ DBMS ]
☞ Database Management System Objective Type Question Bank-Unit-4 - [ DBMS ]
☞ Database Management System Objective Type Question Bank-Unit-5 - [ DBMS ]