English

As a homework assignment, your computer teacher has given an incomplete program to accept the integer numbers in a 3x4 double dimensional array. - Computer Applications

Advertisements
Advertisements

Question

As a homework assignment, your computer teacher has given an incomplete program to accept the integer numbers in a 3x4 double dimensional array. The program has some places left blank marked with ?1?, ?2?, ?3? and ?4? to be filled with appropriate keyword / expression as shown below:

import java.util.*;
class Sum
{
    public static void main(String args [])
    {
      Scanner in=new Scanner(....?1?......);
      int 1, j, s = 0;
      int m[][] = .........?2?.........;
      System.out.println(“Enter the numbers in the matrix”);
      for (i = 0; i < 3; i++)
      {
        for (j = 0; j < 4; j++)
          m[i][j] = ........?3?.......;
      }
    for (i = 0; i < 3; i++)
      {
      for (j = 0; j < 4; j++)
        if (.....?4?.....)
          s = s + m[i][j];
      }
      System.out.println(“Sum of even numbers in the matrix: " + s);
    }
} 

Based on the above discussion, answer the following questions:

  1. What keyword / expression will be filled in place of ?1?
  2. What keyword / expression will be filled in place of ?2?
  3. What keyword / expression will be filled in place of ?3?
  4. What keyword / expression will be filled in place of ?4?
Answer in Brief

Solution

  1. System.in
  2. new int[3][4]
  3. in.nextlnt()
  4. m[i][j] % 2 == 0
shaalaa.com
  Is there an error in this question or solution?
Chapter 3: Arrays (Single Dimensional and Double Dimensional) - Review Insight [Page 237]

APPEARS IN

Avichal Computer Applications [English] Class 10 ICSE
Chapter 3 Arrays (Single Dimensional and Double Dimensional)
Review Insight | Q 13. | Page 237
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×