Computer Science, asked by BBS12121, 8 hours ago

A. int y = ++x + x++ + --x + x++; consider x = 5, Value of y is:


i. 25

ii. 24

iii. 26

iv. 27


B. int n=500;

while (n>10)

{

n=n/10;

}

System.out.println(n);

How many time the loop is executed and what is the output?

i. Loop execute 3 times, and the output is 5.

ii. Loop execute 1 time, and the output is 10.

iii. Loop execute 2 times, and the output is 5.

iv. It will show error.

C. int k=1;

while(k<=10)

{

System.out.print(k-1);

k++;

if(k >= 7)

break;

}

The output will be:

i. 1 2 3 4 5 6 7

ii. 1 2 3 4 5 6

iii. 0 1 2 3 4 5

iv. 0 1 2 3 4 5 6 7

D. for(int x=1;x<=10;x++)

{

if(x <= 5)

System.out.print((x*x) + “ “);

}

The output will be:

i. 1 4 9 16 25

ii. 1 4 9 16

iii. 1 4 9 16 25 36

iv. 1 4 9


E. if ( a > b )

System.out.print(a+b); //LINE1

System.out.print(a*b); //LINE2

when int a = 3 and int b = 8
PLS CORRECT ANSWERS
FOR (E) NO OPTION ONLY ANSWER PLS

Answers

Answered by KesavanCSE
0

Answer:

A) 24

B) Loop execute 2 time, output is 5.

C) 0 1 2 3 4 5

D)1 4 9 16 25

E) 24

Similar questions