A Developer Gateway To IT World...

Techie Uncle Software Testing Core Java Java Spring C Programming Operating System HTML 5 Java 8 ES6 Project

Java Coding Interview Quiz For Coding round HCL Technologies Ltd, Noida

Java Programming Quiz

Java Programming Quiz

1. What will be the output of the following program?

	
		 
		
public class Test001 {

	public static void main(String[] args) {
		System.out.println("Hello");
		System.exit(0);
		System.out.println("Heera");

	}

}
Output is:




2. What will be the output of the following program?

	
		 
		
public class Test002 {

	public static void main(String[] args) {
		System.out.println("Hello");
		System.exit(1);
		System.out.println("Heera");

	}

}
Output is:




3. What will be the output of the following program?

	
		 
		
public class Test003 {
	int x=10;
	public static void main(String[] args) {
		int b;
		b=x/10;
		System.out.println("b="+b);
	}
}
Output is:




4. What will be the output of the following program?

	
		 
		
public class Test004 {
	static int x=10;
	public static void main(String[] args) {
		int b;
		b=x/10;
		System.out.println("b="+b);
	}
}
Output is:




5. What will be the output of the following program?

	
		 
		
public class Test005 {
	static int x=10;
	public static void main(String[] args) {
		int b;
		b=x/3;
		System.out.println(Math.abs(b));
	}
}
Output is:




6. What will be the output of the following program?

	
		 
		
public class Test006 {
	static int x=10;
	public static void main(String[] args) {
		int b=10/0;
		b=x/3;
		System.out.println(b);
	}
}

Output is:




7. What will be the output of the following program?

	
		 
		
public class Test007 {
	static int x=10;
	public static void main(String[] args) {
		int b=10/x;
		System.out.println(x>>>3);
	}
}

Output is:




8. What will be the output of the following program?

	
		 
		
public class Test008 {
	static int x=10;
	public static void main(String[] args) {
		int b=10/x;
		System.out.println(x<<<3);
	}


Output is:




9. What will be the output of the following program?

	
		 
		
public class Test009 {
	public static void main(String[] args) {
		String s="India";
		if(s=="India")
		System.out.println("equal");
		else
		System.out.println("Not Equal");
	}
}

Output is:




10. What will be the output of the following program?

	
		 
		
public class Test010 {
	public static void main(String[] args) {
		String s1="India";
		String s2=new String("India");
		if(s1==s2)
		System.out.println("equal");
		else
		System.out.println("Not Equal");
	}
}

Output is:





LEARN TUTORIALS

.

.