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
🎉 Set complete! All 40 questions answered.
Question 1 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output? if(1 + 1 + 1 + 1 + 1 == 5){ System.out.print("TRUE"); } else{ System.out.print("FLASE"); }
Correct Answer: Option A — TRUE
Detailed Academic Explanation:
TRUE is the correct answer to “What will be the output? if(1 + 1 + 1 + 1 + 1 == 5){ System.out.print("TRUE"); } else{ System.out.print("FLASE"); }”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 2 of 40
★ FPSC
★ PPSC
★ 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"); } }
Correct Answer: Option C — true true a==A
Detailed Academic Explanation:
true true a==A is the correct answer to “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"); } }”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 3 of 40
★ FPSC
★ PPSC
★ 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); } }
Correct Answer: Option C — 12
Detailed Academic Explanation:
12 is the correct answer to “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); } }”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 4 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of these are selection statements in Java?
Correct Answer: Option A — if()
Detailed Academic Explanation:
if() is the correct answer to “Which of these are selection statements in Java”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 5 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
On applying Left shift operator, <<, on integer bits are lost one they are shifted past which position bit?
Correct Answer: Option D — 31
Detailed Academic Explanation:
31 is the correct answer to “On applying Left shift operator, <<, on integer bits are lost one they are shifted past which position bit”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 6 of 40
★ FPSC
★ PPSC
★ 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;
Correct Answer: Option C — 1, 2, 3 & 4
Detailed Academic Explanation:
1, 2, 3 & 4 is the correct answer to “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;”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 7 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following can be operands of arithmetic operators?
Correct Answer: Option D — Both Numeric & Characters
Detailed Academic Explanation:
Both Numeric & Characters is the correct answer to “Which of the following can be operands of arithmetic operators”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 8 of 40
★ FPSC
★ PPSC
★ 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 + " "); } } }
Correct Answer: Option C — 1 3 5 7 9
Detailed Academic Explanation:
1 3 5 7 9 is the correct answer to “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 + " "); } } }”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 9 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which operator is used to invert all the digits in a binary representation of a number?
Correct Answer: Option A — ~
Detailed Academic Explanation:
~ is the correct answer to “Which operator is used to invert all the digits in a binary representation of a number”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 10 of 40
★ FPSC
★ PPSC
★ 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); } }
Correct Answer: Option D — 256 0
Detailed Academic Explanation:
256 0 is the correct answer to “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); } }”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 11 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of these statements are incorrect?
Correct Answer: Option C — Division operator, /, has higher precedence than multiplication operator
Detailed Academic Explanation:
Division operator, /, has higher precedence than multiplication operator is the correct answer to “Which of these statements are incorrect”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 12 of 40
★ FPSC
★ PPSC
★ 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); } }
Correct Answer: Option B — 6
Detailed Academic Explanation:
6 is the correct answer to “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); } }”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 13 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of these jump statements can skip processing the remainder of the code in its body for a particular iteration?
Correct Answer: Option D — continue
Detailed Academic Explanation:
continue is the correct answer to “Which of these jump statements can skip processing the remainder of the code in its body for a particular iteration”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 14 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of these operators can skip evaluating right hand operand?
Correct Answer: Option D — &&
Detailed Academic Explanation:
&& is the correct answer to “Which of these operators can skip evaluating right hand operand”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 15 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following is used with the switch statement?
Correct Answer: Option C — break
Detailed Academic Explanation:
break is the correct answer to “Which of the following is used with the switch statement”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 16 of 40
★ FPSC
★ PPSC
★ 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); } }
Correct Answer: Option D — false
Detailed Academic Explanation:
false is the correct answer to “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); } }”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 17 of 40
★ FPSC
★ PPSC
★ 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); } }
Correct Answer: Option C — 1.5 1
Detailed Academic Explanation:
1.5 1 is the correct answer to “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); } }”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 18 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the order of precedence (highest to lowest) of following operators? 1. & 2. ^ 3. ?:
Correct Answer: Option A — 1 > 2 > 3
Detailed Academic Explanation:
1 > 2 > 3 is the correct answer to “What is the order of precedence (highest to lowest) of following operators? 1. & 2. ^ 3. ?:”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 19 of 40
★ FPSC
★ PPSC
★ 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); } }
Correct Answer: Option B — 5
Detailed Academic Explanation:
5 is the correct answer to “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); } }”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 20 of 40
★ FPSC
★ PPSC
★ 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 ))
Correct Answer: Option C — Both 1 & 2 will give equal performance
Detailed Academic Explanation:
Both 1 & 2 will give equal performance is the correct answer to “Which of these lines of Java code will give better performance? 1. a | 4 + c >> b & 7; 2. (a | ((( 4 * c ) >> b ) & 7 ))”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 21 of 40
★ FPSC
★ PPSC
★ 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); } } }
Correct Answer: Option D — 10
Detailed Academic Explanation:
10 is the correct answer to “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); } } }”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 22 of 40
★ FPSC
★ PPSC
★ 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); } }
Correct Answer: Option D — 27 9
Detailed Academic Explanation:
27 9 is the correct answer to “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); } }”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 23 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which right shift operator preserves the sign of the value?
Correct Answer: Option B — >>
Detailed Academic Explanation:
>> is the correct answer to “Which right shift operator preserves the sign of the value”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 24 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is true about do statement?
Correct Answer: Option A — do statement executes the code of a loop at least once
Detailed Academic Explanation:
do statement executes the code of a loop at least once is the correct answer to “What is true about do statement”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 25 of 40
★ FPSC
★ PPSC
★ 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); } }
Correct Answer: Option A — 3 1 6
Detailed Academic Explanation:
3 1 6 is the correct answer to “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); } }”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 26 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of these is not a bitwise operator?
Correct Answer: Option D — <=
Detailed Academic Explanation:
<= is the correct answer to “Which of these is not a bitwise operator”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 27 of 40
★ FPSC
★ PPSC
★ 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); } }
Correct Answer: Option C — 32
Detailed Academic Explanation:
32 is the correct answer to “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); } }”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 28 of 40
★ FPSC
★ PPSC
★ 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; } }
Correct Answer: Option D — compile time error
Detailed Academic Explanation:
compile time error is the correct answer to “What will be the output of the following Java code? class Output { public static void main(String args[]) { int x=y=z=20; } }”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 29 of 40
★ FPSC
★ PPSC
★ 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"); } }
Correct Answer: Option D — compile time error
Detailed Academic Explanation:
compile time error is the correct answer to “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"); } }”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 30 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Can 8 byte long data type be automatically type cast to 4 byte float data type?
Correct Answer: Option A — True
Detailed Academic Explanation:
True is the correct answer to “Can 8 byte long data type be automatically type cast to 4 byte float data type”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 31 of 40
★ FPSC
★ PPSC
★ 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); } }
Correct Answer: Option C — false
Detailed Academic Explanation:
false is the correct answer to “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); } }”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 32 of 40
★ FPSC
★ PPSC
★ 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;
Correct Answer: Option D — 8
Detailed Academic Explanation:
8 is the correct answer to “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;”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 33 of 40
★ FPSC
★ PPSC
★ 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); } }
Correct Answer: Option D — 3 4 4
Detailed Academic Explanation:
3 4 4 is the correct answer to “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); } }”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 34 of 40
★ FPSC
★ PPSC
★ 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); } }
Correct Answer: Option B — 2
Detailed Academic Explanation:
2 is the correct answer to “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); } }”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 35 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following loops will execute the body of loop even when condition controlling the loop is initially false?
Correct Answer: Option A — do-while
Detailed Academic Explanation:
do-while is the correct answer to “Which of the following loops will execute the body of loop even when condition controlling the loop is initially false”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 36 of 40
★ FPSC
★ PPSC
★ 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); } }
Correct Answer: Option A — 7 2
Detailed Academic Explanation:
7 2 is the correct answer to “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); } }”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 37 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following operators can operate on a boolean variable? 1. && 2. == 3. ?: 4. +=
Correct Answer: Option D — 1, 2 & 3
Detailed Academic Explanation:
1, 2 & 3 is the correct answer to “Which of the following operators can operate on a boolean variable? 1. && 2. == 3. ?: 4. +=”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 38 of 40
★ FPSC
★ PPSC
★ 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); } }
Correct Answer: Option A — 5.640000000000001 5
Detailed Academic Explanation:
5.640000000000001 5 is the correct answer to “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); } }”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 39 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What should be expression1 evaluate to in using ternary operator as in this line? expression1 ? expression2 : expression3
Correct Answer: Option C — Boolean
Detailed Academic Explanation:
Boolean is the correct answer to “What should be expression1 evaluate to in using ternary operator as in this line? expression1 ? expression2 : expression3”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
Question 40 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Modulus operator, %, can be applied to which of these?
Correct Answer: Option C — Both Integers and floating - point numbers
Detailed Academic Explanation:
Both Integers and floating - point numbers is the correct answer to “Modulus operator, %, can be applied to which of these”. This question is standard in competitive examination syllabi for Operators.
💡Key Conceptual Anchor:Operators
✓Link copied to clipboard
Continue Your Practice
Advance Html — Part 1
Master the next curriculum module with 40 exam-standard MCQs.
💡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.