adplus-dvertising

Welcome to the Data Types,Variables and Arrays MCQs Page

Dive deep into the fascinating world of Data Types,Variables and Arrays with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Data Types,Variables and Arrays, a crucial aspect of Java Programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of Data Types,Variables and Arrays, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within Java Programming.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Data Types,Variables and Arrays. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of Java Programming.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Data Types,Variables and Arrays. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Data Types,Variables and Arrays MCQs | Page 10 of 32

Explore more Topics under Java Programming

Q91.
Given a method in a protected class, what access modifier do you use to restrict access to that method to only the other members of the same class?
Discuss
Answer: (c).private
Discuss
Answer: (a).public static short stop = 23;
Q93.
You want subclasses in any package to have access to members of a superclass. Which is the most restrictive access that accomplishes this objective?
Discuss
Answer: (c).protected
Q94.
Which of the following code fragments inserted, will allow to compile?
public class Outer 
{ 
    public void someOuterMethod() 
    {
        //Line 5 
    } 
    public class Inner { } 
    
    public static void main(String[] argv) 
    {
        Outer ot = new Outer(); 
        //Line 10
    } 
} 
Discuss
Answer: (a).new Inner(); //At line 5
Q95.
Which two code fragments will compile?

1. interface Base2 implements Base {}

2. abstract class Class2 extends Base
{ public boolean m1(){ return true; }}

3. abstract class Class2 implements Base {}

4. abstract class Class2 implements Base
{ public boolean m1(){ return (7 > 4); }}

5. abstract class Class2 implements Base
{ protected boolean m1(){ return (5 > 7) }}
interface Base 
{
    boolean m1 ();
    byte m2(short s);
}
Discuss
Answer: (c).3 and 4
Q96.
Which three form part of correct array declarations?

1. public int a [ ]
2. static int [ ] a
3. public [ ] int a
4. private int a [3]
5. private int [3] a [ ]
6. public final int [ ] a
Discuss
Answer: (c).1, 2, 6
Q97.
public class Test { }

What is the prototype of the default constructor?
Discuss
Answer: (c).public Test( )
Q98.
What is the most restrictive access modifier that will allow members of one class to have access to members of another class in the same package?
Discuss
Answer: (d).default access
Q99.
Which of the following is/are legal method declarations?

1. protected abstract void m1();
2. static final void m1(){}
3. synchronized public final void m1() {}
4. private native void m1();
Discuss
Answer: (d).All of them are legal declarations.
Discuss
Answer: (b).int [ ][ ] scores = {2,7,6}, {9,3,45};

Suggested Topics

Are you eager to expand your knowledge beyond Java Programming? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!