Menu

Objective Type Questions & Answers


Object Oriented Programming through Java MCQs - Unit-2



1.  ___ is the superclass to all Java classes either user-defined or built-in.

A . Class

B . Object

C . Superclass

D . Null

Answer



2. Java language doesn`t supports ___ type of inheritance.

A . Multiple Inheritance

B . Multi-Level Inheritance

C . Single Inheritance

D . Hierarchical Inheritance

Answer



3. which access modifier data members will be accessible Inside the package only.

A . public

B . default

C . private

D . protected

Answer



4. which access modifier data members will be accessible Inside the package and outside the package through sub classes.

A . public

B . default

C . private

D . protected

Answer



5. which access modifier data members will be accessible Inside the class only.

A . public

B . default

C . private

D . protected

Answer



6. Which of the method is not supported by scanner class?

A . nextLine()

B . readLine()

C . nextInt()

D . None of the above

Answer



7. What is the correct syntax to create to an object for Console class?

A . Console c = new Console();

B . Console c = new Console(System.in);

C . Console c = System.console();

D . None of above

Answer



8. Constructor is a special type of method which is used to ______________________?

A . initialize the object

B . provide default values to an object

C . provide different values to distinct objects

D . All the above

Answer



9. Which of the following is not a standard rule to define constructor?

A . Constructor name must be same as it`s Class name

B . Constructor must have explict return type

C . Constructor must have no explict return type

D . None of the above

Answer



10. The wrapping up of data and functions into a single unit is called

A . Encapsulation

B . Abstraction

C . Data Hiding

D . Polymorphism

Answer



11. In object-oriented programming, new classes can be defined by extending existing classes. This is an example of:

A . Encapsulation

B . Interface

C . Composition

D . Inheritance

Answer



12. What is the maximum number of ELSE-IF statements that can present in between starting IF and ending ELSE statements?

A . 32

B . 64

C . 128

D . None

Answer



13. The super keyword is used to ____________________.

A . access the variables in parent class

B . access the variables in child class

C . access the methods in parent class

D . access the variables and methods in parent class

Answer



14. Which of the following statement is invalid about final keyword?

A . The final keyword can be appiled on classes to prevent inheritance

B . The final keyword can be appiled on methods to disallow method overridding

C . The final keyword can be appiled on methods to disallow method overloading

D . The final keyword can be appiled on variables to declare constants

Answer



15. The compile time polymorphism performed by _______________________?

A . method overloading

B . method overriding

C . both method overloading and overriding

D . none of the above

Answer



16. If a class have multiple methods with same name but different parameters is known as _________________?

A . method overloading

B . method overriding

C . constructor overloading

D . none of the above

Answer



17. If a child class has the same method as declared in the parent class is known as _________________?

A . method overloading

B . method overriding

C . constructor overloading

D . none of the above

Answer



18. which of the following is not a rule for method overriding?

A . Methods must have same name

B . Methods must have same method parameters

C . IS-A relationship between child and parent class

D . Class name and method name must be same.

Answer



19. To stop or block inheriting a given class, the ___ keyword is used before the class.

A . static

B . private

C . final

D . none of the above

Answer



20. An Overridden method is the method of ____ class and the overriding method is the method of ___ class.

A . super, sub

B . sub, super

C . super, super

D . sub, sub

Answer



21. ___________ binding will be performed at runtime when we override the methods.

A . Dynamic

B . Static

C . Both

D . None of the above

Answer



22. If you import "packagename.classname" then ___________ of this package will be accessible.

A . all the classes

B . some of the classes

C . only specified class

D . all the classes and interfaces

Answer



Fill in the Blanks


23.  An abstract class can have abstract and non abstract methods.( True / False)

Answer


24. In a Multi Level Inheritance Class-C inherits from Class-B and Class-B inherits from Class-State TRUE or FALSE.

Answer


25. If you use "packagename.* " then all the classes and interfaces of this package  and subpackages will be acce

Answer




Relevant Materials :

Object Oriented Programming through Java MCQs - Unit-1 - [ OOP_JAVA ]

Object Oriented Programming through Java MCQs - Unit-2 - [ OOP_JAVA ]

