Page 141 - CA_Blue( J )_Class9
P. 141

4.  Which of the following is a beginning of a comment?
                        a.  //*                                        b.  ///
                        c.  /***                                       d.  /*
                    5.  Which of the following methods is used to input a double value using Scanner class?
                        a.  next()                                     b.  nextInt()
                        c.  nextDouble()                               d.  nextFloat()

                 B.  Fill in the blanks.
                    1.  Three types of errors are …………………, ………………… and ………………….
                    2.  Using InputStreamReader class, values are taken from the users whenever required at the time of ………………….
                    3.  All input values taken from the user are initially in the form of ………………….
                    4.  The method Float.parseFloat(br.readLine()); will return a ………………… value.
                    5.  ………………… is the process of identifying errors in the program code.

                 C.  Answer the following questions.

                    1.  What is the difference between Single-line comment, Multiline comment and Documentation Comment?
                    2.  What is the difference between Syntax error, Logical error and Runtime error.
                    3.  What is InputStreamReader?
                    4.  Write the difference between try and catch.
                    5.  What are Java Comments?
                    6.  Write an example of a runtime error.
                    7.  Name the methods of Scanner class that is:
                        a.  Used to input an integer value             b.  Used to input a line
                        c.  Used to input a character                  d.  Used to input a real number of 64 bits.
                        e.  Used to input a short integer.
                    8.  What do you mean by debugging?

                 D.  Assertion and Reasoning based question.

                     Assertion(A): Debugging is a process of fixing the errors found while the code was undergoing the testing phase.
                     Reason(R): This is done mainly to remove the errors.
                     (a)   Both Assertion (A) and Reason (R) are true and Reason (R) is a correct explanation of Assertion (A).
                     (b)  Both Assertion (A) and Reason (R) are true and Reason (R) is not a correct explanation of Assertion (A).
                     (c)   Assertion (A) is true and Reason (R) is false.
                     (d)  Assertion (A) is false and Reason (R) is true.
                                                                                     21 st   #Problem Solving & Logical Reasoning
                 E.  More unsolved programs                                        Century   #Interdisciplinary
                                                                                    Skills
                    1.  Write a program to input two numbers in two variables and interchange the values in the variables. (Using a third
                        variable).
                    2.  Write a program to input the cost price of an item. If the item was sold at a profit of Rs. 50. Print the selling price and
                        the Profit percentage.
                    3.  Write a program to accept the number of days and convert it to number of years and months.
                    4.  Write a program to input the side of a square and print the diagonal and perimeter.
                    5.  Write a program to input the name and daily wages of a person. Calculate the monthly income of the person. If the
                        monthly income is more than Rs. 10000, then the person has to pay the tax of 500.
                    6.  A company offers 15% discount on its products. But the customer has to pay 18% GST on the remaining amount.
                        Write a program to input name of the customer and price of the item. Calculate and display name and the amount to
                        be paid by the customer.
                    7.  Write a program to input the distance in m and convert it into km. Suppose the travelling cost of 1 km using a vehicle
                        is Rs. 10. Print the total cost of travelling.
                    8.  Write a program to input a temperature and convert a given temperature from Fahrenheit to Celsius and vice-versa.



                                                                                                   Input in Java   139
   136   137   138   139   140   141   142   143   144   145   146