0% found this document useful (0 votes)
59 views8 pages

MCQ Oops

Uploaded by

dharamrajyadav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views8 pages

MCQ Oops

Uploaded by

dharamrajyadav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

MCQ

object orented programming and java programming

1. Who invented OOP?


a) Andrea Ferro
b) Adele Goldberg
c) Alan Kay
d) Dennis Ritchie

2. Which is not a feature of OOP in general definitions?


a) Efficient Code
b) Code reusability
c) Modularity
d) Duplicate/Redundant data

3. Which was the first purely object oriented programming language developed?
a) Kotlin
b) SmallTalk
c) Java
d) C++

4. When OOP concept did first came into picture?


a) 1980’s
b) 1995
c) 1970’s
d) 1993

5. Which feature of OOP indicates code reusability?


a) Abstraction
b) Polymorphism
c) Encapsulation
d) Inheritance

6. Which header file is required in C++ to use OOP?


a) OOP can be used without using any header file
b) stdlib.h
c) iostream.h
d) stdio.h

7. Why Java is Partially OOP language?


a) It allows code to be written outside classes
b) It supports usual declaration of primitive data types
c) It does not support pointers
d) It doesn’t support all types of inheritance

8. Which among the following doesn’t come under OOP concept?


a) Data hiding
b) Message passing
c) Platform independent
d) Data binding

9. Which is the correct syntax of inheritance?


a) class base_classname :access derived_classname{ /*define class body*/ };
b) class derived_classname : access base_classname{ /*define class body*/ };
c) class derived_classname : base_classname{ /*define class body*/ };
d) class base_classname : derived_classname{ /*define class body*/ };

10. Which feature of OOP is indicated by the following code?

class student{ int marks; };


class topper:public student{ int age; topper(int age){ this.age=age; } };

a) Encapsulation and Inheritance


b) Inheritance and polymorphism
c) Polymorphism
d) Inheritance

11. The feature by which one object can interact with another object is _____________
a) Message reading
b) Message Passing
c) Data transfer
d) Data Binding

12. Which among the following, for a pure OOP language, is true?
a) The language should follow at least 1 feature of OOP
b) The language must follow only 3 features of OOP
c) The language must follow all the rules of OOP
d) The language should follow 3 or more features of OOP

13. How many types of access specifiers are provided in OOP (C++)?
a) 4
b) 3
c) 2
d) 1

14. In multilevel inheritance, which is the most significant feature of OOP used?
a) Code efficiency
b) Code readability
c) Flexibility
d) Code reusability

15. What is encapsulation in OOP?


a) It is a way of combining various data members and member functions that operate on
those data members into a single unit
b) It is a way of combining various data members and member functions into a single unit
which can operate on any data
c) It is a way of combining various data members into a single unit
d) It is a way of combining various member functions into a single unit

16. Which of the following is not true about polymorphism?


a) Helps in redefining the same functionality
b) Increases overhead of function definition always
c) It is feature of OOP
d) Ease in readability of program

17. Which constructor will be called from the object created in the below C++ code?

class A
{
int i;
A()
{
i=0; cout<<i;
}
A(int x=0)
{
i=x; cout<<I;
}
};
A obj1;

a) Parameterized constructor
b) Default constructor
c) Run time error
d) Compile time error

18. What is an abstraction in object-oriented programming?


a) Hiding the implementation and showing only the features
b) Hiding the important data
c) Hiding the implementation
d) Showing the important data

19. Which among the following can show polymorphism?


a) Overloading &&
b) Overloading <<
c) Overloading ||
d) Overloading +=

20. In which access should a constructor be defined, so that object of the class can be
created in any function?
a) Any access specifier will work
b) Private
c) Public
d) Protected
True False Questions
21. In Java, every class inherits from the Object class.

a. True.

b. False

22. : Abstraction allows hiding the internal implementation details of methods.

a. True.
b. False

23. Java supports multiple inheritance of classes.

a. True.

b. False

24. Polymorphism allows a method to have different implementations based on the


number of arguments it receives.

a. True.

b. False

25. Encapsulation ensures that sensitive data is accessible only within the same class.

a. True.

b. False

26. All variables declared within an interface are implicitly static and final.

a. True.

b. False

27. In Java, the 'extends' keyword is used to implement inheritance between classes.
a. True.

b. False

28. Overloading occurs when a subclass provides a specific implementation of a


method defined in its superclass.

a. True.

b. False

29. Abstract classes in Java can be instantiated directly.

a. True.

b. False

30. The 'super' keyword in Java is used to call the superclass constructor explicitly.

a. True.

b. False

31. Java interfaces can contain constructors.

a. True.

b. False

32. In Java, method overriding is based on the signature of the method only, not its
return type.

a. True.

b. False

33. All methods in an interface are implicitly public and abstract.

a. True.

b. False
34. In Java, the 'final' keyword can be used to prevent a method from being
overridden.

a. True.

b. False

35. Java's garbage collection mechanism ensures that memory leaks never occur.

a. True.

b. False

36. A Java class can directly extend multiple classes.

a. True.

b. False

37. In Java, the 'this' keyword refers to the current instance of the class.

a. True.

b. False .

38. In Java, constructors can be inherited by subclasses.

a. True.

b. False

39. The 'implements' keyword is used in Java to declare inheritance between classes.

a. True.

b. False

40. Java does not support operator overloading.

a. True.
b. False

Answer Key
S/N ANSWERS
1 C
2 D
3 B
4 C
5 D
6 A
7 B
8 C
9 B
10 A
11 B
12 C
13 B
14 D
15 A
16 B
17 D
18 A
19 B
20 C
21 T
22 T
23 F
24 F
25 T
26 T
27 T
28 F
29 F
30 T
31 F
32 T
33 T
34 T
35 F
36 F
37 T
38 F
39 F
40 T

DISCRIPTIVE PAPER

1. Explain the concept of inheritance in Java with an example. Discuss its advantages and
limitations.
2. Describe the difference between abstract classes and interfaces in Java. Provide
examples to illustrate their usage.
3. What is polymorphism in Java? How does it help in achieving flexibility and reusability in
code? Provide examples.
4. Discuss the significance of encapsulation in object-oriented programming. How does
Java support encapsulation? Provide code examples.
5. Explain the concept of exception handling in Java. Discuss the role of try, catch, and
finally blocks in handling exceptions.
6. Describe the various access modifiers in Java (public, private, protected, and default).
Provide examples to illustrate their usage.
7. What are the differences between the == operator and the equals() method in Java?
Provide examples to demonstrate their usage.
8. Discuss the importance of interfaces in Java. How do interfaces facilitate multiple
inheritance? Provide an example.
9. Explain the concept of method overloading and method overriding in Java. Provide
examples to illustrate each concept.
10. Describe the purpose and usage of the static keyword in Java. Discuss static variables,
methods, and blocks.

You might also like