in Programming recategorized by
1,924 views
1 vote
1 vote

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

   

in Programming recategorized by
by
2439 3623 5535
1.9k views

1 comment

It should be a verbal ability question.
0
0

Subscribe to GO Classes for GATE CSE 2022

2 Answers

7 votes
7 votes
 
Best answer

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
by
48 101 239

2 Comments

Tail(s)= there is ambiguity. If it is return all but from the first character of the string s. And according  to now which tail() explains in the question paper then more correct  answer should be D .

But answer A will be when tails() = return all but "not" Frist character of the string   then answer will be A
0
0
3
3
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 .
by
3 10 16

4 Comments

all but first -- what is the problem here?
0
0
if statement would be like" all but not first " or they should say "except" than surely it would be correct . If I am saying wrong please rectify me.
0
0
"all but" is a standard English usage, "not" is implied here.
1
1
Ok now I got it i.e Common sense  is applicable here. THANKS
1
1
Answer:

Related questions