Computer Knowledge

Object-Oriented Programming

2,686 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 web technology
  1. Pattern Inheritance

  2. Direct Inheritance

  3. Both

  4. None of the above

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

In Pega, every class MUST have a Direct Inheritance specified - it is mandatory. Direct Inheritance defines which class the new class immediately extends (its parent class in the class hierarchy). Pattern Inheritance is optional and only applies if the class name follows pattern conventions. Option B is correct because without Direct Inheritance, a class cannot be created. Option A is not mandatory, option C is incorrect (only Direct Inheritance is required), and option D contradicts the requirement.

Multiple choice technology web technology
  1. Covered work objects inherit from Cover-Object- class

  2. Ordinary work objects inherit from the Work-Object- class

  3. Folders may contain only one covered work object

  4. Folders may be a work object

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

In PEGA, ordinary work objects inherit from the Work- base class (patterned as Work-Object- in class naming). Covered work objects do not use a separate 'Cover-Object-' class - they are work objects that have a cover relationship with another work object. Folders can contain multiple covered work objects, not just one, and folders themselves are not work objects.

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. a. They should be in different rule sets since they are 2 distinct classes

  2. b. They should be in same rule set

  3. c. It’s not a good practice to create flows in cover class

  4. d. Always add covered objects from cover

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

Work classes and cover classes should be in the same rule set to maintain proper class structure and inheritance. Cover classes are used to group related work objects, and keeping them in the same rule set ensures consistent access and management.

Multiple choice technology web technology
  1. a. It overrides properties

  2. b. It doesn’t override properties

  3. c. Calls super class model if super class modeling enabled

  4. d. Use identical names for the model

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

Model chaining in Pega DOES override properties in child classes with properties from parent class models. Option B states it doesn't override, which is the false statement the question seeks. Options A, C, and D describe actual behaviors of model chaining.

Multiple choice technology web technology
  1. a. Property reference in value field

  2. b. Literal Value

  3. c. Using Property-Set method

  4. d. Calling a Function

  5. e. Boolean Expression

Reveal answer Fill a bubble to check yourself
A,B,D,E Correct answer
Explanation

In a Pega Data Model (or Declare Expressions / Model rules like Data Transforms), property initialization can be defined using property references in value fields, literal values, calling functions, or boolean expressions. Property-Set is an activity method, not a model rule initialization option.

Multiple choice technology web technology
  1. Data-Operator-Party

  2. Data-Party-Operator

  3. Party-Data-Operator

  4. Party-Operator-Data

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

Data-Operator-Party is Pega's standard class for representing operator parties, including originators. The naming pattern follows Pega's class hierarchy convention. Options B, C, and D use incorrect class naming patterns that don't follow Pega conventions.

Multiple choice technology web technology
  1. Rule-File-Binary.

  2. Rule-File-Text

  3. Rule-Obj-Binary

  4. Rule-Obj-Text

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

Rule-File-Binary is the Pega rule type designed to store binary file content such as images (JPG, JPEG), PDFs, and other non-text files. Rule-File-Text is for text files, while Rule-Obj-Binary and Rule-Obj-Text are not standard Pega rule types for file storage.

Multiple choice technology web technology
  1. 5, 5

  2. 5, 1

  3. 1, 5

  4. 1, 1

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

For a RuleSet with 5 versions, Rule-RuleSet-Name has 1 instance (one name entry) while Rule-RuleSet-Version has 5 instances (one per version like 01-01, 01-02, etc.). The name is shared across versions.