Ask Question

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)

+3
Answers (1)
  1. 10 December, 10:38
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers