Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Q1/
- 1. B (null)
- 2. C (a[0][2])
- 3. A (boolean)
- 4. C (Switch-case)
- 5. D (All of them)
- 6. A (for)
- 7. C (\n)
- 8. B (if(grade!=1))
- 9. index
- 10. D (column,row)
- Q2/A
- 1. switch => Switch is a condition for switch-case statement, where the you write cases for it.
- 2. index => index is a position of an array element, starts from 0 to length of the array minus one.
- 3. Multidimensional arrays with two dimensions are often used to represent tables of values consisting of information arranged in rows and columns.
- 4. nested loop => A nested loop is a loop that appears in the loop body of another loop.
- 5. repetition statement => repetition statements that enable programs to perform statements repeatedly as long as a condition remains true.
- Q2/B
- 1. False - String value
- 2. False - ||
- 3. False - %s
- 4. True
- 5. False - We don't need loop statement
- 6. True
- 7. True
- 8. False - without using counter value
- 9. True
- 10. False - Can Store Only one type of value
- Q3/A
- Counter-controlled repetition is often called definite repetition, because the number of repetitions is known before the loop begins executing.
- Sentinel-controlled repetition is often called indefinite repetition because the number of repetitions is not known before the loop begins executing.
- Q3/B
- package javaapplication80;
- public class JavaApplication80 {
- public static void main(String[] args) {
- int[][] a = {{0,1,2}, {3,4,5}, {6,7,8}, {9,10,11}};
- for (int row = 0; row < a[0].length; row++) {
- int total = 0;
- for (int col = 0; col < a.length; col++) {
- total += a[col][row];
- }
- System.out.println("Col" + row + ": " + total);
- }
- }
- }
Add Comment
Please, Sign In to add comment