Skip to main content

Java Autoboxing — Part 2 MCQs with Explanations

Practice high-yield Programming & Software Development MCQs on Java Autoboxing — 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 are the two types of Streams offered by java 8?

Question 2 of 40
★ FPSC ★ PPSC

Which feature of java 8 enables us to create a work stealing thread pool using all available processors at its target?

Question 3 of 40
★ FPSC ★ PPSC

What does Files.lines(Path path) do?

Question 4 of 40
★ FPSC ★ PPSC

What is Optional object used for?

Question 5 of 40
★ FPSC ★ PPSC

What is the substitute of Rhino javascript engine in Java 8?

Question 6 of 40
★ FPSC ★ PPSC

What does SAM stand for in the context of Functional Interface?

Question 7 of 40
★ FPSC ★ PPSC

Which method is used to create a directory with fileattributes?

Question 8 of 40
★ FPSC ★ PPSC

Which method can be used to check fileAccessiblity?

Question 9 of 40
★ FPSC ★ PPSC

How can we delete all files in a directory?

Question 10 of 40
★ FPSC ★ PPSC

How to copy the file from one location to other?

Question 11 of 40
★ FPSC ★ PPSC

How can we get the size of specified file?

Question 12 of 40
★ FPSC ★ PPSC

How to read entire file in one line using java 8?

Question 13 of 40
★ FPSC ★ PPSC

How can we create a symbolic link to file?

Question 14 of 40
★ FPSC ★ PPSC

How can we filter lines based on content?

Question 15 of 40
★ FPSC ★ PPSC

Which jar provides FileUtils which contains methods for file operations?

Question 16 of 40
★ FPSC ★ PPSC

Which feature of java 7 allows to not explicitly close IO resource?

Question 17 of 40
★ FPSC ★ PPSC

Which of the following is not a core interface of Hibernate?

Question 18 of 40
★ FPSC ★ PPSC

SessionFactory is a thread-safe object.

Question 19 of 40
★ FPSC ★ PPSC

Which of the following methods returns proxy object?

Question 20 of 40
★ FPSC ★ PPSC

Which of the following methods hits database always?

Question 21 of 40
★ FPSC ★ PPSC

Which of the following method is used inside session only?

Question 22 of 40
★ FPSC ★ PPSC

Which of the following is not a state of object in Hibernate?

Question 23 of 40
★ FPSC ★ PPSC

Which of the following is not an inheritance mapping strategies?

Question 24 of 40
★ FPSC ★ PPSC

Which of the following is not an advantage of using Hibernate Query Language?

Question 25 of 40
★ FPSC ★ PPSC

In which file database table configuration is stored?

Question 26 of 40
★ FPSC ★ PPSC

Which of the following is not an advantage of Hibernate Criteria API?

Question 27 of 40
★ FPSC ★ PPSC

What does Liskov substitution principle specify?

Question 28 of 40
★ FPSC ★ PPSC

What will be the correct option of the following Java code snippet? interface ICust { } class RegularCustomer implements ICust { } class OneTimeCustomer implements ICust { }

Question 29 of 40
★ FPSC ★ PPSC

What will be the output of the following Java code snippet? public class Shape { public int area() { return 1; } } public class Square extends Shape { public int area() { return 2; } } class Main() { public static void main(String[] args) { Shape shape = new Shape(); Square square = new Square(); shape = square; System.out.println(shape.area()); } }

Question 30 of 40
★ FPSC ★ PPSC

What will be the output of the following Java code snippet? public class Shape { public int area() { return 1; } } public class Rectangle extends Shape { public int area() { return 3; } } class Main() { public static void main(String[] args) { Shape shape = new Shape(); Rectangle rect = new Rectangle(); shape = rect; System.out.println(shape.area()); } }

Question 31 of 40
★ FPSC ★ PPSC

What will be the output of the following Java code? public class Shape { public int area() { return 1; } } public class Square extends Shape { public int area() { return 2; } } class Main() { public static void main(String[] args) { Shape shape = new Shape(); Square square = new Square(); square = shape; System.out.println(square.area()); } }

Question 32 of 40
★ FPSC ★ PPSC

What will be the output of the following Java code? public class Shape { public int area() { return 1; } } public class Square extends Shape { public int area() { return 2; } } public class Rectangle extends Shape { public int area() { return 3; } } class Main() { public static void main(String[] args) { Shape shape = new Shape(); Square square = new Square(); Rectangle rect = new Rectangle(); rect = (Rectangle)shape; System.out.println(square.area()); } }

Question 33 of 40
★ FPSC ★ PPSC

What will be the output of the following Java code? public class Shape { public int area() { return 1; } } public class Square extends Shape { public int area() { return 2; } } public class Rectangle extends Shape { public int area() { return 3; } } public static void main(String[] args) { Shape shape = new Square(); shape = new Rectangle(); System.out.println(shape.area()); }

Question 34 of 40
★ FPSC ★ PPSC

What should the return type of method where there is no return value?

Question 35 of 40
★ FPSC ★ PPSC

What data structure should be used when number of elements is fixed?

Question 36 of 40
★ FPSC ★ PPSC

What causes the program to exit abruptly and hence its usage should be minimalistic?

Question 37 of 40
★ FPSC ★ PPSC

Which of the following is good coding practice to determine oddity? i) public boolen abc(int num) { return num % 2 == 1; } ii) public boolean xyz(int num) { return (num & 1)!= 0; }

Question 38 of 40
★ FPSC ★ PPSC

Which one of the following causes memory leak?

Question 39 of 40
★ FPSC ★ PPSC

Which of the following is a best practice to measure time taken by a process for execution?

Question 40 of 40
★ FPSC ★ PPSC

What one of the following is best practice to handle Null Pointer exception? i) int noOfStudents = line.listStudents().count; ii) int noOfStudents = getCountOfStudents(line); public int getCountOfStudents(List line) { if(line != null) { if(line.listOfStudents() != null) { return line.listOfStudents().size(); } } throw new NullPointerException("List is empty"); }

✓ 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 →