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

View Answer

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

View Answer

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.

View Answer

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};

View Answer

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

View Answer

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

View Answer

What is the widest valid returnType for methodA in line 3?

Options

A : int

B : byte

C : long

D : double

View Answer

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 };

View Answer

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

View Answer

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;

View Answer

Declarations and Access Control - General Questions more Online Exam Quiz

Radio Receivers - Part 1

Satellite Communication - Part 1

Signals and Systems - Part 1

General Principles - General Questions

Language Fundamentals - General Questions

Objects and Collections - General Questions