Page 216 - Cs_withBlue_J_C11_Flipbook
P. 216

16.  Write a program to display the following pattern using switch case.
                     i. 1                  ii.  1   2   3   4   5
                        1 0                  2   2   3   4   5
                        1 0 1                3   3   3   4   5
                        1 0 1 0              4   4   4   4   5
                        1 0 1 0 1            5   5   5   5   5
                 17.  Write a program to display the following pattern using switch case.
                     i.  I                 ii.  COMPUTER
                         I S                 COMPUTE
                         I S C               COMPUT
                                             COMPU
                                             COMP
                                             COM
                                             CO
                                             C
                 18.  Write a program in Java to find the sum/product of the series given below:
                     s=1/2+1/4+1/6+1/8+.....+1/n
                     p=1 x a/2 x a/3 x a/4 x ....x a/n
                     s= 1+ (1+3) + (1+3+5)…..(1+3+5+…..n)
                         2
                                     2
                               2
                     s= 1/1   +  1/2   +  1/3  …………1/n 2
                                     2
                              2
                         2
                     p= 1/2  x 2/3    x  3/4  x………x n/(n+1) 2
                                                    n
                                        4
                          2
                                 3
                     s= 1+ (x /2)   +  (x /3) +  (x /4)  + ………..(x /n)
                     s= (1/1!) + (2/2!)+…….+(n/n!)
                                 3
                          2
                     s= x+ (x /2!) + (x /3!)+…….n
                     p= 1/1 x 2/4 x 3/6 x 4/24 x…x n
                     s= 1x + 4x + 9x + 16x + 25x + … + nx
                 19.  Write a program in Java to display all the prime Fibonacci series numbers upto n.
                     E.g., 2, 3, 5, 13, 233, etc.
                 20.  Using switch case, write a program to print the following series (1st 10 terms)
                     Case 1: Triangular number series: 1, 3, 6, 10, 15, 21, 28, 36, 45, 55
                     Case 2: Square number series: 1, 4, 9, 16, 25, 36, 49, 64, 81, 100
                     Case 3: Cube number series: 1, 8, 27, 64, 125, 216, 343, 512, 729, 1000
                 21.  Write a program to input a number and print all the prime perfect number upto n. (Prime perfect number are those numbers
                    whose all the factors are prime)
                     E.g., 6 = 1 + 2 + 3
                 22.  Write a program to compute the amount that customer pays for the taxi that he hires based on following conditions:
                     Distance              Rate
                     Up to 5 km            `75
                     For the next 10 km     `15/km
                     For the next 10 km     `10/km
                     More than 25 km       `5/km
                 23.  A school is allocates grade and remarks on the basis of total marks (total of 3 subject of 100 marks) obtained by the student as
                    per the following criteria:
                     Marks obtain          Grade allocated           Remark on grades
                     85 to 100             A                         Excellent
                     75 to 84              B                         Distinction
                     60 to 75              C                         Good
                     40 to 60              D                         Fair
                     less than 40          E                         Need improvement
                     Write a program to input 3 subject marks and print total marks, grade allocated and remark given.




                214214  Touchpad Computer Science-XI
   211   212   213   214   215   216   217   218   219   220   221