Point out the correct statement.

head function work on string
tail function work on string
head function work on string but tail function do not
none of the mentioned

The correct answer is: C. head function work on string but tail function do not

The head function returns the first element of a list, while the tail function returns the rest of the list. In the case of a string, the head function would return the first character, while the tail function would return the rest of the string.

For example, if we have the string “hello”, the head function would return “h”, and the tail function would return “ello”.

Here is a Python example:

“`python

head(“hello”)
‘h’
tail(“hello”)
‘ello’
“`

Exit mobile version