The character and string manipulations have been designed separately along with the inclusion of Double Dimensional Array (DDA). It is advised to refer 'Understanding Computer Applications with BlueJ', Class IX book for comprehensive understanding of the concepts. The first chapter recapitulated the entire syllabus of Class IX in concise form. The main thrust of the book is to deal with Object Oriented Programming in Java with BlueJ. This book, has been thoroughly revised as per the latest ICSE curriculum. Otherwise display “Triangle not possible”.APC Understanding Computer Applications with BlueJ for ICSE Class examination. If possible then check whether it is an acute angled triangle, right-angled triangle or an obtuse-angled triangle. Since the return type of Math.pow( ) and Math.sqrt( ) is double, variables ‘k’ and ‘r’ should be declared as double.ġ) Write a program to input three angles of a triangle and check whether a triangle is possible or not. (“The value of”+n+ “ = ”+r) Įquality operator is =. Incorrect data type of d ‘d’ should be declared as double Math.pow should be used d=Math.pow((a+b),2) Superscript cannot be used in Java like this. Math.pow or a*a format should be used c= a*a + b*b n should be compared with r *r (that is r 2 ) if(n=r*r) Only the integer part of the square root should be taken to check for perfect square number. Incorrect data type Math.sqrt returns double data type so ‘r’ should be declared as double Variables should be printed using separate print statements or they can be printed with a blank or tab inbetween. Missing declaration diff should be declared as double Missing declaration sum should be declared as int Incorrect data type c should be declared as double/float Incorrect order and missing class name public class Cname Correct the errors in the given programs: The output is 5.0499997 since the else part is executed as 15.15f/3 Therefore, the output is as follows:Ĭorrections to be made : k should be initialized to 0 and float a=15.15f Ii) when n=0, the condition n>0 becomes false and therefore the values of x and y are not incremented. I) when n=1, the condition n>0 becomes true and therefore the values of x and y are incremented. What will be the value of x and y, if n assumes a value i) 1 ii) 0 Thus, in a nested if statement, one if statement is placed within another if statement. The term nested means one action is taken within another action. Explain the following statements with their constructs: The switch-case statement also includes a ‘default’ case which is executed when the switch value does not match any of the given cases.Ĭase 1: // This block is executed if the value of control variable is ‘1’Ĭase 2: // This block is executed if the value of control variable is ‘2’Ĭase 3: // This block is executed if the value of control variable is ‘3’ĭefault: // This block is executed when there is no matching case for the control variableģ. In this system, the control goes to a specific case and executes that block for a given switch value (value of the control variable). Switch case statement is a multiple branching statement where a particular block of statements is executed out of a number of available options as per the user’s choice. Bi-directional flow of control can be achieved by using ‘if’ statement the following ways: This is referred to as Bi-directional flow of control. Thus, the block of statements which get executed depends on the condition defined. If the given condition is false, then the block is ignored and control moves to execute another block. Sometimes, the programmer may want to operate a block of statements when the given condition is true. The flow of control during the execution of a Java program takes place in the following ways:Ģ. Name the different ways to manage the flow of control in a program. It is due to:Ī) the logical error in the program b) the syntax error in the programĬ) the runtime error in the program d) noneĢ. A Java program executes but doesn’t give the required output. Which of the following statements accomplishes ‘fall through’?ġ0. Which of the following is a conditional statement?ĩ. Two arithmetic expressions can be compared with if statement using:Ī) Arithmetic operator b) Relational operatorĨ. If a, b and c are the sides of a triangle then which of the following statement is true for: if(a!=b & a!=c & b!=c)?Ī) Equilateral triangle b) Scalene triangleħ. If (a>b)&(a>c) then which of the statement is true?Ī) b is the smallest number b) b is the greatest numberĬ) a is the greatest number d) all of the aboveĦ. Condition is essentially formed by using:Ī) Arithmetic operators b) Relational operatorsĤ. In a switch case, when the switch value does not respond to any case then the execution transfers to:Ģ.Which of the following is a compound statement?Ī) p=Integer.parseInt(in.readLine()) b) c=++a ģ.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |