Question: Consider the incomplete Scala definition where some types have been replaced with question marks: def f ( x: List [ Int ] , y: ?

Consider the incomplete Scala definition where some types have been replaced with question marks:
def f(x: List[Int], y: ?1) : ?2= x :: y
Which types must replace ?1 and ?2 for this definition to typecheck correctly?
Options:
?1= Int and ?2= List[Int]
?1= List[Int] and ?2= List[Int]
?1= Int and ?2= Int
?1= List[List[Int]] and ?2= List[List[Int]]
?1= List[Int] and ?2= List[List[Int]]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!