Refine
All questions
351 resultsA do-while loop always runs at least once, even if the test condition is initially false.
Show answer
In a for loop, you can use the comma operator to include multiple initialization/update expressions, e.g., for(x=0,y=10; x<10; x++,y--).
Show answer
Differentiate between a while loop and a do-while loop (name at least two differences).
Show answer
Write the Java syntax for the if-else, switch, while, do-while, and for statements.
Show answer
An array in Java is used to:
Show answer
In Java, array indices start from:
Show answer
For an array declared as double[] marks = new double[5];, what is the valid range of index values?
Show answer
Which property of an array gives its size (number of elements)?
Show answer
What exception is thrown when an array is accessed using an index outside its valid range?
Show answer
A method in Java is best described as:
Show answer
Which return type is used for a method that does NOT return any value?
Show answer
What does the 'static' modifier allow, when applied to a method?
Show answer
In a method call, the values supplied are copied into the method's:
Show answer
Array indices in Java range from 0 to n, where n is the size of the array.
Show answer
A method's parameter list acts like regular local variables within the method body.
Show answer
How do you declare and initialize an array of 5 doubles named 'marks' with size specified separately from declaration?
Show answer
Write the syntax structure of a user-defined method in Java.
Show answer
Write a static Java method 'rectangle_area' that takes length and breadth (both double) as parameters and returns the area of the rectangle. Also show how to call it from main and store the result.
Show answer
In Object Oriented Programming, a program is viewed as:
Show answer
A class is best described as: