Initialization rules

Report a typo

Select all correct initializations of a multidimensional list:

Tip: Don't forget that in a single multidimensional list, there may be lists of different types and lengths. Meanwhile, if you have initialized a one-dimensional list of a certain type, you cannot fill it with elements of other types.

a)

val mutListMD = mutableListOf(
    mutableListOf(),
    mutableListOf()
)

b)

val mutListMD = mutableListOf(
    mutableListOf(mutableListOf<Boolean>(true, true), mutableListOf<Int>(1, 1)),
    mutableListOf(mutableListOf<Int>(1, 1), mutableListOf<Boolean>(true, true))
)

c)

val mutListMD = mutableListOf(
    mutableListOf<String>(1, 2, 0),
    mutableListOf<String>(0, 2, 5),
    mutableListOf<String>(5, 1, 0)
)

d)

val mutListMD = mutableListOf(
    mutableListOf('q', 'w', 'e'),
    mutableListOf('r', 't', 'y')
)
Select one or more options from the list
___

Create a free account to access the full topic