Operators Questions https://www.geeksforgeeks.org/java-operators-question-1/ https://www.indiabix.com/java-programming/operators-andassignments/ http://www.instanceofjava.com/2015/07/increment-decrementoperators-interview.html https://studyopedia.com/java/java-operators-interview-questions/ https://www.careerride.com/java-operator.aspx https://www.geeksforgeeks.org/java-operators-question-1/ Predict the output of following Java Program class Test public static void main(string args[]) int x = -4; System.out.println(x>>1); int y = 4; System.out.println(y>>1); https://www.geeksforgeeks.org/java-operators-question-2/ Predict the output of following Java program. Assume that int is stored using 32 bits. class Test public static void main(string args[]) int x = -1; System.out.println(x>>>29); System.out.println(x>>>30); System.out.println(x>>>31); https://www.geeksforgeeks.org/java-operators-question-3/ class Test public static void main(string args[]) System.out.println(10 + 20 + "GeeksQuiz"); System.out.println("GeeksQuiz" + 10 + 20); https://www.geeksforgeeks.org/java-operators-question-4/ class Test public static void main(string args[]) System.out.println(10*20 + "GeeksQuiz"); System.out.println("GeeksQuiz" + 10*20); https://www.geeksforgeeks.org/java-operators-question-5/ Which of the following is not an operator in Java? (A) instanceof (B) sizeof
(C) new (D) >>>= https://www.geeksforgeeks.org/java-operators-question-6/ class Base class Derived extends Base public static void main(string args[]) Base a = new Derived(); System.out.println(a instanceof Derived); https://www.geeksforgeeks.org/java-operators-question-7/ class Test public static void main(string args[]) String s1 = "geeksquiz"; String s2 = "geeksquiz"; System.out.println("s1 == s2 is:" + s1 == s2); https://www.indiabix.com/java-programming/operators-andassignments/ What will be the output of the program? class PassA public static void main(string [] args) PassA p = new PassA(); p.start(); void start() long [] a1 = 3,4,5; long [] a2 = fix(a1); System.out.print(a1[0] + a1[1] + a1[2] + " "); System.out.println(a2[0] + a2[1] + a2[2]); long [] fix(long [] a3) a3[1] = 7; return a3; What will be the output of the program? class Test public static void main(string [] args)
Test p = new Test(); p.start(); void start() boolean b1 = false; boolean b2 = fix(b1); System.out.println(b1 + " " + b2); boolean fix(boolean b1) b1 = true; return b1; What will be the output of the program? class PassS public static void main(string [] args) PassS p = new PassS(); p.start(); void start() String s1 = "slip"; String s2 = fix(s1); System.out.println(s1 + " " + s2); String fix(string s1) s1 = s1 + "stream"; System.out.print(s1 + " "); return "stream"; What will be the output of the program? class BitShift public static void main(string [] args) int x = 0x80000000; System.out.print(x + " and "); x = x >>> 31; System.out.println(x); What will be the output of the program? class Equals public static void main(string [] args)
int x = 100; double y = 100.1; boolean b = (x = y); /* Line 7 */ System.out.println(b); http://www.instanceofjava.com/2015/07/increment-decrementoperators-interview.html Java Interview program on pre increment operator 1. class IncrementDemo 5. int a, b; 6. a=10; b=++a; 8. System.out.println(b); 10. 11. Java Interview program on post increment operator 1. class IncrementDemo 5. int a, b; 6. a=10; b=a++; 10. 11. Java Interview program on pre increment operator in expression 1. class IncrementDemo 6. a= ++a + 1;
10. 11. Java Interview program on post increment operator in expression 1. class IncrementDemo 6. a= a++ + 1; 10. 11. Java Interview program on pre increment operator in expression 1. class IncrementDemo 6. a= ++a + ++a; 10. 11. Java Interview program on post increment operator in expression 1. class IncrementDemo 6. a= a++ + a++; 10. 11. Java Interview program on pre and post increment operator in expression 1. class IncrementDemo
6. a= a++ + ++a; 10. Java Interview program on pre decrement 1. class IncrementDemo 5. int a, b; 6. a=10; b=--a; 8. System.out.println(b); 10. 11. Java Interview program on post decrement 1. class IncrementDemo 5. int a, b; 6. a=30; b=a--; 10. 11. Java Interview program on pre decrement in expression 1. class IncrementDemo 6. a= --a - 1; 10. 11. Java Interview program on post decrement in expression
1. class IncrementDemo 6. a= a-- - 1; 10. 11. Java Interview program on pre decrement in expression 1. class IncrementDemo 6. a= --a - --a; 10. 11. Java Interview program on post decrement operator in expression 1. class IncrementDemo 6. a= a-- - a--; 10. 11. Java Interview program on pre and post decrement operator in expression 1. class IncrementDemo 6. a= a-- - --a; 10.
11. Java Interview program on increment and decrement operator in expression 1. class IncrementDemo 6. a= a-- + ++a; 10. 11. Increment and decrement operators Inside println() method 1. class IncrementDemo 5. int a=1; 6. System.out.println(a++); 8. System.out.println(a++); System.out.println(++a); 10. 11. System.out.println(a++); 1 System.out.println(a++); 13. 1 System.out.println(a--); 15. System.out.println(a--); 16. 1 System.out.println(--a); 18. System.out.println(--a); 1 System.out.println(a--); 20. 21. 2 Java Interview program on increment and decrement operator in println 1. class IncrementDemo 5. int i=15; 6. System.out.println(i++); System.out.println(i--); 8.
10. Java Interview program on increment and decrement operator in println 1. class IncrementDemo 5. int a=10,b=10; 6. for(int i=0;i<5;i++) 8. if(++a>2 ++b>2) 10. a++; 11. 1 13. 1 System.out.println("a= "+a+" b="+b); 15. 16. 1 Java Interview program on increment and decrement operator in loops 1. class IncrementDemo 5. int i; 6. for( i=1;i<4;i++) 8. System.out.println(i); 10. 11. 1 System.out.println("value of i after completion of loop: "+i); 13. 1 15. Java Interview program on increment and decrement 1. public class A 3. static int a = 1111; 5. static 6. a = a-- - --a; 8.
10. 11. a = a++ + ++a; 1 13. 1 public static void main(string[] args) 15. 16. System.out.println(a); 1 18. 1 20. https://studyopedia.com/java/java-operators-interview-questions/
What is a Modulus Operator? Show the usage of Modulus Operator with an example program What are Compound Assignment Operators? Give an example showing the usage of Compound Assignment Operators? Why compound assignment operators are used, since the same operation can be done normally as shown above? What is the difference between ++x and x++ under increment operators? Explain the above concept of increment operator with code snippets? Write a complete program explaining the increment and decrement operators in Java? What are Bitwise Logical Operators? What is the role of Bitwise NOT Operator (~)? Give an example? What is Bitwise AND Operator (&). Give an example? Explain Bitwise OR operator? https://studyopedia.com/java/java-bitwise-operators-interview-questions/
Explain Bitwise OR operator? Give an example of Bitwise OR operator ( )? What does a Bitwise left-shift operator do? What does a Bitwise right-shift operator do? How both Bitwise left and right shift operators can be easily differentiated? Give an example of compound bitwise operator assignments? What are logical binary operators? What is the role of Logical Unary NOT? What are short-circuit logical operators? Is this correct in Java? int a, b, c; a = b = c = 5; What is a conditional (ternary) operator? Explain conditional operator with an example program? Operators in the same row are equal in precedence? True or False? Why Parentheses is used? Give an example of using Parenthesis? https://www.careerride.com/java-operator.aspx