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
-
TripleDES
-
MACTripleDES
-
DES
-
DESCryptoServiceProvider
-
ProtectedMemory
A
Correct answer
Explanation
This .NET cryptographic class represents the super class for Triple data encryption standard algorithms from which all TripleDES implementations must derive.
-
Constant declarations of public, static, and final are optional in any combination.
-
An interface can have only abstract methods and no concrete methods are allowed.
-
A class implementing an interface can itself be abstract.
-
A class can implement any number of interfaces.
-
All of the above
E
Correct answer
Explanation
All of the above are correct statements.
-
A class cannot be both final and abstract.
-
A final class cannot be subclassed.
-
An abstract class cannot be instantiated.
-
A single abstract method in a class means that the whole class must be abstract.
-
None of the above
E
Correct answer
Explanation
All the statements are correct.
-
Default members can be accessed only by classes in the same package.
-
Protected members can be accessed by other classes in the same package only.
-
A protected member inherited by a subclass within another package is not accessible to any other class.
-
Public members are not accessible in other packages.
-
Both (2) and (4)
D
Correct answer
Explanation
Public members are accessible everywhere whether in the current package or different.
-
Inheritance
-
Encapsulation
-
Abstraction
-
Serialization
-
Polymorphism
D
Correct answer
Explanation
Serialization is not an OOP feature and it stores the objects in a persistent medium.
Polymorphism defines an interface and the operations that can be performed based on different data types.
-
RandomNumberGenerator
-
OidCollection
-
OidEnumerator
-
Oid
-
CryptoConfig
D
Correct answer
Explanation
This .NET cryptographic class represents a cryptographic object identifier.
-
RijndaelManaged
-
Rijndael
-
RC2
-
MD5
-
ProtectedData
B
Correct answer
Explanation
This .NET cryptographic class represents the super class from which all implementations of the Rijndael symmetric encryption algorithm must inherit.
-
RandomNumberGenerator
-
MaskGeneration
-
RNGCryptoServiceProvider
-
RC2
-
MD5CryptoServiceProvider
C
Correct answer
Explanation
This .NET cryptographic class implements a cryptographic random number generator using the implementation provided by CSP.
-
RC2
-
MD5CryptoServiceProvider
-
RC2CryptoServiceProvider
-
DESCryptoServiceProvider
-
ProtectedData
C
Correct answer
Explanation
This .NET cryptographic class defines the wrapper object to access the CSP implementation of the RC2 algorithm.
-
a member function
-
a class
-
an operator
-
a data item
A
Correct answer
Explanation
A member function is a function that is defined within a class scope. These functions operate on objects of the class and can access private and protected members. Member functions define the behavior and operations that objects of the class can perform.
-
declare a member function that is defined in a subclass
-
designate the absence of a type
-
declare objects that can be modified outside of program control
-
declare a synonym for an existing type
-
Making C+ operators work with objects
-
Giving C++ operators more than they can handle
-
Giving new meanings to existing C++ operators
-
Making new C++ operators
C
Correct answer
Explanation
Operator overloading allows programmers to define custom behavior for existing C++ operators when used with user-defined types (objects). For example, you can overload the + operator to work with string objects to concatenate them. Option C correctly describes this as giving new meanings to existing operators. Options A and B are misleading, and D is incorrect because you cannot create entirely new operators - only redefine existing ones.
-
four
-
three
-
two
-
five
-
none of these
C
Correct answer
Explanation
Byte stream can be defined by using two class hierarchies. These two classes are input stream and Output stream.
-
Object Output Stream
-
Piped Output Stream
-
ByteOutputStream
-
Both 1 and 2
-
All of these
D
Correct answer
Explanation
Option 1 and 2 are the correct choices.
-
Nine
-
Eight
-
Seven
-
Six
-
Five
D
Correct answer
Explanation
There are 6 subclasses of reader Class in Java. These are 1) BufferedReader for buffering other readers 2) ChararrayReader for reading from char array 3) FilterReader for readin filter streams 4) InputStreamReader for reading a character stream 5) PipedReader for reading from pipe 6) StringReader for reading from a string.So this is the correct answer.