Answer 1 it’s online banking
Answer:
Option (d) is the correct answer.
Explanation:
An Array is used to store multiple variables in the memory in the continuous memory allocation on which starting index value is starting from 0 and the last index value location is size-1.
In java programming language the array.length is used to tells the size of the array so when the user wants to get the value of the last element, he needs to print the value of (array.length-1) location so the correct statement for the java programming language is to print the last element in the array named ar is--
System.out.println(ar[ar.length-1]);
No option provides the above statement, so option d (None of these) is correct while the reason behind the other option is not correct is as follows--
- Option a will prints the size of the array.
- Option b also gives the error because length is an undeclared variable.
- Option c will give the error of array bound of an exception because it begs the value of the size+1 element of the array.
Answer:
- import java.util.Arrays;
- import java.util.Scanner;
-
- public class Main {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- double distances [] = new double[7];
-
- for(int i=0; i < distances.length; i++){
- System.out.print("Input running distance for day " + (i+1) + ": ");
- distances[i] = input.nextDouble();
- }
-
- System.out.println(Arrays.toString(distances));
- }
- }
Explanation:
The solution code is written in Java.
Firstly, create a Scanner object to get user input for running distance (Line 6). Next, declare a distances array and set the array size to 7 because we intend to use this array to hold running distance for 7 days per week.
Next, use the for loop that run for 7 times to repeatedly prompt user to input running distance for each day and store each value to the array distances (Line 9 -12).
At last, display the array to console terminal (Line 14).
Answer:
Explanation:
Number of ways to select 10 girls in 35C₁₀
Number of ways to select 10 boys in 35C₁₀
Total Number of ways to select is 35C₁₀ x 35C₁₀