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

Programming Exercises

Create a matrix with 2 rows and 3 columns and fill it with numbers from 1 to 6.

Easy

Problem Statement

Create a matrix with 2 rows and 3 columns and fill it with numbers from 1 to 6.

Sample Input

None

Sample Output

     [,1] [,2] [,3]
[1,]    1    3    5
[2,]    2    4    6

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
# Predefined structure matrix <- matrix(1:6, nrow = 2, byrow = FALSE) print(matrix)
Log in or sign up to run or submit your code.Log inSign up
Input
None
Expected Output
     [,1] [,2] [,3]
[1,]    1    3    5
[2,]    2    4    6