Computer Knowledge

Object-Oriented Programming

2,239 Questions

Object-oriented programming questions test core computer science concepts like classes, inheritance, polymorphism, and encapsulation. The focus includes Java program structures, method overloading, and memory allocation for objects. This topic is essential for technical sections in various recruitment tests.

Java class definitionsMethod overriding rulesPolymorphism conceptsGeneric type parametersMemory allocation in objects

Object-Oriented Programming Questions

Multiple choice technology
  1. IIr reflect

  2. Iir rule engine

  3. Iir context

  4. Iir rule

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

In rule engine APIs, 'IirContext' represents a rule engine instance or session. It provides the context for executing rules and managing working memory. 'IIrReflect' deals with introspection, 'IirRuleEngine' and 'IirRule' are not standard interface names in common rule engine APIs.

Multiple choice technology programming languages
  1. Public

  2. Protected

  3. Private

  4. Default

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

To solve this question, the user needs to know the concept of access modifiers in object-oriented programming and their default level assigned to the members of a class.

Now, let's go through each option and explain why it is right or wrong:

A. Public: This option is incorrect. Public access modifier allows members of a class to be accessible from anywhere in the program. However, it is not the default access level assigned to members of a class.

B. Protected: This option is incorrect. Protected access modifier allows the members of a class to be accessible within the class and its subclasses. However, it is not the default access level assigned to members of a class.

C. Private: This option is correct. Private access modifier allows the members of a class to be accessible within the class only. It is the default access level assigned to the members of a class if no other access modifier is explicitly specified.

D. Default: This option is incorrect. Default access modifier allows the members of a class to be accessible within the package only. It is not the default access level assigned to the members of a class.

The Answer is: C

Multiple choice technology programming languages
  1. Overloading is a dynamic or run-time binding and Overriding is static or compile-time binding

  2. Redefining a function in a friend class is called function overriding while Redefining a function in a derived class is called a overloaded fucntion.

  3. Overloading is a static or compile-time binding and Overriding is dynamic or run-time binding

  4. Redefining a function in a friend class is called function overloading while Redefining a function in a derived class is called as overridden fucnion.

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Overloading occurs at compile-time when functions with the same name have different parameters. Overriding happens at runtime when a derived class provides a new implementation for a base class virtual function.

Multiple choice technology programming languages
  1. Template class

  2. Function template

  3. Class template

  4. Both a and c

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

A function template in C++ defines a general set of operations that can be applied to various types of data passed as parameters. While a class template defines a family of classes, a function template specifically represents operations (functions). Therefore, 'Both a and c' is incorrect.

Multiple choice technology web technology
  1. a. Parent class should have the model with the same name as child class.

  2. b. In Child class model “Call Super Class Model” Should be enabled.

  3. c. Pattern inheritance should be enabled

  4. d. a and b and c

  5. e. b only

  6. f. a and b

Reveal answer Fill a bubble to check yourself
F Correct answer
Explanation

Model chaining in Pega requires that the parent class has a model with the same name as the child class model (a), and the child class model has 'Call Super Class Model' enabled (b). Pattern inheritance (c) is a different inheritance mechanism and is not required for model chaining.

Multiple choice technology web technology
  1. Super class is Sub class

  2. Super class, which inherit the properties of another class

  3. Small class nested in Super class

  4. Separate class but inherit properties of Super class

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

A subclass is a separate class that inherits properties and behaviors from a superclass through inheritance. The subclass extends the superclass, gaining its features while adding its own specialized behavior. It is not nested within, nor does the superclass inherit from the subclass.

Multiple choice technology web technology
  1. Objects + Class +Inheritance + Encapsulation + Polymorphism

  2. Methods + Abstraction

  3. Reusability + Message Passing + Dynamic Binding

  4. All above

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Object-Oriented Programming (OOP) encompasses all the concepts listed: objects, classes, inheritance, encapsulation, polymorphism, abstraction, methods, reusability, message passing, and dynamic binding. These are all fundamental pillars of OOP methodology, making 'All above' the correct answer.

Multiple choice technology web technology
  1. Object(s) in library, to share in all swf files

  2. Object(s) which is created by class and share to other class

  3. Object(s) which is created by swf and store on local system

  4. Object(s) which share which their properties

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Shared Objects in Flash are objects created by SWF files that can store data locally on the user's system (similar to cookies). They persist between sessions and allow data to be saved and retrieved. They are not library sharing mechanisms, class-to-class sharing, or property-sharing objects.