0% found this document useful (0 votes)
169 views15 pages

4th LCC ICTO test

The document contains a series of multiple-choice questions (MCQs) related to Object-Oriented Programming (OOP) compiled by Mr. Mussawar Hussain. It covers various topics such as inheritance, polymorphism, constructors, and exception handling, providing correct answers for each question. The test is intended for students of LCC(Sigs.IT) to assess their understanding of OOP concepts.

Uploaded by

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

4th LCC ICTO test

The document contains a series of multiple-choice questions (MCQs) related to Object-Oriented Programming (OOP) compiled by Mr. Mussawar Hussain. It covers various topics such as inheritance, polymorphism, constructors, and exception handling, providing correct answers for each question. The test is intended for students of LCC(Sigs.IT) to assess their understanding of OOP concepts.

Uploaded by

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

4th IT related Test By Mr.

Mussawar Hussain

4th Test for LCC(Sigs.IT) Object Oriented


programming MCQS Test By
Mr.Mussawar Hussainsain
Contact us:03420666929

1. Which of these features of OOP would indicate code reusability?

a. Polymorphism

b. Abstraction

c. Inheritance

d. Encapsulation

Answer: (c) Inheritance

2. Which language does not support polymorphism but supports classes?

a. Ada

b. C++

c. Java

d. SmallTalk
4th IT related Test By Mr.Mussawar Hussain

Answer: (a) Ada

3. Which of these specifiers would be applied to the constructors only?

a. Explicit

b. Implicit

c. Protected

d. Public

Answer: (a) Explicit.

4. A constructor _____________.

a. May consist of a return type

b. Doesn’t consist of any return type

c. Has some return type

d. Of a derived class has a return type

Answer: (b) Doesn’t consist of any return type

5. The access specifier that is/are the most secure during inheritance is/are _______________.
4th IT related Test By Mr.Mussawar Hussain

a. Protected

b. Private

c. Private and Default

d. Default

Answer: (b) Private

6. If in case, in multiple inheritances, a class R would inherit the Class Q, while Class Q would
inherit the class P, then in which sequence would their destructors be called in case we
declare an object of Class R?

a. ~R() then ~P() then ~Q()

b. ~P() then ~Q() then ~R()

c. ~Q() then ~R() then ~P()

d. ~R() then ~Q() then ~P()

Answer: (d) ~R() then ~Q() then ~P()

7. The memory that is allocated for any objects is ____________.

a. Cache

b. HDD
4th IT related Test By Mr.Mussawar Hussain

c. ROM

d. RAM

Answer: (d) RAM

8. Which of these classes is a specialization of some more general template classes?

a. Integer

b. Maths

c. String

d. Digit

Answer: (c) String

9. A derived class is also called a ______________.

a. Small class

b. Subclass

c. Noticeable class
4th IT related Test By Mr.Mussawar Hussain

d. Big class

Answer: (b) Subclass

10. Which of these inheritances is shown in case we inherit some base class from another class,
then one of the classes derives it?

a. Single

b. Multiple

c. Multi-level

d. Hierarchical

Answer: (c) Multi-level

11. Hierarchical inheritance could be some subset of _________________ inheritance.

a. Multilevel

b. Single level

c. Multiple

d. Hybrid

Answer: (d) Hybrid


4th IT related Test By Mr.Mussawar Hussain

12. What is the name of the feature in which we enforce the definitions of the abstract function
at the compile time?

a. Dynamic Polymorphism

b. Static Polymorphism

c. Dynamic or Static Polymorphism according to need

d. Polymorphism

Answer: (a) Dynamic Polymorphism

13. If in case a class is called in the main function directly and has a public member function,
then ____________________.

a. It will lead to the production of an undeclared function error

b. It will lead to the production of an out of memory error

c. The program will only give warning

d. The program will shut the computer down

Answer: (a) It will lead to the production of an undeclared function error

14. __________ is the universal handler class for exceptions.


4th IT related Test By Mr.Mussawar Hussain

a. Maths

b. Object

c. Exceptions

d. Errors

Answer: (c) Exceptions

15. For catching multiple exceptions in a single catch block, then how do we separate exceptions
in the syntax?

a. Hyphen

b. Vertical bar

c. Modulus

d. Plus

Answer: (b) Vertical bar

16. Where are the temporary objects (that are created during the return by value) created?

a. Inside the calling function

b. Inside the main function


4th IT related Test By Mr.Mussawar Hussain

c. Within the function

d. Outside the function scope

Answerc) Within the function

17. What shall we use in the case of safe downcast?

a. Implicit cast

b. Manual cast

c. Dynamic cast

d. Static cast

Answer: (c) Dynamic cast

18. Which of these types of values result from a delete operator?

a. Null

b. Null pointer

c. Void pointer

d. Void
4th IT related Test By Mr.Mussawar Hussain

Answer: (d) void

19. Which of these attributes can we use if we want to get the actual size of any array?

a. Array_name.length

b. Size.Array

