A language with string manipulation facilities uses the following operations. head(s) - returns the first character of the strings tail(s) - returns all but the first character of the strings concat (s1, s2) - concatenates string s1 with s2. The output of concat (head(s), head(tail(tail(s)))), where s is acbc is

A language with string manipulation facilities uses the following operations. head(s) - returns the first character of the strings tail(s) - returns all but the first character of the strings concat (s1, s2) - concatenates string s1 with s2. The output of concat (head(s), head(tail(tail(s)))), where s is acbc is Correct Answer ab

Start solving from the inner brackets

= concat (head(s), head(tail(tail(s))))

= concat(head(acbc), head(tail(tail(acbc))))

= concat(head(acbc),head(tail(cbc)))

= concat(head(acbc),head(bc))

= concat(a,b)

=ab

correct answer is option 1

Related Questions