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
-
Protected
-
Public
-
Private
-
Get accessor
-
Type
A
Correct answer
Explanation
By using this access modifier, the variables are accessible only from within their own class or from a class derived from that class.
-
Get accessor
-
Set accessor
-
Public
-
GET
-
POST
B
Correct answer
Explanation
This property uses an implicit parameter called value whose type is the type of the property.
-
AesCryptoServiceProvider
-
AesManaged
-
Aes
-
ProtectedData
-
AsnEncodedDataEnumerator
C
Correct answer
Explanation
This encryption-decryption class of .Net technology represents the abstract base class from which all implementations of the advanced encryption standard must inherit.
-
CryptoConfig
-
CryptographicAttributeObject
-
CryptographicAttributeObjectCollection
-
ProtectedData
-
CngAlgorithm
B
Correct answer
Explanation
This encryption-decryption class of .Net technology contains a type and a collection of values associated with that type.
-
AsymmetricKeyExchangeDeformatter
-
AsymmetricSignatureFormatter
-
AsnEncodedData
-
AsymmetricKeyExchangeFormatter
-
ProtectedData
D
Correct answer
Explanation
This encryption-decryption class of .Net technology represents the base class from which all asymmetric key exchange formatters derive.
-
DSA
-
DSASignatureFormatter
-
DSACryptoServeiceProvider
-
DESCryptoServiceProvider
-
ProtectedData
C
Correct answer
Explanation
This encryption-decryption class of .Net technology defines a wrapper object to access the CSP implementation of the digital signature algorithm.
-
Public
-
Private
-
ProtectedFriend
-
Name
-
Get accessor
C
Correct answer
Explanation
By using this access modifier, the variables can be used by code in the same assembly as well as by code in derived classes.
-
DES
-
DESCryptoServiceProvider
-
DSA
-
ProtectedData
-
CngKey
A
Correct answer
Explanation
This encryption-decryption class of .Net technology represents the base class for the data encryption standard algorithm from which all data encryption standard implementations must derive.
-
DSASignatureFormatter
-
DSASignatureDeformatter
-
DSA
-
ProtectedData
-
AsymmetricSignatureFormatter
B
Correct answer
Explanation
This encryption-decryption class of .Net technology verifies a digital signature algorithm PKCS#1 version 1.5 signature.
-
CryptographicAttributeObjectCollection
-
CryptoConfig
-
ProtectedMemory
-
CryptographicAttributeObjectEnumerator
-
AsnEncodedDataEnumerator
D
Correct answer
Explanation
This encryption-decryption class of .Net technology provides enumeration functionality for the CryptographicAttributeObjectCollection collection.
-
Public
-
Private
-
Delegate
-
Array
-
String
C
Correct answer
Explanation
It is used to declare a reference type that can be used to encapsulate a named or an anonymous method.
-
Class and subclass
-
Class and instance
-
Set and subset
-
Set and superset
-
Class and set
B
Correct answer
Explanation
A class and an instance are used to represent frame system.
-
public
-
private
-
protected
-
none of these
C
Correct answer
Explanation
In C++ inheritance, a protected member inherited in public mode remains protected in the derived class. Public inheritance maintains the access level - public members stay public, protected members stay protected, and private members remain inaccessible (though they exist in the derived class). This preserves encapsulation while allowing controlled access in the inheritance hierarchy.
-
outside the class definition
-
inside the class definition
-
both inside & outside the class definition
-
none of the above
C
Correct answer
Explanation
C++ allows member functions to be defined either inside the class definition (implicitly inline) or outside the class using the scope resolution operator (::). Defining inside is convenient for short functions, while defining outside keeps the class interface clean. Both approaches are valid and commonly used depending on function complexity and coding style preferences.
-
Linker combines the object files into a single executable program.
-
Linker converts the source file into object file.
-
Linker converts the source file into executable file.
-
None of the above
A
Correct answer
Explanation
A linker combines multiple object files (compiled from source code) into a single executable program. It resolves references between modules and performs address binding. Compilers create object files, while linkers create the final executable.