Create a free account on Computer Sir Ki Class and unlock access to valuable learning resources.
Exam Paper Downloads: After registering and logging in, you can download exam question papers in PDF format to practice and prepare for your exams.
Student Support: Get assistance with your doubts, queries, and questions related to your studies. Our support is here to help you understand topics and resolve your learning difficulties.
Register today and make your exam preparation easier and more effective!
Consider the following String array and give the output
String arr[]= {“DELHI”, “CHENNAI”, “MUMBAI”, “LUCKNOW”, “JAIPUR”};
System.out.println(arr[0].length()>arr[3].length());
System.out.print(arr[4].substring(0,3));
Answer:
The outputs will be as follows – false JAI
System.out.println(arr[0].length()>arr[3].length());
arr[0].length() would be 5 (character count in DELHI) and arr[3].length() would be 7 (Character count in LUCKNOW). Since 5 is not greater than 7 so output would be false.
System.out.print(arr[4].substring(0,3));
Here arr[4] would be JAIPUR and in this characters from index 0 up to 3 (excluding index 3) would be JAI.
C. Sir| Created: 25-Mar-2018 | Updated: 22-Mar-2026|ICSE2018