Object Oriented Programming through Java MCQs - Unit-3 - [ OOP_JAVA ]

Object Oriented Programming through Java MCQs - Unit-4 - [ OOP_JAVA ]

Object Oriented Programming through Java MCQs - Unit-5 - [ OOP_JAVA ]


Similar Materials :

R - Programming MCQs - Unit-1 - [ R-Programming ]

R - Programming MCQs - Unit-2 - [ R-Programming ]

R - Programming MCQs - Unit-3 - [ R-Programming ]

R - Programming MCQs - Unit-4 - [ R-Programming ]

R - Programming MCQs - Unit-5 - [ R-Programming ]

Formal Languages and Automata Theory (FLAT) MCQs - Unit-1 - [ FLAT ]

Formal Languages and Automata Theory (FLAT) MCQs - Unit-2 - [ FLAT ]

Formal Languages and Automata Theory (FLAT) MCQs - Unit-3 - [ FLAT ]

Formal Languages and Automata Theory (FLAT) MCQs - Unit-4 - [ FLAT ]

Formal Languages and Automata Theory (FLAT) MCQs - Unit-5 - [ FLAT ]

PPS MCQs - Unit-1 - [ PPS ]

PPS MCQs - Unit-2 - [ PPS ]

PPS MCQs - Unit-3 - [ PPS ]

PPS MCQs - Unit-4 - [ PPS ]

PPS MCQs - Unit-5 - [ PPS ]

Design and Analysis of Algorithms MCQs - Unit-1 - [ DAA ]

Design and Analysis of Algorithms MCQs - Unit-2 - [ DAA ]

Design and Analysis of Algorithms MCQs - Unit-3 - [ DAA ]

Design and Analysis of Algorithms MCQs - Unit-4 - [ DAA ]

Design and Analysis of Algorithms MCQs - Unit-5 - [ DAA ]

Software Engineering MCQs - Unit-1 - [ SE ]

Software Engineering MCQs - Unit-2 - [ SE ]

Software Engineering MCQs - Unit-3 - [ SE ]

Software Engineering MCQs - Unit-4 - [ SE ]

Software Engineering MCQs - Unit-5 - [ SE ]

Data Mining MCQs - Unit-1 - [ DM ]

Data Mining MCQs - Unit-2 - [ DM ]

Data Mining MCQs - Unit-3 - [ DM ]

Data Mining MCQs - Unit-4 - [ DM ]

Data Mining MCQs - Unit-5 - [ DM ]

Computer Organization and Architecture (COA) Objective Question Bank-Unit-1 - [ COA ]

Computer Organization and Architecture (COA) Objective Question Bank-Unit-2 - [ COA ]

Computer Organization and Architecture (COA) Objective Question Bank-Unit-3 - [ COA ]

Computer Organization and Architecture (COA) Objective Question Bank-Unit-4 - [ COA ]

Computer Organization and Architecture (COA) Objective Question Bank-Unit-5 - [ COA ]

Data Structures Objective Type Question Bank-Unit-1 - [ DS ]

Data Structures Objective Type Question Bank-Unit-2 - [ DS ]

Data Structures Objective Type Question Bank-Unit-3 - [ DS ]

Data Structures Objective Type Question Bank-Unit-4 - [ DS ]

Data Structures Objective Type Question Bank-Unit-5 - [ DS ]

Database Management System Objective Type Question Bank-Unit-1 - [ DBMS ]

Database Management System Objective Type Question Bank-Unit-2 - [ DBMS ]

Database Management System Objective Type Question Bank-Unit-3 - [ DBMS ]

Database Management System Objective Type Question Bank-Unit-4 - [ DBMS ]

Database Management System Objective Type Question Bank-Unit-5 - [ DBMS ]

Cyber Forensics Objective Type Question Bank-Part-2 - [ Cyber Forensics ]

Cyber Forensics Objective Type Question Bank-Part-1 - [ Cyber Forensics ]

Java Programming Objective Type Question Bank - [ Java Programming ]

Java Programming Objective Type Questions-Part-1 - [ Java Programming ]

Java Programming Objective Type Questions-Part-2 - [ Java Programming ]