Give the output of the following statements: [2] System.out.print(“Today is Computer Applications Exam”); System.out.println(“I have done my preparation properly”);
Answers
Answered by
11
Explanation:
What is the meaning of the word “convalescing
Answered by
0
class q4{
public static String addone(String s){
String t = "";
char ch;
int carry = 1; 1 mark for initializations
for (int i=s.length()-1; i>=0; i--){ 1 mark for loop statement
ch = (char)(s.charAt(i)+carry); 2 marks for update and typecast
if (ch > 'z') {carry=1; ch='a';} 1 mark for if statement
else carry=0;
t = ch + t; 1 mark for updating string t
}
if (carry==1) t = 'a'+ t; 1 mark
return t; 1 mark for return and type name in header
}
//DO NOT change anything in main
public static void main(String args[]) {
String a = "yzzzzz";
System.out.println(addone(a));
}
}
Similar questions