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

Multiple choice technology web technology
  1. Use the Java method

  2. AtSetValue(PropertyName, Value)

  3. Use the Property-Set method

  4. {PropertyName INPUT}

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology web technology
  1. Property-Map-Value calls a Rule-Obj-MapValue once, and Property-Map-ValuePair calls it twice

  2. 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

  3. 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

  4. 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

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology web technology
  1. (a) Property-Map-Value calls a Rule-Obj-MapValue once, and Property-Map-ValuePair calls it twice

  2. (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

  3. (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

  4. (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

Reveal answer Fill a bubble to check yourself
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'.

Multiple choice technology web technology
  1. (a) Forward chaining

  2. (b) Backward chaining

  3. ©front chaining

  4. (d) none of these

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology web technology
  1. (a) Activity-End

  2. (b) End-Activity

  3. (c) Exit-Activity

  4. (d) none of these

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology web technology
  1. Use the Java method

  2. AtSetValue(PropertyName, Value)

  3. Use the Property-Set method

  4. {PropertyName INPUT}

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology web technology
  1. Property-Map-Value calls a Rule-Obj-MapValue once, and Property-Map-ValuePair calls it twice

  2. 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

  3. 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

  4. 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

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology web technology
  1. a. Precondition

  2. b. Transition

  3. c. Step Method

  4. d. Parameter

  5. e. Loop

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology security
  1. Because the validation settings are hard coded.

  2. Susceptible to bypass using various forms of character encoding

  3. Because it's difficult to implement a black list filter that also takes into account data sent using the POST method

  4. Because it is typically implemented using regular expressions to match known good data patterns

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology security
  1. String hashPassword(String password)

  2. String hashPassword(String password, String accountName)

  3. String hashpassword(String password)

  4. None of the above

Reveal answer Fill a bubble to check yourself
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').

Multiple choice technology security
  1. Boolean

  2. String

  3. Integer

  4. void

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology security
  1. String

  2. boolean

  3. Integer

  4. void

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology security
  1. Integer

  2. Byte

  3. String

  4. BigInteger

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology security
  1. java.lang.String sign(java.lang.String data, java.lang.String key) throws EncryptionException

  2. java.lang.String sign(java.lang.String data, java.lang.String key)

  3. java.lang.String sign(java.lang.String data)

  4. java.lang.String sign(java.lang.String data) throws SecurityException

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology security
  1. java.lang.String seal(java.lang.String data,long timestamp) throws SecurityException

  2. java.lang.String seal(java.lang.String data,long timestamp) throws EncryptionException

  3. java.lang.String seal(java.lang.String data)

  4. java.lang.String seal(java.lang.String data) throws EncryptionException

Reveal answer Fill a bubble to check yourself
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.