JAVA Output Finding Questions
Java Output Finding Questions (Set 1)
Quiz-summary
0 of 10 questions completed
Questions:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Information
Welcome to the Quiz….
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading...
You must sign in or sign up to start the quiz.
You have to finish following quiz, to start this quiz:
Results
0 of 10 questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 points, (0)
Categories
- Not categorized 0%
-
Thanks for Playing…
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- Answered
- Review
-
Question 1 of 10
1. Question
Q. What will be the output
boolean b;
int d, as=290;
int x1=100, x2=200, x3=300 ;
b=x1*2==x3
System.out.println(“B=”+ b);
b=(x3-2*x2<0)||((x3=400)<2*x2)
System.out.println(“B=”+ b);
d= as-++x1>x2? x1:x2
System.out.println(“D=”+ d);Correct
Incorrect
-
Question 2 of 10
2. Question
Find the Output
int i=15, j=7;
System.out.println(i- – & – -j);
System.out.println(++i | ++j);Correct
Incorrect
-
Question 3 of 10
3. Question
Find Output
int i=10;
int n=i++%5
System.out.println(“i= ” + i );
i%=n+1;
System.out.println(“n= ” + n );Correct
Incorrect
-
Question 4 of 10
4. Question
Find Output
int k,j;
j=10;
for(k=1;k<=5;++k)
{
System.out.println(j);
j+=5;
}Correct
Incorrect
-
Question 5 of 10
5. Question
Find Output
int m=100;
while(m>0)
{
if (m<10)
break;
m=m-10;
}
System.out.println(“m is “+m);Correct
Incorrect
-
Question 6 of 10
6. Question
Find the Output
int f =1,i=2;
while (++i <5)
f *=i;
System.out.println(f);Correct
Incorrect
-
Question 7 of 10
7. Question
Find the Output
int a = 5, b = 1, k = 9 ;
while( k > 1)
{
System.out.println (a);
System.out.println (b);
a = a – b ;
b = b + 2;
if (a == b)
{
k = 9 ;
}
else
{
k = k – 3;
}
}Correct
Incorrect
-
Question 8 of 10
8. Question
Find Output
int s = 14 ;
if (s < 20 ) System . out . print ( “Under“ ) ; else System . out . print ( “Over“ ) ; System . out . println ( “the limit“ ) ;Correct
Incorrect
-
Question 9 of 10
9. Question
Find Output
int i = 3 , n = 0 ;
while ( i < 4 )
{
n++;
i- -;
}
System.out.println (n) ;Correct
Incorrect
-
Question 10 of 10
10. Question
Find Output
int val=100 , res, n=1000;
res=n+Val>1750? 400:200;
System.out.println(res);Correct
Incorrect
Java Output Finding Questions (Set 2)
Quiz-summary
0 of 10 questions completed
Questions:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Information
Welcome to the Quiz…
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading...
You must sign in or sign up to start the quiz.
You have to finish following quiz, to start this quiz:
Results
0 of 10 questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 points, (0)
Categories
- Not categorized 0%
-
Thanks for Playing…
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- Answered
- Review
-
Question 1 of 10
1. Question
Find Output
int cnt=8,num=4;
cnt- -;
num++;
System.out.println(“”+cnt+”,”+num);
– -cnt;
++num;
System.out.println(“”+cnt+”,”+num);
num=num++ + – -cnt;
System.out.println(“”+cnt+”,”+num);Correct
Incorrect
-
Question 2 of 10
2. Question
Find Output
int x=2;
int y=++x;
System.out.print(x);
System.out.print(y);
System.out.print(x++);Correct
Incorrect
-
Question 3 of 10
3. Question
Find Output
int x=1;
int y=x++;
System.out.print(x++);
System.out.print(y+x);
System.out.print(++y);Correct
Incorrect
-
Question 4 of 10
4. Question
Find Output
int varl=10, var2=20;
for (int i=1; i<=2; i++) { System.out.print(varl++ +"\t" + --var2 +"\n"); System.out.print(var2-- +"\t" + ++varl +"\n"); }Correct
Incorrect
-
Question 5 of 10
5. Question
int i, j, k;
for(i=1; i<=4; ++i) { for(k=1,j=i;k<=i; k++, j+=2) System.out.print(" "+j); System.out.println(""); }Correct
Incorrect
-
Question 6 of 10
6. Question
What will be the value of sum
double i,sum=2;
for(i=3;i<8;++i)
{
if(i%4==0)
{
break;
sum=Math.pow(sum,i);
}
else
sum+=i/2;
}Correct
Incorrect
-
Question 7 of 10
7. Question
Find Output
String st=”New to Information Technology”;
System.out.println(st.replace(“Technology”,”Practices”));
System.out.println(st.substring(7));Correct
Incorrect
-
Question 8 of 10
8. Question
Find Output
int x = 10;
int y = 20;
if (( x < y ) || (x = = 5) > 10)
System.out.println(x);
else
System.out.println(y);Correct
Incorrect
-
Question 9 of 10
9. Question
Find Output
int I=0;
label :
while(I<2)
{
System.out.print("I is " +I);
I++;
continue label;
}Correct
Incorrect
-
Question 10 of 10
10. Question
Find Output
int f=1,i=2;
do
{
f*=i;
} while(++i <5);
System.out.println(f);Correct
Incorrect
Java Output Finding Questions (Set 3)
Quiz-summary
0 of 10 questions completed
Questions:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Information
Welcome to the Quiz…
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading...
You must sign in or sign up to start the quiz.
You have to finish following quiz, to start this quiz:
Results
0 of 10 questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 points, (0)
Categories
- Not categorized 0%
-
Thanks for Playing….
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- Answered
- Review
-
Question 1 of 10
1. Question
How many times does the following loop execute?
for(int i=1;i<=5;i++) { System.out.println(i); }Correct
Incorrect
-
Question 2 of 10
2. Question
Find Output
double Number = 7583241;
int First = 0, Second = 0, R;
do
{
R = Number % 10;
if ( R % 2 == 0 )
First += R;
else
Second += R;
Number = Number / 10;
} while (Number > 0);
System.out.print(First – Second );Correct
Incorrect
-
Question 3 of 10
3. Question
What will be the output of following statement
(a>=b)||(!(c==b) && (c<a) when where a=10,b=5,c=11Correct
Incorrect
-
Question 4 of 10
4. Question
Find Output
y-x<500?150:50 //when x=300 and y=700Correct
Incorrect
-
Question 5 of 10
5. Question
Find Output
int i=10,j,k,l,m,n;
j=i+5;
k=i+j/5;
l=k+1;
m=l+1-i;
n=k+m*l;
System.out.print(i+”\n”+k+”\n”+l+”\n”+m+”\n”+n);Correct
Incorrect
-
Question 6 of 10
6. Question
Find Output
(x>=y) || (!(z==y) && (z<x)) //if x=10 , y=5, z=11Correct
Incorrect
-
Question 7 of 10
7. Question
Find Output
int z,x=3,y=2;
z = –x + y++;
System.out.println(z);Correct
Incorrect
-
Question 8 of 10
8. Question
Find Output
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)
{
display(11, 19 );
}
void display(int i, int j )
{
System.out.println(i >> j);
System.out.println(i << j);
}Correct
Incorrect
-
Question 9 of 10
9. Question
Find Output
public static void main(String[] args) {manipulate(11 );
}
static void manipulate(int i)
{
int n=i*5;
System.out.println(“i= ” + i%i++ );
i%=–n+1;
System.out.println(“n= ” + n );
}Correct
Incorrect
-
Question 10 of 10
10. Question
Find Output
int a=10,b;
b=a++ + ++a;
System.out.print(a);
System.out.print(a++);
System.out.print(a);
System.out.print(++a);Correct
Incorrect
Java Output Finding Questions (Set 4)
Quiz-summary
0 of 10 questions completed
Questions:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Information
Welcome to the Quiz…
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading...
You must sign in or sign up to start the quiz.
You have to finish following quiz, to start this quiz:
Results
0 of 10 questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 points, (0)
Categories
- Not categorized 0%
-
Thanks for Playing…
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- Answered
- Review
-
Question 1 of 10
1. Question
Find Output
int x=5,y=5;
System.out.print(x++);
System.out.print(“,”);
System.out.print(++x);
System.out.print(“,”);
System.out.print(y++);
System.out.print(“,”);
System.out.print(++y);
System.out.print(“,”);Correct
Incorrect
-
Question 2 of 10
2. Question
Find Output
int res,val=2000,n=1000;
res=n+val>1750?400:200;
System.out.print(res);Correct
Incorrect
-
Question 3 of 10
3. Question
Find Output if j=5
(5*++j)%6Correct
Incorrect
-
Question 4 of 10
4. Question
Find Output
int x=2;
int y=++x;
System.out.print(x);
System.out.print(y);
System.out.print(x++);Correct
Incorrect
-
Question 5 of 10
5. Question
Find Output
int x=1;
int y=x++;
System.out.print(x++);
System.out.print(y+x);
System.out.print(++y);Correct
Incorrect
-
Question 6 of 10
6. Question
Find Output if a,b,c are integers and d,f are floating point?
f=a+b/a; // a=5,b=3,d=1.5Correct
Incorrect
-
Question 7 of 10
7. Question
Find Output
int cnt=8,num=4;
cnt–;
num++;
System.out.println(“”+cnt+”,”+num);
–cnt;
++num;
System.out.println(“”+cnt+”,”+num);
num=num+++–cnt;
System.out.println(“”+cnt+”,”+num);Correct
Incorrect
-
Question 8 of 10
8. Question
Find Output
int a,mb=2,k=4;
a=mb*3/4+k/4+8-mb+5/8;
System.out.println(a);Correct
Incorrect
-
Question 9 of 10
9. Question
Find Output
int g=3 ;
–g ;
g = g+2;
System.out.println(“The value is” + g);Correct
Incorrect
-
Question 10 of 10
10. Question
What will be the value of x if j=5
x= (5 * ++j )/6;Correct
Incorrect
Java Output Finding Questions (Set 5)
Quiz-summary
0 of 10 questions completed
Questions:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Information
Welcome to the Quiz…
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading...
You must sign in or sign up to start the quiz.
You have to finish following quiz, to start this quiz:
Results
0 of 10 questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 points, (0)
Categories
- Not categorized 0%
-
Thanks for Playing…
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- Answered
- Review
-
Question 1 of 10
1. Question
Find Output
a=8;
b=5;
System.out.println(a&b);Correct
Incorrect
-
Question 2 of 10
2. Question
Find Output
int i=0;
for (i=0 ; i<20 ; i++)
{
System.out.println (i);
i+=2;
}Correct
Incorrect
-
Question 3 of 10
3. Question
Find Output
int i=10, j=10, a=60, b=70;
if ( a<100 )
{
if ( b<50)
++i;
a+=10;
}
else
++j;
a+=30;
System.out.println ("i =" + i) ;
System.out.println ("j =" + j) ;
System.out.println ("a =" + a) ;Correct
Incorrect
-
Question 4 of 10
4. Question
What will be the output if opn=a
switch(opn)
{
case ‘a’ : jLabel1.setText(“Platform Independent”); break;
case ‘b’ :jLabel1.setText(“Object Oriented”);
case ‘c’ : jLabel1.setText(“Secure and safe”);break;
}Correct
Incorrect
-
Question 5 of 10
5. Question
What will be the output if ch=b
switch (ch)
{
case ‘a’:System.out println(“it is a”);
case ‘b’ :System.out println(“it is b”);
case ‘c’ :System.out println(“it is c”);break;
case ‘d’ :System.out println(“it is d”);break;
default:System.out.println (“Not a b c d”);
}Correct
Incorrect
-
Question 6 of 10
6. Question
What will be the value of j=–k+2* k+(++k) if k is 20 initially?
Correct
Incorrect
-
Question 7 of 10
7. Question
What will be the value of P=P*++j where J is 22 and p=3 initially?
Correct
Incorrect
-
Question 8 of 10
8. Question
Find Output
for (int i = 0 ; i < 5 ; i++) { System.out.println(++i); break; }Correct
Incorrect
-
Question 9 of 10
9. Question
Find Output
int a=10;
int b=12;
int x=5;
int y=6;
while (a<=b) { if (a%2= =0) x=x + y; else x=x-y; a=a+1; } System.out.println(x);Correct
Incorrect
-
Question 10 of 10
10. Question
Find Value of Sum
double i,sum=2;
for(i=3;i<8;++i)
{
if(i%4= =0)
{
break;
sum=Math.pow(sum,i);
}
else
sum+=i/2;
}
System.out.println(sum);Correct
Incorrect
JAVA Class Fundamentals
Java (Class Fundamentals)
Quiz-summary
0 of 25 questions completed
Questions:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
Information
Welcome to the Quiz…
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading...
You must sign in or sign up to start the quiz.
You have to finish following quiz, to start this quiz:
Results
0 of 25 questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 points, (0)
Categories
- Not categorized 0%
-
Thanks for Playing…
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- Answered
- Review
-
Question 1 of 25
1. Question
Which of these keywords is used to make a class?
Correct
Incorrect
-
Question 2 of 25
2. Question
Which of the following is a valid declaration of an object of class Box?
Correct
Incorrect
-
Question 3 of 25
3. Question
Which of these statement is incorrect?
Correct
Incorrect
-
Question 4 of 25
4. Question
What is the output of this program?
class main_class {
public static void main(String args[])
{
int x = 9;
if (x == 9) {
int x = 8;
System.out.println(x);
}
}
}Correct
Incorrect
-
Question 5 of 25
5. Question
Which of the following statements is correct?
Correct
Incorrect
-
Question 6 of 25
6. Question
What is the output of this program?
class box {
int width;
int height;
int length;
}
class mainclass {
public static void main(String args[])
{
box obj = new box();
obj.width = 10;
obj.height = 2;
obj.length = 10;
int y = obj.width * obj.height * obj.length;
System.out.print(y);
}
}Correct
Incorrect
-
Question 7 of 25
7. Question
A class can have many methods with the same name as long as the number of parameters or type of parameters is different. This OOP concept is known as
Correct
Incorrect
-
Question 8 of 25
8. Question
A constructor
Correct
Incorrect
-
Question 9 of 25
9. Question
What is byte code in the context of Java?
Correct
Incorrect
-
Question 10 of 25
10. Question
What is the return type of Constructors?
Correct
Incorrect
-
Question 11 of 25
11. Question
Which keyword is used by method to refer to the object that invoked it?
Correct
Incorrect
-
Question 12 of 25
12. Question
Which of the following is a method having same name as that of its class?
Correct
Incorrect
-
Question 13 of 25
13. Question
What is the output of this program?
class box {
int width;
int height;
int length;
int volume;
box() {
width = 5;
height = 5;
length = 6;
}
void volume() {
volume = width*height*length;
}
}
class constructor_output {
public static void main(String args[])
{
box obj = new box();
obj.volume();
System.out.println(obj.volume);
}
}Correct
Incorrect
-
Question 14 of 25
14. Question
Which of the folowing stements are incorrect?
Correct
Incorrect
-
Question 15 of 25
15. Question
Which of the following may be part of class defination?
Correct
Incorrect
-
Question 16 of 25
16. Question
classes are useful because they?
Correct
Incorrect
-
Question 17 of 25
17. Question
A constructor is a special type of_____
Correct
Incorrect
-
Question 18 of 25
18. Question
A default constructor ______
Correct
Incorrect
-
Question 19 of 25
19. Question
o specify default access to a variable or a method ___ keyword is used
Correct
Incorrect
-
Question 20 of 25
20. Question
Inheritance means______
Correct
Incorrect
-
Question 21 of 25
21. Question
To inherit from class ___ keyword is used.
Correct
Incorrect
-
Question 22 of 25
22. Question
Java does not support ____ inheritance
Correct
Incorrect
-
Question 23 of 25
23. Question
When class is declared as abstract , then ____
Correct
Incorrect
-
Question 24 of 25
24. Question
When a class is declared as final , then ____
Correct
Incorrect
-
Question 25 of 25
25. Question
Overloaded methods ____
Correct
Incorrect