• recategorized by
6,135 views
24 24 votes

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$

1 Answer

Best answer
29 29 votes

Answer is C.

  • $concat(a,head(tail(tail(acbc))))$
  • $concat(a,head(tail(cbc)))$
  • $concat(a,head(bc))$
  • $concat(a,b)$
  • $ab$.
• edited by
Answer:
Position:
Show:

Related questions

15 15 votes
3 answers 3 answers
5.8k
5.8k views
Kathleen asked Oct 8, 2014
5,827 views
Assume that $X$ and $Y$ are non-zero positive integers. What does the following Pascal program segment do?while X < Y do if X Y then X := X - Y else Y := Y - X; write(X)...
17 17 votes
3 answers 3 answers
5.7k
5.7k views
Kathleen asked Oct 8, 2014
5,733 views
Consider the following Pascal function where $A$ and $B$ are non-zero positive integers. What is the value of $\text{GET}(3, 2)$?function GET(A,B:integer): integer; begin...
44 44 votes
6 answers 6 answers
56.8k
56.8k views
Kathleen asked Oct 8, 2014
56,829 views
For merging two sorted lists of sizes $m$ and $n$ into a sorted list of size $m+n$, we require comparisons of$O(m)$$O(n)$$O(m+n)$$O(\log m + \log n)$
40 40 votes
9 answers 9 answers
24.8k
24.8k views
Kathleen asked Oct 8, 2014
24,800 views
The number of $1$'s in the binary representation of $(3\ast4096 + 15\ast256 + 5\ast16 + 3)$ are:$8$$9$$10$$12$