Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Create a named list with three elements: a vector, a matrix, and a data frame. Access one element by its name.

Easy

Problem Statement

Create a named list with three elements: a vector, a matrix, and a data frame. Access one element by its name.

Sample Input

None

Sample Output

$vector
[1] 1 2 3

Accessed element: 
[1] 1 2 3

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
# Predefined structure named_list <- list(vector = c(1, 2, 3), matrix = matrix(1:4, nrow = 2), data_frame = data.frame(Name = c("Alice", "Bob"), Age = c(25, 30))) print(named_list$vector)
Log in or sign up to run or submit your code.Log inSign up
Input
None
Expected Output
$vector
[1] 1 2 3

Accessed element: 
[1] 1 2 3