You are on page 1of 9

Question 1

1 / 1 pts
object-oriented programming, it is to break down a programming task into objects that
expose behavior (methods) and data (members or attributes) using interfaces.

  
true
 

  
false
 
 
Question 2
1 / 1 pts
________ is a technique of solving a problem and breaking it down into smaller parts
and solving each of the smaller problems.

  
Procedural Programming
 

  
OOP
 
 
Question 3
1 / 1 pts
Which one of these is a data type?

  
bit
 

  
gold
 

  
byte
 

  
fold
 
 
Question 4
1 / 1 pts
The Scanner class contains a method called ___________ that reads user input that is
a integer.

  
Println
 

  
NextInt
 

  
pow
 

  
Length()
 
 
IncorrectQuestion 5
0 / 1 pts
Which of following statement(s) can result in new object instance creation if executed
successfully.

  
String str = new String("VirtuQ");

  
String str = new String();
 

  
String str = "VirtuQ" + " "+ Simplifying Education";

  
All
 

  
int [] arr = {1,2,3,4,5};
 
 
IncorrectQuestion 6
0 / 1 pts
This - It represents an instance of the class in which it appears

  
false
 

  
true
 
 
Question 7
1 / 1 pts
final Class: a class that can never be sub-classed

  
true
 

  
false
 
 
Question 8
1 / 1 pts
Instance Variables are variables stored in each object of a class, usually referred to as
the non-static member fields of a class.

  
true
 

  
false
 
 
Question 9
1 / 1 pts
Constructor – a method that is automatically executed when an object is created. This
method is used to initialize the attributes.

  
true
 
  
false
 
 
Question 10
1 / 1 pts
Access (Getter) – a method that is used to access or retrieve data.

  
false
 

  
true
 
 
Question 11
1 / 1 pts
Which among the following best describes encapsulation?

  
It is a way of combining various data members and member functions that operate on
those data members into a single unit
 

  
It is a way of combining various member functions into a single unit
 

  
It is a way of combining various data members and member functions into a single unit
which can operate on any data
 

  
It is a way of combining various data members into a single unit
 
 
IncorrectQuestion 12
0 / 1 pts
Encapsulation is supported by ___________

  
None of the above
 

  
Classes
 

  
Methods
 

  
Objects
 
 
Question 13
1 / 1 pts
What type of inheritance does Java have?

  
Multiple Inheritance
 

  
Class Inheritance
 

  
Double Inheritance
 

  
Single Inheritance
 
 
Question 14
1 / 1 pts
Encapsulation has Better control of class attributes and methods

  
true
 

  
false
 
 
Question 15
1 / 1 pts
How can Encapsulation be achieved?

  
Using only private members
 

  
Using inheritance
 

  
Using Access Specifiers
 

  
Using Abstraction
 
 
Question 16
1 / 1 pts
Which among the following is correct for a hierarchical inheritance?

  
Two base classes can be used to be derived into one single class
 

  
One base class can be derived into other two derived classes or more
 

  
Two or more classes can be derived into one class
 

  
One base class can be derived into only 2 classes
 
 
Question 17
1 / 1 pts
How many classes can be inherited by a single class in java?
  
Only 255
 

  
Only 27
 

  
Only 1024
 

  
Only 1
 
 
IncorrectQuestion 18
0 / 1 pts
What is the output of the following program?

class A

            float sal=40000; 

class B extends A

            int salBonus=10000; 

            public static void main(String args[])

            { 

                        B p=new B(); 

                        System.out.println("B salary is:"+p.sal); 


                        System.out.println("Bonus of B is:"+p.bonus); 

            } 

  
Runtime error

  
B salary is 10000

Bonus of B is: 4000.0

  
Compile time error

  
B salary is: 4000.0

Bonus of B is: 10000

 
Question 19
1 / 1 pts
Which access type data gets derived as private member in derived class?

  
Private
 

  
Protected
 

  
Public
 
  
Protected and Private
 
 
Question 20
1 / 1 pts
Which language doesn't support single level inheritance?

  
Kotlin
 

  
C++
 

  
Java
 

  
All languages support it
 

You might also like