TCS Placement: Sample Questions 102 - 103 of 502

Get unlimited access to the best preparation resource for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 102

Edit

Describe in Detail

Essay▾

Is there another function which can be used to convert an integer or a float to a string?

Explanation

  • Some implementations provide a nonstandard function called item () , which converts an integer to string.
  • #include char ⚹ item (int value, char ⚹ string, int radix) ;
  • DESCRIPTION:-The item () function constructs a string representation of an integer.
  • PARAMETERS:-
    • value: Is the integer to be converted to string representation.
    • string: Points to the buffer that holds resulting string. The resulting string may be as long as seventeen bytes.
    • radix: Is the base of the number; must be in the range 2 - 36.
  • A portable solution also exists. One can use sprintf () : char s [SOME_CONST] ; int i = 10; float f = 10.20; sprintf (s, “% d % f” , i, f) ;

Question 103

Edit

Write in Short

Short Answer▾

Sorting in not possible by using which of the following methods? (Insertion, selection, exchange, deletion)

Explanation

  • Sorting is not possible with Deletion.
  • Using insertion - perform insertion sort.
  • Using selection- perform selection sort.
  • Using exchange- perform the bubble sort (or others) .
  • No sorting method just uses deletion.

Developed by: