The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+7 votes
712 views

A language with string manipulation facilities uses the following operations

head(s): first character of a string
tail(s): all but exclude the first character of a string
concat(s1, s2): s1s2

For the string "$acbc$" what will be the output of

concat(head(s), head(tail(tail(s))))
  1. $ac$
  2. $bc$
  3. $ab$
  4. $cc$
asked in Programming by Veteran (59.7k points)
edited by | 712 views
0
i think some correction is required in question
tail(s): all but the EXCLUDE first character of a string

1 Answer

+17 votes
Best answer

Answer is C.

$concat(a,head(tail(tail(acbc))))$

$concat(a,head(tail(cbc)))$

$concat(a,head(bc))$

$concat(a,b)$

$ab$.

answered by Boss (19.9k points)
edited by
0
answer should ac???
0

@altamash no answer will be  ab

use the tail definition which is given in the question 

Answer:

Related questions



Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

44,510 questions
49,968 answers
165,822 comments
65,915 users