Computer Knowledge
Java Core Classes and Threads
1,935 Questions
Java core classes and threads form the foundation of object oriented programming and are crucial for IT officer and programming exams. This includes concepts like string mutability, collections, and multithreading. Solve these questions to test your practical coding and theoretical knowledge.
String and StringBuffer classesThread execution methodsJava collections frameworkCharacter streams input outputVariable serialization rules
Java Core Classes and Threads Questions
-
Use the Java method
-
AtSetValue(PropertyName, Value)
-
Use the Property-Set method
-
{PropertyName INPUT}
C
Correct answer
Explanation
The Property-Set method is the standard way to update property values in activity steps. It efficiently sets property values without requiring direct Java code. Option B's AtSetValue is incorrect, and Option A's Java method is not the recommended approach in PRPC.
-
Property-Map-Value calls a Rule-Obj-MapValue once, and Property-Map-ValuePair calls it twice
-
Property-Map-Value can call a Rule-Obj-MapValue and pass a single row input, and Property-Map-Value-Pair can call a Rule-Obj-Map Value and pass two row inputs
-
Property-Map-Value can call a Rule-Obj-MapValue and pass a single row input, and Property-Map-Value-Pair can call a Rule-Obj-Map Value and pass a single row input and single column input
-
Property-Map-Value can call a Rule-Obj-MapValue and pass a single row input, and Property-Map-Value-Pair can call a Rule-Obj-Map Value and pass multiple row inputs
C
Correct answer
Explanation
The Property-Map-Value method evaluates a 1D map value rule using a single row input. The Property-Map-ValuePair method evaluates a 2D map value rule, which accepts both a row input and a column input to look up a value.
-
(a) Property-Map-Value calls a Rule-Obj-MapValue once, and Property-Map-ValuePair calls it twice
-
(b) Property-Map-Value can call a Rule-Obj-MapValue and pass a single row input, and Property-Map-Value-Pair can call a Rule-Obj-Map Value and pass two row inputs
-
(c) Property-Map-Value can call a Rule-Obj-MapValue and pass a single row input, and Property-Map-Value-Pair can call a Rule-Obj-Map Value and pass a single row input and single column input
-
(d) Property-Map-Value can call a Rule-Obj-MapValue and pass a single row input, and Property-Map-Value-Pair can call a Rule-Obj-Map Value and pass multiple row inputs
C
Correct answer
Explanation
Property-Map-Value calls a Rule-Obj-MapValue with a single row input. Property-Map-ValuePair calls the same Rule-Obj-MapValue but passes a single row AND a single column input, allowing lookups that depend on two dimensions. Option A is incorrect about the number of calls. Option B incorrectly mentions 'two row inputs'. Option D incorrectly mentions 'multiple row inputs'.
-
(a) Forward chaining
-
(b) Backward chaining
-
©front chaining
-
(d) none of these
B
Correct answer
Explanation
Property-Seek-Value is used to invoke backward chaining. In backward chaining, the system seeks a value only when needed (on-demand) rather than deriving it proactively. This is a lazy evaluation approach where the value is computed when first requested.
-
(a) Activity-End
-
(b) End-Activity
-
(c) Exit-Activity
-
(d) none of these
C
Correct answer
Explanation
The Exit-Activity method is specifically designed to terminate the current activity's processing and return control to the calling activity. This is the standard method name used in Pega/Process Commander for activity termination, unlike Activity-End or End-Activity which are not valid method names in the system.
-
Use the Java method
-
AtSetValue(PropertyName, Value)
-
Use the Property-Set method
-
{PropertyName INPUT}
C
Correct answer
Explanation
The Property-Set method is the standard, recommended approach in Pega PRPC for updating property values within an activity. This method is specifically designed for property manipulation and provides proper error handling and validation. Java methods should be avoided for simple property updates, and AtSetValue is not a standard Pega method.
-
Property-Map-Value calls a Rule-Obj-MapValue once, and Property-Map-ValuePair calls it twice
-
Property-Map-Value can call a Rule-Obj-MapValue and pass a single row input, and Property-Map-Value-Pair can call a Rule-Obj-Map Value and pass two row inputs
-
Property-Map-Value can call a Rule-Obj-MapValue and pass a single row input, and Property-Map-Value-Pair can call a Rule-Obj-Map Value and pass a single row input and single column input
-
Property-Map-Value can call a Rule-Obj-MapValue and pass a single row input, and Property-Map-Value-Pair can call a Rule-Obj-Map Value and pass multiple row inputs
C
Correct answer
Explanation
Property-Map-Value passes a single row input to a Rule-Obj-MapValue, while Property-Map-ValuePair passes both a row input and a column input. The 'Pair' in the name refers to the two-dimensional lookup (row + column), not multiple row inputs or calling the rule twice.
-
a. Precondition
-
b. Transition
-
c. Step Method
-
d. Parameter
-
e. Loop
A,B
Correct answer
Explanation
When conditions can be used in Preconditions (to control whether an activity executes) and Transitions (to control flow between steps). They are NOT used directly in step methods, parameters, or loop conditions - those use different expressions.
-
Because the validation settings are hard coded.
-
Susceptible to bypass using various forms of character encoding
-
Because it's difficult to implement a black list filter that also takes into account data sent using the POST method
-
Because it is typically implemented using regular expressions to match known good data patterns
B
Correct answer
Explanation
Blacklist validation is weak because it tries to block known bad inputs, which attackers can easily bypass using alternative encodings, alternate representations, or obfuscation that the filters do not cover. Distractors incorrectly blame hardcoding, HTTP POST complexity, or confuse blacklists with whitelist-oriented regular expressions.
-
String hashPassword(String password)
-
String hashPassword(String password, String accountName)
-
String hashpassword(String password)
-
None of the above
B
Correct answer
Explanation
The hashPassword method requiring both password and accountName parameters allows for account-specific salting, which improves security by preventing the same password from hashing identically across different accounts. The single-parameter versions would be less secure. Option C is incorrect due to incorrect method naming convention (lowercase 'p').
-
Boolean
-
String
-
Integer
-
void
D
Correct answer
Explanation
The verifyPasswordStrength() method is a void method, meaning it performs validation and likely throws an exception or sets internal state rather than returning a value. This is common for validation methods that enforce security policies by throwing exceptions when requirements aren't met.
-
String
-
boolean
-
Integer
-
void
B
Correct answer
Explanation
The isAuthorizedForData() method checks whether the current user is authorized to access or modify a specific data object. It returns a boolean value (true if authorized, false otherwise). It does not return text, numeric identifiers, or a void type, as authorization is a binary status check.
-
Integer
-
Byte
-
String
-
BigInteger
C
Correct answer
Explanation
CSRF tokens are typically generated as random strings that can be embedded in forms or HTTP headers. The getCSRFToken() method returns a String token value, not numeric types like Integer or BigInteger, which would be unsuitable for token representation.
-
java.lang.String sign(java.lang.String data, java.lang.String key) throws EncryptionException
-
java.lang.String sign(java.lang.String data, java.lang.String key)
-
java.lang.String sign(java.lang.String data)
-
java.lang.String sign(java.lang.String data) throws SecurityException
D
Correct answer
Explanation
The sign method in the security API accepts a single String parameter (data) and throws SecurityException. Options A and B incorrectly include a key parameter, while option C is missing the required exception declaration that security operations typically need.
-
java.lang.String seal(java.lang.String data,long timestamp) throws SecurityException
-
java.lang.String seal(java.lang.String data,long timestamp) throws EncryptionException
-
java.lang.String seal(java.lang.String data)
-
java.lang.String seal(java.lang.String data) throws EncryptionException
A
Correct answer
Explanation
The seal method requires both data and timestamp parameters and throws SecurityException. Options C and D are missing the required timestamp parameter that seal operations need, while option B throws the wrong exception type.