

(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


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 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
