Skip to main content

Application Lifecycle And Annotation — Part 1 MCQs with Explanations

Practice high-yield Programming & Software Development MCQs on Application Lifecycle And Annotation — Part 1 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 is the purpose of the `@WebServlet` annotation in a Java web application?

Question 2 of 40
★ FPSC ★ PPSC

In a Java web application, what is the role of the `ServletContext` object?

Question 3 of 40
★ FPSC ★ PPSC

What is the primary purpose of the `@PostConstruct` annotation in Java EE applications?

Question 4 of 40
★ FPSC ★ PPSC

In Java EE applications, what is the purpose of the `@Resource` annotation?

Question 5 of 40
★ FPSC ★ PPSC

What is the `web.xml` deployment descriptor used for in a Java web application?

Question 6 of 40
★ FPSC ★ PPSC

In a Java web application, what is the purpose of the `@WebListener` annotation?

Question 7 of 40
★ FPSC ★ PPSC

What is the role of the `ServletContextListener` interface in Java web applications?

Question 8 of 40
★ FPSC ★ PPSC

Which annotation is used to specify that a method should be invoked after a session is invalidated in a Java web application?

Question 9 of 40
★ FPSC ★ PPSC

What is the purpose of the `@PreDestroy` annotation in Java EE applications?

Question 10 of 40
★ FPSC ★ PPSC

In a Java EE application, what is the role of the `@EJB` annotation?

Question 11 of 40
★ FPSC ★ PPSC

Which annotation is used to declare a filter in a Java web application?

Question 12 of 40
★ FPSC ★ PPSC

In a Java web application, what is the purpose of the `@ContextConfiguration` annotation?

Question 13 of 40
★ FPSC ★ PPSC

What is the primary role of the `ServletContextEvent` class in Java web applications?

Question 14 of 40
★ FPSC ★ PPSC

Which annotation is used to specify a custom error page in a Java web application?

Question 15 of 40
★ FPSC ★ PPSC

In Java EE applications, what is the purpose of the `@PersistenceContext` annotation?

Question 16 of 40
★ FPSC ★ PPSC

What does the `@Singleton` annotation indicate in Java EE applications?

Question 17 of 40
★ FPSC ★ PPSC

In Java web applications, what is the purpose of the `@RequestScoped` annotation?

Question 18 of 40
★ FPSC ★ PPSC

What is the purpose of the `@WebInitParam` annotation in a servlet declaration?

Question 19 of 40
★ FPSC ★ PPSC

In Java EE applications, what is the primary role of the `@MessageDriven` annotation?

Question 20 of 40
★ FPSC ★ PPSC

Which annotation is used to specify a custom error page for a specific exception type in a Java web application?

Question 21 of 40
★ FPSC ★ PPSC

What is the purpose of the `@Produces` annotation in Java EE applications?

Question 22 of 40
★ FPSC ★ PPSC

In a Java web application, what is the role of the `@MultipartConfig` annotation?

Question 23 of 40
★ FPSC ★ PPSC

What is the purpose of the `@AroundInvoke` annotation in Java EE applications?

Question 24 of 40
★ FPSC ★ PPSC

In a Java EE application, what is the primary role of the `@Stateless` annotation?

Question 25 of 40
★ FPSC ★ PPSC

Which annotation is used to specify the URL pattern for a servlet in a Java web application?

Question 26 of 40
★ FPSC ★ PPSC

What is the purpose of the `@PersistenceUnit` annotation in Java EE applications?

Question 27 of 40
★ FPSC ★ PPSC

In Java web applications, what is the purpose of the `@SessionScoped` annotation?

Question 28 of 40
★ FPSC ★ PPSC

Which annotation is used to declare a listener for HTTP session events in a Java web application?

Question 29 of 40
★ FPSC ★ PPSC

What is the purpose of the `@Path` annotation in JAX-RS (Java API for RESTful Web Services) applications?

Question 30 of 40
★ FPSC ★ PPSC

In Java EE applications, what does the `@Remote` annotation indicate?

Question 31 of 40
★ FPSC ★ PPSC

Which version of Java introduced annotation?

Question 32 of 40
★ FPSC ★ PPSC

Which of the below is a source code management tool?

Question 33 of 40
★ FPSC ★ PPSC

Can we run Junits as a part of Jenkins job?

Question 34 of 40
★ FPSC ★ PPSC

Which one of the following annotations is not used in Hibernate?

Question 35 of 40
★ FPSC ★ PPSC

Which one of the following is not an annotation used by Junit with Junit4?

Question 36 of 40
★ FPSC ★ PPSC

Using which annotation non visible or private method can be tested?

Question 37 of 40
★ FPSC ★ PPSC

Which file is used to specify the packaging cycle?

Question 38 of 40
★ FPSC ★ PPSC

Which one of the following is not ID generating strategy using @GeneratedValue annotation?

Question 39 of 40
★ FPSC ★ PPSC

Annotations which are applied to other annotations are called meta annotations.

Question 40 of 40
★ FPSC ★ PPSC

Which file is used to define dependency in maven?

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