Font size
WorksheetsOOP II LAB QUIZ
Total questions: 25
Worksheet time: 13mins
A single object can also be referred to as an...
Object
Singular Object
Instance
Singular
How many lines will this code print?
x = 10
while x > 0:
print(x)
x = x - 3
5
2
3
4
Real-world objects contain ___ and ___.
state
behavior
attributes
methods
A software object's state is stored in ___.
encapsulation
inheritance
polymorphism
fields
Refers to the bundling of data, along with the methods that operate on that data, into a single unit.
Inheritance
Polymorphism
Abstraction
Encapsulation
What are/is the reasons why we use object-oriented programming?
Scalability
Lower cost of development
Security and Reliability
All of the Above
Is it true that the polymorphism offers a lot of flexibility in OOPs?
Yes
No
Inheritance can use the concept of ___________ relationship.
has-a
is-a
one-to-one
one-to-many
An abstract method is a method ____________
with a return statement
which cannot be overridden
with a return statement and can be overridden
with no definition
In the JAVA programming language, the concept of keeping data private is known as __________.
polymorphism
information hiding
static binding
inheritance
Choose the FALSE statement about abstract class
It is a superclass with generic behaviour
Definition of abstract method is implemented in subclass
Subclasses must implement all the abstract methods in the superclass
Abstract class must have more than one abstract method
_______________ is a key concept, enabling an object of a subclass to be treated like an object of its superclass.
Classes and subclasses
Data abstraction
Static polymorphism
Information hiding
Which of the following is true about method overloading?
It allows a method to have different return types
It is not possible in Java
It involves creating multiple methods with the same name but different parameters
It can only be done in abstract classes
What is the program that allows Java to run on any computer?
Java Virtual Machine
Java Compiler
Windows OS
Linux
Bank tom = new Bank(5000.0);
Which is the class?
Classes in Java are:
Abstract data types, used as a template of objects
Where students learn
Dungeons and Dragons Character types
None of these
<class name><Object name>=new <class name>();
This is syntax of creating ______.
class
object
method
function
Predict the output of following Java program?
class Test {
int i;
}
class Main {
public static void main(String args[]) {
Test t;
System.out.println(t.i);
}
0
garbage value
Compiler Error
Run Time Error
Predict the output of following Java program
class Test
{ int i;
}
class Main
{ public static void main(String args[])
{ Test t = new Test();
System.out.println(t.i);
} }
Garbage Value
0
Compiler Error
Runtime error
