edited by
3,603 views
5 votes
5 votes

Study the following program

//precondition: x>=0
public void demo(int x)
{
    System.out.print(x % 10); 
    if (x % 10 != 0)
    {
        demo(x/10);
    }
    System.out.print(x%10);
}

Which of the following is printed as a result of the call demo $(1234)$?

  1. $1441$
  2. $3443$
  3. $12344321$
  4. $43211234$
edited by

3 Answers

7 votes
7 votes

Option D

it Prints 43211234 as output

Answer:

Related questions

13 votes
13 votes
3 answers
2
go_editor asked Jun 10, 2016
5,097 views
Djikstra’s algorithm is used toCreate LSAsFlood an internet with informationCalculate the routing tablesCreate a link state database
6 votes
6 votes
2 answers
3
go_editor asked Jun 10, 2016
4,424 views
A rule in a limited entry decision table is arow of the table consisting of condition entriesrow of the table consisting of action entriescolumn of the table consisting o...
10 votes
10 votes
3 answers
4
go_editor asked Jun 10, 2016
10,616 views
The time taken by binary search algorithm to search a key in a sorted array of $n$ elements is$O\: (\log_2 \: n)$$O \: (n)$$O \: (n \: \log_2 \: n)$$O \: (n^2)$