Skip to main content

Operators — Part 2 MCQs with Explanations

Practice high-yield Programming & Software Development MCQs on Operators — Part 2 with worked academic solutions for FPSC, PPSC, NTS, NITB, PTS.

Questions
40
Difficulty Level
Exam-Level
Target Exams
FPSC, PPSC, NTS...
Estimated Time
48 mins
Exam-Level FPSC PPSC NTS NITB PTS
Verified for Commission Syllabus • Oct 14, 2026
40

Verified Practice Questions

Interactive test mode with detailed academic worked solutions

Live Progress | 0/40 answered
✓ 0 correct ✗ 0 wrong 0% score
Question 1 of 40
★ FPSC ★ PPSC

What will be the output? if(1 + 1 + 1 + 1 + 1 == 5){ System.out.print("TRUE"); } else{ System.out.print("FLASE"); }

Question 2 of 40
★ FPSC ★ PPSC

What will be the output? public class Test{ public static void main(String args[]){ System.out.print(""==""); System.out.print(" "); System.out.print("A"=="A"); System.out.print(" "); System.out.print("a==A"); } }

Question 3 of 40
★ FPSC ★ PPSC

What will be the output of the following Java code? class operators { public static void main(String args[]) { int var1 = 5; int var2 = 6; int var3; var3 = ++ var2 * var1 / var2 + var2; System.out.print(var3); } }

Question 4 of 40
★ FPSC ★ PPSC

Which of these are selection statements in Java?

Question 5 of 40
★ FPSC ★ PPSC

On applying Left shift operator, <<, on integer bits are lost one they are shifted past which position bit?

Question 6 of 40
★ FPSC ★ PPSC

With x = 0, which of the following are legal lines of Java code for changing the value of x to 1? 1. x++; 2. x = x + 1; 3. x += 1; 4. x =+ 1;

Question 7 of 40
★ FPSC ★ PPSC

Which of the following can be operands of arithmetic operators?

Question 8 of 40
★ FPSC ★ PPSC

What will be the output of the following Java program? class jump_statments { public static void main(String args[]) { int x = 2; int y = 0; for ( ; y < 10; ++y) { if (y % x == 0) continue; else if (y == 8) break; else System.out.print(y + " "); } } }

Question 9 of 40
★ FPSC ★ PPSC

Which operator is used to invert all the digits in a binary representation of a number?

Question 10 of 40
★ FPSC ★ PPSC

What will be the output of the following Java program? class leftshift_operator { public static void main(String args[]) { byte x = 64; int i; byte y; i = x << 2; y = (byte) (x << 2) System.out.print(i + " " + y); } }

Question 11 of 40
★ FPSC ★ PPSC

Which of these statements are incorrect?

Question 12 of 40
★ FPSC ★ PPSC

What will be the output of the following Java program? class comma_operator { public static void main(String args[]) { int sum = 0; for (int i = 0, j = 0; i < 5 & j < 5; ++i, j = i + 1) sum += i; System.out.println(sum); } }

Question 13 of 40
★ FPSC ★ PPSC

Which of these jump statements can skip processing the remainder of the code in its body for a particular iteration?

Question 14 of 40
★ FPSC ★ PPSC

Which of these operators can skip evaluating right hand operand?

Question 15 of 40
★ FPSC ★ PPSC

Which of the following is used with the switch statement?

Question 16 of 40
★ FPSC ★ PPSC

What will be the output of the following Java code? class Relational_operator { public static void main(String args[]) { int var1 = 5; int var2 = 6; System.out.print(var1 > var2); } }

Question 17 of 40
★ FPSC ★ PPSC

What will be the output of the following Java program? class increment { public static void main(String args[]) { double var1 = 1 + 5; double var2 = var1 / 4; int var3 = 1 + 5; int var4 = var3 / 4; System.out.print(var2 + " " + var4); } }

Question 18 of 40
★ FPSC ★ PPSC

What is the order of precedence (highest to lowest) of following operators? 1. & 2. ^ 3. ?:

Question 19 of 40
★ FPSC ★ PPSC

What will be the output of the following Java program? class rightshift_operator { public static void main(String args[]) { int x; x = 10; x = x >> 1; System.out.println(x); } }

Question 20 of 40
★ FPSC ★ PPSC

Which of these lines of Java code will give better performance? 1. a | 4 + c >> b & 7; 2. (a | ((( 4 * c ) >> b ) & 7 ))

Question 21 of 40
★ FPSC ★ PPSC

