Output Questions for Class 10 ICSE Computer Applications
Java Iterative Stmts
State the final value of q at the end of the following program segment after execution. Show the dry run.
for(m=2;m<=3;++m) { for(n=1;n<=m;++n) { p=m+n-1; if(p%3 == 0) q += p; else q += p+4; } }View Answer44 Likes
Java Iterative Stmts
What will be the output of the following code?
int m=2; int n=15; for(int i=1;i<5;i++) m++; --n; System.out.println("m="+m); System.out.println("n="+n);View Answer260 Likes
Java Iterative Stmts
The following is a segment of a program.
x = 1; y = 1; if(n>0) { x = x + 1; y = y + 1; }What will be the value of x and y, if n assumes a value:
(i) 1
(ii) 0
View Answer65 Likes
Java Iterative Stmts
Give the output of the following program segment and also mention the number of times the loop is executed.
int a,b; for(a=6;b=4; a <= 4; a=a+ 6) { if(a%b==0) break; } System.out.println(a);View Answer57 Likes
Java Iterative Stmts
Analyze the following program segment and determine how many times the loop will be executed. What will be the output of the program segment?
int k=1,i=2; while(++i<6) k*=i; System.out.println(k);View Answer125 Likes
Java Iterative Stmts
Give the output of the following program segment and also mention how many times the loop is executed.
int i; for(i = 5; i > 10; i++) System.out.println(i); System.out.println(i * 4);View Answer127 Likes
Java Iterative Stmts
Analyze the following program segment and determine how many times the body of the loop will be executed (show the working).
x = 5; y = 50; while(x<=y) { y = y / x; System.out.println(y); }View Answer133 Likes
Java Iterative Stmts
Determine how many times the body of the loop will be executed and predict the output.
class dk4 { public static void main(String args[]) { int x=5,y=50; while(x<=y) { y=y/x; System.out.println(y); } } }View Answer67 Likes
Java Iterative Stmts
Predict the Output of the following Java program:
class dk2 { public static void main(String args[]) { int i=2,k=1; while (++i<6) k *= i; System.out.println(k); } }View Answer102 Likes
Java Iterative Stmts
Predict the Output of the following Java program:
class dk3 { public static void main(String args[]) { int m=2,n=15; for(int i=1;i<=5;i++) { m++;--n; System.out.println("m="+m); System.out.println("n="+n); } } }View Answer84 Likes
Showing 131 - 140 of 147 Questions