Page 397 - ComputerScience_Class_11
P. 397

GERMANY         BERLIN
                            NEPAL            KATMANDU
                            JAPAN            TOKYO
                           CANADA           MONTREAL
                           IRAQ             BAGHDAD
                    12.  The annual examination result of 50 students in a class is tabulated as follows:
                         Roll No.  Subject A  Subject B  Subject C
                            –         –          –          –
                        Write a Java program to read the data, calculate and display the following:
                        a.  Average marks obtained by each student.
                        b.  Print the roll number and average marks of the students whose average mark is above 80.
                    13.  Write a Java program to store the names of the 10 politicians and their parties to which they belong to in two separate arrays. Ask
                       the users to enter the name of the party. Print out all the names of the politicians who belong to that party. Repeat the process
                       according to user choice.
                    14.  Write a Java program to generate 10 terms of the Fibonacci series in a single-dimensional array.
                    15.  Write a Java program to input 10 different numbers and arrange them in such a way that all the even numbers are arranged in
                       ascending order followed by all odd numbers.
                    16.  Create a square matrix of size M × M and check whether it is a symmetric matrix or not. A symmetric matrix is a square matrix
                       that is equal to its transpose.
                    17.  Write a Java program to generate a Pascal triangle in which each number in the row is the sum of the two numbers immediately
                       above it. The program should print the first six rows of the triangle.
                        (Hint: E[J.I]  =  P[I-1,J-1] + P[I-1,J] is true for all elements but the boundary elements which are all equal to 1)
                    18.  Write a Java program to input elements in a 3x3 matrix and swap the numbers of the 1st row with the 3rd row of a given matrix.
                    19.  Write a Java program to create a 3x3 matrix and print the highest value of each column in the following manner.
                        5    7   4
                        4    6   2
                        8    2   10
                        Highest value in column 1 = 8
                        Highest value in column 2 = 7
                        Highest value in column 3 = 10

                    20.  Write a Java program to declare a square matrix M [ ] [ ] of order ‘N’ where ‘N’ must be greater than 3 and less than 10. Allow the
                       user to accept three different characters from the keyboard and fill the array according to the instructions given below:
                        (i)   Fill the four corners of the square matrix by character 1.
                        (ii)   Fill the boundary elements of the matrix (except the four corners) by character 2.
                        (iii)  Fill the non-boundary elements of the matrix by character 3.
                        Test your program with the following data and some random data:
                        INPUT: N = 4
                        FIRST CHARACTER   :    @
                        SECOND CHARACTER   :    ?
                        THIRD CHARACTER   :    #
                        OUTPUT:
                        @    ?    ?    @
                        ?    #    #    ?
                        ?    #    #    ?
                        @    ?    ?    @




                                                                                                           Arrays  395
   392   393   394   395   396   397   398   399   400   401   402