Computer - Full 1
Computer - Full 1
1. Assertion(A): The break statement is used at the end of each case and is referred
to as case terminator. However, you can write statement even after break for any
specific case.
Reason(R): It forces the control to exit the switch block.
2. Assertion(A): Math.ceil( ) returns the lower integer number that is less than or
equal to the argument.
Reason(R): It always returns the value as a double data type.
3. Assertion(A): Operators are special signs or symbols used to perform operations in
java programming.
Reason(R): They are considered as tokens.
4. Assertion(A): While assigning a float data value to a variable, you must use letter
‘F’ or ‘f’ as suffix along with value.
Reason(R): It will assist the compiler to know the data type that you are going to
use in the program
5. Assertion(A): A class is used to create similar objects that possess different
characteristics and common behavior.
Reason(R): Class is an object factory.
C. Java Expression:
[5×2=10]
4 π
1. a−1 + 3 ab
2. √5 4 +133
4 3
3. πr
3
ab+bc +ca
4. Z=
3 abc
2 2
a +b
5. f= 2 2
a −b
1. double a=-6.35;
double b=14.74;
double x= Math.abs(Math.ceil(a));
double y=Math.rint(Math.max(a,b)); the value of x and y ?
[3]
2. double m= Math.cbrt(9.261);
int p= Math.abs (Math.max(-91,-97)); the value of m and p ?
[3]
3. If a= 48, b=13; find the value of a+ = b++ *5/a++ +b;
[2]
4. Rewrite using Ternary Operators:
[2]
if((a+b)>c)
{
k=15;
System.out.println(k);
}
if((a+b)<c)
{
k=30;
System.out.println(k);
}
E. A cloth showroom has announced festival discounts and gifts on the purchase of
items, based on the total cost as given below:
Write a java program to input the total cost. compute and display the amount to be paid by the
customer along with the gift. [15]
F. The equivalent Resistance of series and parallel connections of two resistances is given by the
formula:
r1 × r2
(A) R1= r1+r2 (Series) (B) R2= (Parallel)
r 1+r
2
Using switch case statement, write a program to enter the value of r 1 and r2.
Calculate and display the equivalent resistance accordingly.
[15]
**** All The
Best ****