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!
What is the value stored in variable res given below:
double res = Math.pow(“345”.indexOf(‘5’), 3);
Answer:
double res = Math.pow(“345”.indexOf(‘5’), 3);
Here we will first calculate “345”.indexOf(‘5’) as the first index starts 0 the index of ‘5’ in “345” would be 2. Now we place it in the method as follows.
Math.pow(2,3) = 2^3
So res = 8.0 //.0 is added as the variable type is double.
C. Sir| Created: 22-Mar-2018 | Updated: 16-Apr-2019|ICSE2015