Question: QUESTION 6 det foo( x Int : Int =x+2 def bar( y : String) String =7 Hello +y def baz(z String) : Int ={ val
QUESTION 6 det foo( x Int : Int =x+2 def bar( y : String) String =7 Hello +y def baz(z String) : Int ={ val str1 = bar(z) val siz1 = str1.size foo(siz1) \} Which of the following statements about these functions are true? The value siz1 in baz will have the type String Calling foo(bar(z)) will result in a type mismatch error because the output type of bar (String) is not the same as the input type for foo Changing the last statement of baz from foo(siz1) to return foo(siz1) does not change its meaning Although foo's argument x is typed to be an int, scala will correctly oxecuto a call such as foo( 'World") baz takes in an input string and roturns the number equating the size of input string plus 7
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
