Core Java Technical Test – Operators

Core Java Technical Test: This Core Java Technical Test on Operators page is providing SCJP or OCJP certification level questions to test your java programming skills and helpful to clear all the technical interviews easily. This test is including the concept of Operators in Java.


1. What is the output of following code?
class Test
{
public static void main(String[] args)
{
int a=15,b=8,c,d,e;
c = a & b ;
d = a | b ;
e = a ^ b ;
System.out.println(c+”\n”+d+”\n”+e);
}
}

 
 
 
 

2. What is the output of following code?
class Test
{
public static void main(String[] args)
{
int res = 10>20 ? 10 : 20<30 ? 20 : 30;
System.out.println(res);
}
}

 
 
 
 

3. What is the output of following code?
class Test
{
public static void main(String[] args)
{
int a=5 ;
System.out.println(a++);
System.out.println(++a);
}
}

 
 
 
 

4. What is the output of following code?
class Test
{
public static void main(String[] args)
{
int a=5 ;
System.out.println(a++ + ++a);
}
}

 
 
 
 

5. What is the output of following code?
class Test
{
public static void main(String[] args)
{
int a=3, b=3;
boolean x;
x = !(a++ > b–) ;
System.out.println(x+”\n”+a+”\n”+b);
}
}

 
 
 
 

6. What is the output of following code?
class Test
{
public static void main(String[] args)
{
System.out.println(5/3 + 5%3);
}
}

 
 
 
 

7. What is the output of following code?
class Test
{
public static void main(String[] args)
{
int a=3,b=5,c=2,d=7,e;
e = d-b%(a+c)-d+(b/a)-c+a-b;
System.out.println(e);
}
}

 
 
 
 

8. What is the output of following code?
class Test
{
public static void main(String[] args)
{
boolean a, b;
a = false && true ;
b = true || false ;
System.out.println(a+”\n”+b);
}
}

 
 
 
 

9. What is the output of following code?
class Test
{
public static void main(String[] args)
{
int a=5 ;
System.out.println(++a + ++a);
}
}

 
 
 
 

10. What is the output of following code?
class Test
{
public static void main(String[] args)
{
System.out.println(‘A’>’B’);
}
}

 
 
 
 

Question 1 of 10

Share this