Declarations and Access Control - General Questions Online Exam Quiz
Declarations and Access Control - General Questions GK Quiz. Question and Answers related to Declarations and Access Control - General Questions. MCQ (Multiple Choice Questions with answers about Declarations and Access Control - General Questions
You want subclasses in any package to have access to members of a superclass. Which is the most restrictive access that accomplishes this objective?
Options
A : public
B : private
C : protected
D : transient
Which three form part of correct array declarations?
Options
A : 1, 3, 4
B : 2, 4, 5
C : 1, 2, 6
D : 2, 5, 6
Which of the following is/are legal method declarations?
Options
A : 1 and 3
B : 2 and 4
C : 1 only
D : All of them are legal declarations.
Which cause a compiler error?
Options
A : int[ ] scores = {3, 5, 7};
B : int [ ][ ] scores = {2,7,6}, {9,3,45};
C : String cats[ ] = {"Fluffy", "Spot", "Zeus"};
D : boolean results[ ] = new boolean [] {true, false, true};
Which three are valid method signatures in an interface?
Options
A : 1 and 2
B : 2, 3 and 5
C : 3, 4, and 5
D : 2 and 4
You want a class to have access to members of another class in the same package. Which is the most restrictive access that accomplishes this objective?
Options
A : public
B : private
C : protected
D : default access
What is the widest valid returnType for methodA in line 3?
Options
A : int
B : byte
C : long
D : double
Which one creates an instance of an array?
Options
A : int[ ] ia = new int[15];
B : float fa = new float[20];
C : char[ ] ca = "Some String";
D : int ia[ ] [ ] = { 4, 5, 6 }, { 1,2,3 };
Which two of the following are legal declarations for nonnested classes and interfaces?
Options
A : 1 and 4
B : 2 and 5
C : 3 and 6
D : 4 and 6
Which of the following class level (nonlocal) variable declarations will not compile?
Options
A : protected int a;
B : transient int b = 3;
C : private synchronized int e;
D : volatile int d;
Declarations and Access Control - General Questions more Online Exam Quiz
Satellite Communication - Part 1
General Principles - General Questions