Compt 1
Compt 1
Xfint a, float b)
a) Default Constructor
b) Parameterized Constructor
c) Non-Parameterized Constructor
d) Copy Constructor
a) 0
b) 1
2 volle adt aot biowreol ndi inbl
d) 5
(xii) Find out the value of X:
double X=Math.sqrt{Math.abs(Math.ceil(20.8 30.6);
a) 3.0
b) 3.16
c) 2.0
d) 2.8
Page 2 of 5
xv) Identify the type of of n (if n-4 then
Factorial of
4-1x2x3x4-24). error
O to to find
find out the
factorial
class Factorial
ooto d) Long
within the same class
accessible only
modifier which is
the a c c e s s
(xox) Identify declared.
where it is
a) class
b) private
c) protected
d) public
Page 3 of 5
X-Com Abp
Question 2
Evaluate the following expression and finout thne value of A.(Show working [2x10-20
int A-50,x=20;
A/=x++ %9-++x/(7+3) +x
iDefine infinite loop and give example using while loop. pildug
Write the java
expressions for
iv)
L
a) | A2+ 3B3 b a''s=Va
Wite down the
int x-8, y=50; output
of the following statement. (Show
working)
intz= x*10>y+30? x*10+y: x<=y/5? *y: Y/x;
What is the value of x if int n[l-2,5,7,8,9,11,3) (Show working)
,
int
x=Math.min(n|4],n[6|) n[n.length-2]* 10;
+
number of lines
$$$$
$$$
$$
when ch $'and n =4]
Write the main()
=
Questlon 8
Define a class ElectricBill with the following specifications:
Class Name ElectricBill
Instance variables /data member:
String n - to store the name of the customer
int units - to store the number of units consumed
double bill - to store the amount to be paid
Member methods initialize data members with their
default values.
( ) Default constructor to
ElectricBill -
consumed by a customer.
number of unit
void accept() To accept name and
-
Write a main() method to create an object of the class and call the above member methods.
* * * * * *k*******************