Operators and Assignments Questions and Answers

Take Exam

In Java programming, Operators and Assignments form the backbone of logical and arithmetic operations. This concept frequently appears in programming questions and answers, particularly Java MCQs featured in company tests by TCS, Infosys, and Wipro. Java provides various operators—arithmetic, relational, logical, and bitwise—that allow developers to manipulate data and control program flow effectively. Understanding operator precedence, associativity, and assignment rules ensures accurate computations and reduces coding errors. Practicing Java programming interview questions with answers on operators and assignments helps students develop problem-solving skills necessary for coding challenges and technical interviews.

Operators and Assignments

Showing 10 of 38 questions

21. int a = 4; int b = a-- + 2; What is b?

  • 5
  • 6
  • 4
  • 2
Show Answer Report

22. Which operator checks object equality?

  • ==
  • =
  • equals()
  • !=
Show Answer Report

23. What is the result of true ^ false?

  • true
  • false
  • 1
  • 0
Show Answer Report

24. int a = 2, b = 3; System.out.println(a | b);

  • 1
  • 2
  • 3
  • 3
Show Answer Report

25. Which operator is used to shift bits to the right with sign extension?

  • >>
  • >>>
  • <<
  • ><
Show Answer Report

26. What is the value of int x = 9; x %= 4;?

  • 1
  • 2
  • 3
  • 4
Show Answer Report

27. Which operator is used for conditional evaluation?

  • ??
  • ::
  • ?:
  • $
Show Answer Report

28. int a = 5, b = 10; boolean c = a < b && a != b;What is c?

  • false
  • true
  • 0
  • Compilation error
Show Answer Report

29. What is the output of "2" + 3 + 4?

  • 234
  • 9
  • 7
  • 34
Show Answer Report

30. Which operator in Java is right-associative?

  • +
  • %
  • =
  • >>
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test