Ask Question
17 April, 10:06

Consider the following declaration. int[] alpha = new int[3]; Which of the following input statements correctly input values into alpha? (i) alpha = cin. nextInt (); alpha = cin. nextInt (); alpha = cin. nextInt (); (ii) alpha[0] = cin. nextInt (); alpha[1] = cin. nextInt (); alpha[2] = cin. nextInt (); 1. Only (i) 2. Only (ii) 3. None of these4. Both (i) and (ii)

+4
Answers (1)
  1. 17 April, 10:15
    0
    Option (2) i. e., Only (ii) is the correct option to the following question.

    Explanation:

    Here, in the following code that is written in the Java Programming Language in which they set integer data type array variable "alpha" and set its index to 3 through "new" keyword then, we get input from the user in the index 0 then, we get input from the user in the index 1 then, again we repeat this step for index 2. So, that's why the following option is correct.

    Option 1 is wrong because in this option the user input only in the index 0 and this is also the wrong way to insert value in the array variable.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Consider the following declaration. int[] alpha = new int[3]; Which of the following input statements correctly input values into alpha? ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers