Question
class array_output
{
public static void main(String args[])
{
int array_variable [] = new int[10];
for (int i = 0; i < 10; ++i) {
array_variable[i] = i/2;
array_variable[i]++;
System.out.print(array_variable[i] + " ");
i++;
}
}
}
a.
0 2 4 6 8
b.
1 2 3 4 5
c.
0 1 2 3 4 5 6 7 8 9
d.
1 2 3 4 5 6 7 8 9 10
Posted under Java Programming
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. What is the output of this program?
Similar Questions
Discover Related MCQs
Q. Which of these is necessary condition for automatic type conversion in Java?
View solution
Q. What is the prototype of the default constructor of this class?
public class prototype { }
View solution
Q. If an expression contains double, int, float, long, then the whole expression will be promoted into which of these data types?
View solution
Q. What is Truncation is Java?
View solution
Q. Which of these operators is used to allocate memory to array variable in Java?
View solution
Q. Which of these is an incorrect array declaration?
View solution
Q. Which of these is an incorrect Statement?
View solution
Q. Which of these is necessary to specify at time of array initialization?
View solution
Q. Generics does not work with?
View solution
Q. How to sort an array?
View solution
Q. How to copy contents of array?
View solution
Q. Can you make an array volatile?
View solution
Q. Where is array stored in memory?
View solution
Q. An array elements are always stored in ________ memory locations?
View solution
Q. What is the range of short data type in Java?
View solution
Q. What is the range of byte data type in Java?
View solution
Q. An expression involving byte, int, and literal numbers is promoted to which of these?
View solution
Q. Which of these literals can be contained in float data type variable?
View solution
Q. Which data type value is returned by all transcendental math functions?
View solution
Q. How to format date from one form to another?
View solution
Suggested Topics
Are you eager to expand your knowledge beyond Java Programming? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!