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. Can not be overridden with the same name

  2. Can use the inheritance facility in PRPC

  3. Can be created with the same name in different ruleset

  4. Can be created with the same name in different class

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

Property rules in PRPC can be created with the same name in different rulesets (allowing versioning and specialization) and in different classes (enabling class-specific properties). They cannot be overridden with the same name in the same ruleset and class combination, but PRPC's inheritance facility allows derived classes to access properties defined in parent classes.

Multiple choice technology web technology
  1. Citi-, Rule-, HTML-

  2. Work-, Data-, and History-

  3. Class-, Property-, Method-

  4. none of the above

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

All custom classes in PRPC inherit from the three base classes: Work- (for work objects and case types), Data- (for reusable data and reference data), and History- (for historical instances and audit records). These form the foundation of PRPC's class hierarchy.

Multiple choice technology security
  1. Java sand box environment provides protection against decompilation

  2. Java is compiled into ELF binaries and cannot be decompiled

  3. Java byte code can always be decompiled, code obfuscators can make the reverse engineering process more time confusing but cannot prevent it

  4. Java is difficult to decompile because the Just-In-Time compiler automatically perform string encryption by default

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

Java bytecode can be decompiled to recover readable source code. Code obfuscators make reverse engineering harder by renaming variables and adding control flow complexity, but cannot prevent decompilation entirely. The sandbox protects against runtime threats, not decompilation.

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.

Multiple choice technology web technology
  1. ActiveRecord

  2. ApplicationRecord

  3. ActiveSummary

  4. ActiveModel

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

In Rails, every model class inherits from ActiveRecord::Base (or ApplicationRecord in Rails 5+, which itself inherits from ActiveRecord::Base). This provides ORM functionality, database interaction, validations, and associations. ActiveRecord is the core Rails component that connects models to database tables. ActiveModel is for non-database models, and the other options don't exist.

Multiple choice technology security
  1. Java sand box environment provides protection against decompilation

  2. Java is compiled into ELF binaries and cannot be decompiled

  3. Java byte code can always be decompiled, code obfuscators can make the reverse engineering process more time confusing but cannot prevent it

  4. Java is difficult to decompile because the Just-In-Time compiler automatically perform string encryption by default

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

Java bytecode can always be decompiled because it contains enough metadata to reconstruct readable source code. Code obfuscators make decompilation harder by renaming variables and obscuring control flow, but cannot prevent it. The Java sandbox (A) is about runtime security, not decompilation prevention. Java is not compiled to ELF binaries (B). JIT compilers don't perform string encryption by default (D).

Multiple choice technology programming languages
  1. overload method

  2. override method

  3. ploymorphism

  4. none

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

In most programming languages like Java, methods with the same name and same argument list must have the same return type. Different return types alone do not constitute valid overloading or overriding - this creates ambiguity and is not allowed.

Multiple choice technology programming languages
  1. Nothing

  2. Class object

  3. class

  4. calss reference

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

In Java, every class implicitly extends java.lang.Object. Therefore, the superclass of Class is Object. The option text 'Class object' refers to the Object class, which is the root of the class hierarchy.

Multiple choice technology programming languages
  1. default access

  2. public

  3. private

  4. protected

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

Default (package-private) access is the most restrictive that allows classes in the same package to access members. Public allows access from anywhere, private restricts access to the same class only, and protected allows access to subclasses (even in different packages).

Multiple choice technology web technology
  1. An Interface can have a variable

  2. An Interface can have a public member

  3. An Interface can have a static member

  4. An Interface can have a final member

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

In Java, interfaces CAN have variables, but they must be public, static, and final constants (implicitly all three). The statement 'An Interface can have a variable' is correct if referring to constant fields. Interfaces cannot have instance variables or mutable fields. Options B, C, and D describe what interface members CAN be (public, static, final), so they are not incorrect statements.