Declaration And Access Control — Part 2 MCQs with Explanations
Practice high-yield Programming & Software Development MCQs on Declaration And Access Control — Part 2 with worked academic solutions for FPSC, PPSC, NTS, NITB, PTS.
Questions
15
Difficulty Level
Exam-Level
Target Exams
FPSC, PPSC, NTS...
Estimated Time
18 mins
Exam-Level FPSC PPSC NTS NITB PTS
Verified for Commission Syllabus • Oct 14, 2026
15
Verified Practice Questions
Interactive test mode with detailed academic worked solutions
Live Progress | 0/15 answered
✓ 0 correct
✗ 0 wrong
0% score
🎉 Set complete! All 15 questions answered.
Question 1 of 15
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Question 2 of 15
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which keyword is used to declare a method that cannot be overridden in a subclass?
Question 3 of 15
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the access level of a class member declared as protected in Java?
Question 4 of 15
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which keyword is used to explicitly specify that a method should be overridden in a subclass?
Question 5 of 15
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Suppose a class has public visibility. In this class we define a protected method. Which of the following statements is correct?
Question 6 of 15
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The object is created with new keyword
Question 7 of 15
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Consider the following two classes declared and defined in two different packages, what can be added in class B to form what considered a correct access to class A from main() method of class B? package subPackage; public class A { } package anotherPackage; // line 1 public class B{ public static void main(String[] args){ // line 2 } } 1. At line1 add noting; At line2 add: new A(); 2. At line 1 add: import package.*; at line 2 add : new subPackage.A(); 3. At line 1 add: import subPackage.*; at line 2 add : new A(); 4. At line 1 add: import subPackage.A; at line 2 add : new A();
Question 8 of 15
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which statements are most accurate regarding the following classes? class A{ private int i; protected int j; } class B extends A{ private int k; protected int m; }
Question 9 of 15
★ FPSC
★ PPSC
★ FPSC
★ PPSC
A method within a class is only accessible by classes that are defined within the same package as the class of the method. Which one of the following is used to enforce such restriction?
Question 10 of 15
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Choose the correct statement public class Circle{ private double radius; public Circle(double radius){ radius = radius; } }
Question 11 of 15
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Choose the correct statement. Restriction on static methods are: I. They can only call other static methods. II. They must only access static data. III. They cannot refer this or super in any way.
Question 12 of 15
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output? public class Test{ static{ int a = 5; } public static void main(String args[]){ new Test().call(); } void call(){ this.a++; System.out.print(this.a); } }
Question 13 of 15
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Determine Output: class MyClass{ static final int a = 20; static final void call(){ System.out.println("two"); } static{ System.out.println("one"); } } public class Test{ public static void main(String args[]){ System.out.println(MyClass.a); } }
Question 14 of 15
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Name the keyword that makes a variable belong to a class, rather than being defined for each instance of the class.
Question 15 of 15
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What can directly access and change the value of the variable qusNo? package com.mypackage; public class Test{ private int qusNo = 100; }
✓ Link copied to clipboard
Continue Your Practice
Next Practice Set → 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.