OOP MCQs Test 1

1. Can abstract class have main() function defined inside it?

a. Yes, always

b. No, main must not be defined inside abstract class

c. Yes, depending on return type of main()

d. No, because main() is not abstract function

Correct Option: a

2. If there is an abstract method in a class then?

a. Class must be public

b. Class must be abstract class

c. Class may or may not be abstract class

d. Class is generic

Correct Option: b

3. Abstract classes can ___ instances.

a. Never have

b. Always have

c. Have array of

d. Have pointer of

Correct Option: a

4. We _________to an abstract class.

a. Can create pointers

b. Can create pointers or references

c. Can’t create any reference, pointer or instance

d. Can create references

Correct Option: b

5. Which among the following is an important use of abstract classes?

a. Header less

b. Class inheritance

c. Class Libraries

d. Class definitions

Correct Option: c

6. The abstract classes in java can _________________

a. Can’t implement any type of constructor

b. Implement constructors

c. Can’t implement constructor

d. Can implement only unimplemented methods

Correct Option: b

7. Abstract class can’t be nal in java.



Correct Option: a

8. Can abstract classes have static methods (Java)?

a. Yes, but depends on code

b. No, never

c. No, static members can’t have different values

d. Yes, always

Correct Option: d

9. Hiding the implementation complexity can ______

a. Make the programming easy

b. Make the programming complex

c. Provide more number of features

d. Provide better features

Correct Option: a

10. Class is _________ abstraction

a. Real

b. Hypothetical

c. Object

d. Logical

Correct Option: d

11. Object is ________ abstraction.

a. Logical

b. Real

c. Hypothetical

d. Object

Correct Option: b

12. Abstraction gives higher degree of ____

a. Idealized interface

b. Class usage

c. Program complexity

d. Unstable interface

Correct Option: a

13. Which among the following can be viewed as combination of abstraction of data and code

a. Class

b. Interfaces

c. Object

d. Inheritance

Correct Option: c

14. Higher the level of abstraction, higher are the details.



Correct Option: a

15. Encapsulation and abstraction differ as ________

a. Binding and Hiding respectively

b. Hiding and Binding respectively

c. Can be used any way

d. Hiding and hiding respectively

Correct Option: a

16. Which among the following is not a level of abstraction?

a. Logical level

b. Physical level

c. External level

d. View level

Correct Option: c

17. Using higher degree of abstraction ___

a. May get unsafe

b. Can be safer

c. Can increase vulnerability

d. May reduce readability

Correct Option: b

18. How many types of access specifiers are provided in OOP (C++)?

a. 3

b. 2

c. 1

d. 4

Correct Option: a

19. Which among the following can be used together in a single class?

a. Only private

b. Private and Public together

c. Private and Protected together

d. All three together

Correct Option: d

20. If a class has all the private members, which specifier will be used for its implicit constructor?

a. Default

b. Public

c. Private

d. Protected

Correct Option: b

21. Which access specifier should be used in a class where the instances can’t be created?

a. Private default constructor

b. All private constructors

c. Only default constructor to be protected

d. Only default constructor to be public

Correct Option: b

22. Which among the following is the language which supports classes but not polymorphism?

a. Java

b. SmallTalk

c. Ada

d. C++

Correct Option: c

23. Which type of function among the following shows polymorphism?

a. Undefined functions

b. Class member functions

c. Inline function

d. Virtual function

Correct Option: d

24. Which among the following can’t be used for polymorphism?

a. Predefined operator overloading

b. Constructor overloading

c. Static member functions

d. Member functions overloading

Correct Option: c

25. Which is correct syntax to access the static member functions with class name?

a. className -> functionName;

b. className . functionName;

c. className :: functionName;

d. className : functionName;

Correct Option: c

26. Which among the following is not applicable for the static member functions?

a. Variable pointers

b. Function pointers

c. this pointer

d. void pointers

Correct Option: c

27. The static member functions ________

a. Can’t be declared const

b. Can’t be declared const, volatile or const volatile

c. Can’t be declared const or volatile

d. Can’t be declared volatile

Correct Option: b

28. Which keyword should be used to declare the static member functions?

a. const

b. common

c. stat

d. static

Correct Option: d

29. Which among the following can’t be used to access the members in any way?

a. Arrow operator

b. Scope resolution

c. Single colon

d. Dot operator

Correct Option: c

30. The static data member _________________

a. Can’t be characters

b. Can’t be mutable

c. Can be mutable

d. Can’t be integer

Correct Option: b

31. Can constructors be overloaded in derived class?

a. No, programmer can’t do it

b. Yes, if derived class has no constructor

c. Yes, always

d. No, never

Correct Option: d

32. When is the constructor called for an object?

a. As soon as overloading is required

b. As soon as object is created

c. As soon as class is created

d. As soon as class is derived

Correct Option: b

33. Which among the following function can be used to call default constructor implicitly in java?

a. super()

b. sub()

c. this()

d. that()

Correct Option: c

34. Which among the following is not valid in java?

a. Default value constructors

b. String argument constructor

c. Recursive constructor call

d. Constructor overloading

Correct Option: c

35. Which among the following is false?

a. Constructors can be overloaded in C++

b. Constructors overloading depends on dierent signatures

c. Constructor can’t be overloaded in Kotlin

d. Constructors can’t be called recursively in java

Correct Option: c

36. Which is correct syntax?

a. classname objectname= new classname;

b. classname objectname= new() integer;

c. classname objectname= new() classname();

d. classname objectname= new classname();

Correct Option: d

37. Which definition best describes an object?

a. Child of a class

b. Overview of a class

c. Instance of a class

d. Instance of itself

Correct Option: c

38. How many objects can be declared of a specic class in a single program?

a. As many as you want

b. 127

c. 32768

d. 1

Correct Option: a

39. Which of the following is incorrect?

a. class student{ }; student s[5];

b. class student{ }s;

c. class student{ }; student s;

d. class student{ }s[];

Correct Option: d

40. The object can’t be __________

a. Passed by reference

b. Passed as function

c. Passed by copy

d. Passed by value

Correct Option: b

41. Functions can’t return objects.



Correct Option: a

42. How members of an object are accessed?

a. Using pointer only

b. Using dot operator/period symbol

c. Using scope resolution operator

d. Using member names directly

Correct Option: b

43. Object declared in main() function _____

a. Can be used by any other function

b. Can’t be used by any other function

c. Can be accessed using scope resolution operator

d. Can be used by main() function of any other program

Correct Option: b

44. How many types of inheritance can be used at a time in single program?

a. Any type, any number of times

b. Any 4 types

c. Any three types

d. Any two types

Correct Option: a

45. Which type of inheritance cannot involve private inheritance?

a. Multiple

b. Single level

c. Hybrid

d. All types can have private inheritance

Correct Option: d

46. How many classes can be inherited by a single class in java?

a. Only 1

b. Only 27

c. Only 255

d. Only 1024

Correct Option: a

47. Which programming language restricts the use of multiple inheritance?

a. PHP

b. C++

c. SmallTalk

d. Java

Correct Option: d

48. How to overcome diamond problem ?

a. Using alias name

b. Using virtual keyword with same name function

c. Can’t be done

d. Using separate derived class

Correct Option: b

49. What is the syntax to overload an operator?

a. className->operator(parameters)

b. className::operator(parameters)

c. className:operator(parameters)

d. className.operator(parameters)

Correct Option: b

50. Why the left parameter is removed from parameter list?

a. Because it can’t be referred by *this pointer

b. Because it is never used in definitions

c. Because it is of no use

d. Because it becomes parameter pointed by *this

Correct Option: d