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

31. What is the result of !(5 > 3 && 2 < 1)?

  • true
  • false
  • 1
  • 0
Show Answer Report

32. What does a >>> 2 perform?

  • Signed right shift
  • Unsigned right shift
  • Left shift
  • XOR operation
Show Answer Report

33. What is the value of byte b = (byte) 130;?

  • 130
  • -126
  • 126
  • -128
Show Answer Report

34. What is the size of the boolean type?

  • 1 bit
  • 8 bits
  • JVM dependent
  • 16 bits
Show Answer Report

35. What is printed?System.out.println(10 == 10.0);

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

36. Which of these is not a valid assignment?

  • int a = 10;
  • char c = "a";
  • double d = 20;
  • float f = 2.5f;
Show Answer Report

37. System.out.println(7 >> 1);

  • 3
  • 3.5
  • 6
  • 14
Show Answer Report

38. int a = 5; int b = 2; double c = a / b; What is c?

  • 2
  • 2.0
  • 2.5
  • 2.50
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test