oop msc
oop msc
oop msc
a) Inheritance
b) Encapsulation
c) Polymorphism
d) Compilation
2. 2. Which of the following is a type of polymorphism in Java?
a) Compile time polymorphism
b) Execution time polymorphism
c) Multiple polymorphism
d) Multilevel polymorphism
3. When does method overloading is determined?
a) At run time
b) At compile time
c) At coding time
d) At execution time
4. When Overloading does not occur?
a) More than one method with same name but different method signature and different
number or type of parameters
b) More than one method with same name, same signature but different number of signature
c) More than one method with same name, same signature, same number of parameters but
different type
d) More than one method with same name, same number of parameters and type but
different signature
5. Which concept of Java is a way of converting real world objects in terms of class?
a) Polymorphism
b) Encapsulation
c) Abstraction
d) Inheritance
6. Which concept of Java is achieved by combining methods and attribute into a class?
a) Encapsulation
b) Inheritance
c) Polymorphism
d) Abstraction
7. What is it called if an object has its own lifecycle and there is no owner?
a) Aggregation
b) Composition
c) Encapsulation
d) Association
8. What is it called where child object gets killed if parent object is killed?
a) Aggregation
b) Composition
c) Encapsulation
d) Association
9. What is it called where object has its own lifecycle and child object cannot belong to another
parent object?
a) Aggregation
b) Composition
c) Encapsulation
d) Association
10. Method overriding is combination of inheritance and polymorphism?
a) True
b) false
3. What is the difference between method overloading and method overriding in Java?
a) Method overloading occurs within the same class, while method overriding occurs between different
classes.
b) Method overloading involves creating multiple methods with the same name but different parameters,
while method overriding involves providing a different implementation for an inherited method.
c) Method overloading is a compile-time polymorphism concept, while method overriding is a runtime
polymorphism concept.
d) All of the above.
12. What is the difference between static and instance variables in Java?
a) Static variables are associated with the class itself, while instance variables are associated with an
instance of a class.
b) Static variables are shared among all instances of a class, while instance variables have separate values
for each instance.
c) Static variables can be accessed without creating an object, while instance variables require an object
reference.
d) All of the above.
1. Which loop construct in Java is best suited when the number of iterations is known?
a) for loop
b) while loop
c) do-while loop
d) break statement
3. Which loop construct in Java is best suited when the number of iterations is unknown?
a) for loop
b) while loop
c) do-while loop
d) none
4. What is the key difference between a while loop and a do-while loop in Java?
a) The syntax used to define the loop
b) The number of iterations performed
c) The condition check timing
d) The ability to use the break statement
5. Which loop construct guarantees that the loop body is executed at least once?
a) for loop
b) while loop
c) do-while loop
d) continue statement
8. Which loop construct is best suited for iterating over an array or a collection?
a) for loop
b) while loop
c) do-while loop
d) continue statement
9. Which type of loop is best known for its boolean condition that controls entry to the loop?
A. do-while loop
B. for (traditional)
C. for-each
D. while
10. Which type of loop is best known for using an index or counter?
A. do-while loop
B. for (traditional)
C. for-each
D. while
11. Which of the following can loop through an array without referring to the elements by index?
A. do-while loop
B. for (traditional)
C. for-each
D. while