![blue pelican java textbook recursion solutions blue pelican java textbook recursion solutions](https://www.coursehero.com/thumb/28/d3/28d3850f8217dfbef8cccfb38df842e1faf9aec9_180.jpg)
(ii)When the value of ‘val’ is 7 initially, in A value ‘val’ changes from 7 to 10 and in B, it will result in false as 10 is not equal to 7 (ii)What will be the result of the two if value of ‘val’ is 7 initiallyĪns : (i) The expression in A is an assignment statement ,the value of ‘val’ is assigned as 10 whereas the expression B is a test for equality, the value of ‘val’ is compared to 10. (b)Given the following expressions: A) val=10 B) val=10
![blue pelican java textbook recursion solutions blue pelican java textbook recursion solutions](https://i.gr-assets.com/images/S/compressed.photo.goodreads.com/books/1348210057i/300092._UY630_SR1200,630_.jpg)
(a)If the parameter ‘i’ is given the value of 10, in the following program then what is the output Īns : The output of the program will be : (e)Mention any two characteristics of a Constructor ? Īns : The two characteristics of a Constructor are :ġ.It has the same name as that of a classĢ.It does not return any value of any datatype (ii)Exception : The unexpected error which is raised in the program during its execution, is known as Exception, it can be managed by ‘Exception Handling’ Examples : Number Format Exception, String Out Of Bounds Exception, etc (d)Explain the terms : (i)Keyword ‘this’ (ii)Exception Īns : (i)Keyword ‘this’ : It is used in Java programming to reference the data members of the current object of a class, there may be many objects in a class, and these objects have different values for their data members, therefore to point out to a particular object, the keyword ‘this’ is used in Java Programming. (c)What are the pre-conditions for binary search to be performed for a Binary search be performed on a Single Dimensional Array? Īns : The elements of the array should be in a sorted order i.e., either in ascending order or in descending order (ii)this is explicit type casting, the outcome will be 10.5 in float datatype (b)What are the types of type casting shown by the following and state the outcome result? Īns : (i) this is implicit type casting, the outcome will be 99 in float datatype (a)State the difference between primitive datatypes and user-defined datatype ġ.Primitive datatypes are defined implicitly, they are in-built datatypes whereas user-defined datatypes are defined by the user during the execution of the programĢ.Primitive datatypes are not dependent on any other datatypes whereas user-defined datatypes are directly or indirectly dependent on Primitive datatypesĮxample of primitive datatypes : int,float,double.String,char, etc
Blue pelican java textbook recursion solutions series#
Of days are 28 or 29 “) ĭefault : (“Wrong Choice “) Ĥ.Write a program to display the following pattern :ĥ.Write a Program in java to obtain the first eight numbers of the following series :Įxample of each Primitive datatype: int i = 8 (num+ ” is not a special two digit number “) ģ.Write a Java Program to accept a month using Scanner class, and display the number of days present in that month
![blue pelican java textbook recursion solutions blue pelican java textbook recursion solutions](http://www.bluepelicanjava.com/images/answerBookC.gif)
Static void test(int num)//user inputs a two-digit number Write a program in java to check whether a number is special two-digit number or not A special two-digit number is such that when the sum of its digits is added to the product of its digits, the result is equal to original numberĤ5+14 = 59 Therefore, 59 is a special two digit number (“Charge excluding fractional part is Rs.”+(icharge+rcharge)) (“Remaining weight after deducing 1Kg “+rwt) Static void test(double wt)//user enters the weight in KGs Write a Program to calculate charges for sending particles when the charges are as followsįor the first 1KG Rs.15.00, For additional weight, for every 500gm or fraction thereof: Rs 8.00