Please select a subject first
Advertisements
Advertisements
Study the method and answer the given questions.
public void sampleMethod()
{ for (int i=0; i < 3; i++)
{ for (int j = 0; j<2; j++)
{int number = (int) (Math.random() * 10);
System.out.println(number); } } }
(i) How many times does the loop execute ?
(ii) What is the range of possible values stored in the variable number ?
Concept: undefined >> undefined
Study the method and answer the given questions.
public void sampleMethod()
{ for (int i=0; i < 3; i++)
{ for (int j = 0; j<2; j++)
{int number = (int) (Math.random() * 10);
System.out.println(number); } } }
(i) How many times does the loop execute ?
(ii) What is the range of possible values stored in the variable number ?
Concept: undefined >> undefined
Advertisements
Using the switch statement, write a menu driven program to calculate the maturity amount of a Bank Deposit.
The user is given the following options :
(i) Term Deposit
(ii) Recurring Deposit
For option (i) accept principal (P), rate of interest(r) and time period m years(n). Calculate and output the maturity amount (A) receivable using the formula
`"A" = "P"[1+"r"/100]^"n"`
For option (ii) accept Monthly Installment (P), rate of interest (r) and time period in months (n). Calculate and output the maturity amount (A) receivable using the formula
`"A" = "P" xx "n" + "P" xx ("n"("n" + 1))/2 xx "r"/100 xx 1/12`
For an incorrect option, an appropriate error message should be displayed.
Concept: undefined >> undefined
Write a program to accept the year of graduation from school as an integer value from, the user. Using the Binary Search technique on the sorted array of integers given below.
Output the message “Record exists” If the value input is located in the array. If not, output the message “Record does not exist”.
{1982, 1987, 1993, 1996. 1999, 2003, 2006, 2007, 2009, 2010}.
Concept: undefined >> undefined
State the value of y after the following is executed:
char x = '7';
y = Character.isLetter(x);
Concept: undefined >> undefined
The access modifier that gives the most accessibility is ______
Concept: undefined >> undefined
The Scanner class method used to accept words with space:
Concept: undefined >> undefined
What value will Math.sqrt (Math.ceil (15.3)) return?
Concept: undefined >> undefined
The absence of which statement leads to fall through situation in switch case statement?
Concept: undefined >> undefined
Write a method prototype name check() which takes an integer argument and returns a char:
Concept: undefined >> undefined
The number of values that a method can return is ______.
Concept: undefined >> undefined
The code obtained after compilation is known as ______.
Concept: undefined >> undefined
Consider the following program segment and select the output of the same when n = 10:
switch(n)
{Case 10: System.out.println(0*2);
case 4: System.out.println(n*4); break;
default : Syslem.out.println(n);
}Concept: undefined >> undefined
A method which does not modify the value of variables is termed as ______.
Concept: undefined >> undefined
Write the Java expression for (a + b)x.
Concept: undefined >> undefined
Evaluate the expression when the value of x = 4;
x* = - - x + x + + + x
Concept: undefined >> undefined
Convert the following do...while loop to for loop:
int x = - 10;
do
{x - -;
System.out.print(x);
}while(r >= 1);Concept: undefined >> undefined
Rewrite the following code using the if-else statement:
int m = 400;
double cl). = (m>300) ? (m/10.0) * 2; (m/20.0) - 2;Concept: undefined >> undefined
Give the output of the following program segment:
int n = 4279; int d;
while(n>0)
(d=n%10;
System.out.println(d);
n=n/100;
}Concept: undefined >> undefined
Name the following:
The method which has same name as that of the class name.
Concept: undefined >> undefined