What will be the output of the following Java program? class Output { public static void main(String args[]) { int a = 5; int b = 10; first: { second: { third: { if (a == b >> 1) break second; } System.out.println(a); } System.out.println(b); } } }

Question 22 of 40
★ FPSC ★ PPSC

What will be the output of the following Java code? class operators { public static void main(String args[]) { int x = 8; System.out.println(++x * 3 + " " + x); } }

Question 23 of 40
★ FPSC ★ PPSC

Which right shift operator preserves the sign of the value?

Question 24 of 40
★ FPSC ★ PPSC

What is true about do statement?

Question 25 of 40
★ FPSC ★ PPSC

What will be the output of the following Java program? class Output { public static void main(String args[]) { int a = 1; int b = 2; int c = 3; a |= 4; b >>= 1; c <<= 1; a ^= c; System.out.println(a + " " + b + " " + c); } }

Question 26 of 40
★ FPSC ★ PPSC

Which of these is not a bitwise operator?

Question 27 of 40
★ FPSC ★ PPSC

What will be the output of the following Java program? class increment { public static void main(String args[]) { int g = 3; System.out.print(++g * 8); } }

Question 28 of 40
★ FPSC ★ PPSC

What will be the output of the following Java code? class Output { public static void main(String args[]) { int x=y=z=20; } }

Question 29 of 40
★ FPSC ★ PPSC

What will be the output of the following Java program? class Output { public static void main(String args[]) { final int a=10,b=20; while(a<b) { System.out.println("Hello"); } System.out.println("World"); } }

Question 30 of 40
★ FPSC ★ PPSC

Can 8 byte long data type be automatically type cast to 4 byte float data type?

Question 31 of 40
★ FPSC ★ PPSC

What will be the output of the following Java code? class Output { public static void main(String args[]) { boolean a = true; boolean b = false; boolean c = a ^ b; System.out.println(!c); } }

Question 32 of 40
★ FPSC ★ PPSC

What is the value stored in x in the following lines of Java code? int x, y, z; x = 0; y = 1; x = y = z = 8;

Question 33 of 40
★ FPSC ★ PPSC

What will be the output of the following Java program? class Output { public static void main(String args[]) { int a = 1; int b = 2; int c; int d; c = ++b; d = a++; c++; b++; ++a; System.out.println(a + " " + b + " " + c); } }

Question 34 of 40
★ FPSC ★ PPSC

What will be the output of the following Java code? class Output { public static void main(String args[]) { int x , y = 1; x = 10; if (x != 10 && x / 0 == 0) System.out.println(y); else System.out.println(++y); } }

Question 35 of 40
★ FPSC ★ PPSC

Which of the following loops will execute the body of loop even when condition controlling the loop is initially false?

Question 36 of 40
★ FPSC ★ PPSC

What will be the output of the following Java program? class bitwise_operator { public static void main(String args[]) { int a = 3; int b = 6; int c = a | b; int d = a & b; System.out.println(c + " " + d); } }

Question 37 of 40
★ FPSC ★ PPSC

Which of the following operators can operate on a boolean variable? 1. && 2. == 3. ?: 4. +=

Question 38 of 40
★ FPSC ★ PPSC

What will be the output of the following Java program? class Modulus { public static void main(String args[]) { double a = 25.64; int b = 25; a = a % 10; b = b % 10; System.out.println(a + " " + b); } }

Question 39 of 40
★ FPSC ★ PPSC

What should be expression1 evaluate to in using ternary operator as in this line? expression1 ? expression2 : expression3

Question 40 of 40
★ FPSC ★ PPSC

Modulus operator, %, can be applied to which of these?

✓ Link copied to clipboard
Continue Your Practice

Advance Html — Part 1

Master the next curriculum module with 40 exam-standard MCQs.

Next Practice Set →

💡 Examiner's Advisory for Programming & Software Development

In competitive commission exams (FPSC, PPSC, KPPSC, SPSC, CSS, PMS), questions are frequently phrased with distractor options designed to catch rote learners. Whenever you answer an MCQ, read the Detailed Academic Explanation and Conceptual Anchor to understand why the remaining options are incorrect.

More Modules in Programming & Software Development

View All →
📚

Study Guides

Topic summaries and syllabus breakdown

Explore Guides →
🎯

Complete Library

Search through 78,000+ verified MCQs

Browse Library →
📱

Mobile App

Offline mock tests and instant bookmarks

Get Mobile App →