recategorized by
2,673 views
1 votes
1 votes

A language with string manipulation facilities uses the following operations.

head$(s)$- returns the first character of the string $s$

tails$(s)$- returns all but the first character of the string $s$

concat$(s1, s2)$- concatenates string $s1$ with $s2.$

The output of concat(head$(s)$, head(tail(tail$(s)$))), where s is $acbc$ is:

  1. ab
  2. ba
  3. ac
  4. aa

   

recategorized by

2 Answers

Best answer
7 votes
7 votes

s= acbc
concat(head(s),head(tail(tail(s))))
concat(head(s),head(tail(cbc)))
concat(head(s),head(bc))
concat(head(s),b)
concat(a,b)
ab
Option A is correct. 

selected by
2 votes
2 votes
The statement i.e "tail(s)=return all but the first character in string (s)" has no negative sense.if  tail function returns every character of string then answer must be "aa" i.e D option otherwise question is wrong .
Answer:

Related questions

5 votes
5 votes
2 answers
1
Arjun asked Apr 22, 2018
8,442 views
Consider the following program{ int x=1; printf("%d",(*char(char*)&x)); }Assuming required header files are included and if the machine in which this program is executed ...
5 votes
5 votes
6 answers
2
Arjun asked Apr 22, 2018
9,801 views
What is the output of tho following program?main(){ int x=2, y=5; if(x<y) return (x=x+y); else printf("z1"); printf("z2"); }$z2$$z1z2$Compilation errorNone of these
5 votes
5 votes
3 answers
3
Arjun asked Apr 22, 2018
5,574 views
Consider the following declaration :structaddr { char city[10]; char street[30]; int pin; }; struct { char name[30]; int gender; struct addr locate; } person, *kd = &pers...