c. Length.Array_name

d. Array.Size

Answer: (a) Array_name.length

20. Which function is used to get any character that is present at a certain index of a string?

a. Char charIn(StringName);

b. Char charAt(index);

c. Char charIn(index);

d. Char charAt(StringName);

Answer: (b) char charAt(index);


4th IT related Test By Mr.Mussawar Hussain

21. Which of following is shared structure of a set of similar objects

1. Encapsulation
2. A Class
3. Inheritance
4. None of Above

View Answer
A Class is shared structure of a set of similar objects

22. Which of following does not have a body

1. An Interface
2. A Class
3. An Abstract Method
4. none of above

View Answer
An Abstract Method does not have a body

23. Which of following is pure object oriented programming language?

1. Java
2. SmallTalk
3. C++
4. Kotlin

View Answer
SmallTalk is is pure object oriented programming language

44. In oops public, private & protected are

1. Classes
2. Access Modifiers
3. Interfaces
4. Method signature

View Answer
Public, private & protected are Access Modifiers in OOPs

25. A private member of a class is visible to

1. every where
2. in sub class
4th IT related Test By Mr.Mussawar Hussain

3. members to same package


4. only members of same class

View Answer
A private member of a class is visible to only members of same class

Download Free : OOPs MCQ PDF


26. Which keyword is used to inherit a class or abstract class is

1. extends
2. extend
3. implement
4. inherit

View Answer
extends is used to inherit a class or abstract class.

27. Which of the following is an abstract data type?

1. Double
2. String
3. Int
4. Class

View Answer
Class is an abstract data type

28. Can we overload constructor in derived class?

1. Yes
2. No

View Answer
No, we can't overload constructor in derived class

29. Which of the following is not related to OOPS?

1. Class and Object


2. Constructor and Destructor
3. Structure and Union
4. Inheritance and Polymorphism

View Answer
4th IT related Test By Mr.Mussawar Hussain

Structure and Union is not related to OOPS

30. We can not create instance of

1. Anonymous class
2. Nested class
3. Parent class
4. Abstract class

View Answer
We cannot create an instance of Abstract class

Read Best: Joomla interview questions


31. Constructor can return a value

1. True
2. False

View Answer
False , Constructor cannot return any value

32. OOPs is invented by _______

1. Andrea Ferro
2. Dennis Ritchie
3. Adele Goldberg
4. Alan Kay

View Answer
OOPs is invented by Alan Kay

33. Which of the following is true for copy constructor?

1. The argument object is passed by reference


2. It can't be defined with zero arguments
3. Used when an object is passed by value to a function
4. Used when a function returns an object

View Answer
It can't be defined with zero arguments

34. Which Feature of OOP encourges the code reusability?


4th IT related Test By Mr.Mussawar Hussain

1. Polymorphism
2. Inheritance
3. Abstraction
4. Encapsulation

View Answer
35. Inheritance encourges the code reusability in OOPs Which is correct syntax for
creating an object of Class in Java?

1. classname objectname= new() integer;


2. classname objectname= new() classname()
3. classname objectname= new classname;
4. classname objectname= new classname()

View Answer
classname objectname= new classname() is correct way to an object of Class in Java

Download Free: Joomla interview questions PDF


36. Which language doesn't support single level inheritance?

1. C lanaguage
2. Java
3. Kotlin
4. C++

View Answer
C lanaguage don't have any concept of inheritance

37.. Which of the following is not the member of class?

1. Static function
2. Friend function
3. Const function
4. Virtual function

View Answer
Static function is not a member of a class.

38. Which of the following is universal class for exception handling?

1. Object
2. Errors
4th IT related Test By Mr.Mussawar Hussain

3. Exceptions
4. Maths

View Answer
Exceptions is universal class for exception handling

39. Which among the following handles the undefined class exception in
program?

1. ClassNotFound
2. NoClassException
3. ClassFoundException
4. ClassNotFoundException handles the undefined class exception in program

View Answer
ClassNotFoundException

40. How many catch blocks you can use with single Try block?

1. Only 2
2. Only 1
3. Maximum 256
4. As many as required

View Answer
You can use As many as required catch block with a single Try Block

41. The principle of abstraction ..................

1. The principle of abstraction


2. is used to achieve OOPS
3. is used to remove longer codes
4. None of above

View Answer
The principle of abstraction

42. ............. violates the definition of encapsulation.

1. Public variables
2. Local variables
3. Array variables
4. Global variables
4th IT related Test By Mr.Mussawar Hussain

View Answer
Global variables

43. Which operator overloads using the friend function?

1. =
2. ->
3. *
4. ()

View Answer
*

44. . Which feature of OOPS described the reusability of code?

1. Inheritance
2. Abstraction
3. Polymorphism
4. Encapsulation

View Answer
Inheritance

45. Who developed object-oriented programming?

1. Alan Kay
2. Andrea Ferro
3. Dennis Ritchie
4. Adele Goldberg

View Answer
Alan Kay

You might also like