Interview Question

Automation Test Engineer Interview

-Hyderābād

Oracle

Code to reverse a string

AnswerAdd Tags

Interview Answers

4 Answers

4

declare l_orig varchar2(32767):='&input'; l_out varchar2(32767); begin for i in 0..length(l_orig)-1 loop l_out := l_out ||substr(l_orig,length(l_orig)-i,1); end loop; dbms_output.put_line(l_out); end; /

Steven on

1

// Java program to Reverse a String by // converting string to characters one // by one import java.lang.*; import java.io.*; import java.util.*; // Class of ReverseString class ReverseString { public static void main(String[] args) { String input = "GeeksForGeeks"; // convert String to character array // by using toCharArray char[] try1 = input.toCharArray(); for (int i = try1.length-1; i>=0; i--) System.out.print(try1[i]); } }

Anonymous on

1

source: GeeksforGeeks

Anonymous on

0

class ReverseString { public static void main(String[] args) { String input = "GeeksForGeeks"; // convert String to character array // by using toCharArray char[] try1 = input.toCharArray(); for (int i = try1.length-1; i>= 0; i--) System.out.print(try1[i]); } }

chinmay on

Add Answers or Comments

To comment on this, Sign In or Sign Up.