Computer Knowledge ยท General Awareness
Information Security
4,634 Questions
Information security involves protecting computer systems and data from unauthorized access, cyber threats, and damage. It is a core part of the computer knowledge section in various banking and government exams. Practicing these concepts helps in understanding digital signatures, network security, and access control effectively.
Cybersecurity threatsAccess controlCryptography basicsSecurity risk managementDatabase protection
Information Security Questions
-
isValidDirectory( java.lang.String context, java.lang.String input)
-
isValidDirectory( java.lang.String context, java.lang.String input) and isValidFileName(java.lang.String context, java.lang.String input)
-
isSafeDirectoryPath(java.lang.String context, java.lang.String input,boolean allowNull) and isSafeFileName(java.lang.String context, java.lang.String input,boolean allowNull)
-
ValidateDirectoryPath(java.lang.String context, java.lang.String input,boolean allowNull)
C
Correct answer
Explanation
To prevent path traversal attacks, TCS SAPI provides isSafeDirectoryPath() and isSafeFileName(). Both methods take a context, input string, and allowNull flag. The 'isSafe' prefix methods (option C) are the correct API methods for validating path safety.
-
String hashPassword(String password)
-
String hashPassword(String password, String accountName)
-
String hashpassword(String password)
-
None of the above
B
Correct answer
Explanation
The correct signature is String hashPassword(String password, String accountName). The accountName is used as the salt, so it's required. Option A is missing the salt parameter, and option C has incorrect case (hashpassword instead of hashPassword).
-
Boolean
-
String
-
Integer
-
void
D
Correct answer
Explanation
The verifyPasswordStrength() method returns void because it doesn't return a value - it's typically a validation method that throws exceptions or callbacks for weak passwords. Password strength verification usually provides feedback through side effects, not return values.
-
String
-
boolean
-
Integer
-
void
B
Correct answer
Explanation
Methods following the 'is' naming convention in Java typically return boolean values. The isAuthorizedForData() method checks authorization status, so boolean is the appropriate return type to indicate whether authorization is granted or denied.
-
Integer
-
Byte
-
String
-
BigInteger
C
Correct answer
Explanation
CSRF tokens are typically string-based identifiers passed in HTTP headers or form parameters. The getCSRFToken() method returns the token as a String for easy integration with web requests and security validation.
-
Creates a seal that binds a set of data and includes an expiration timestamp
-
Encodes the data
-
Hashes the data
-
Scrambles the data
A
Correct answer
Explanation
The seal method in ESAPI encrypts data and embeds an expiration timestamp. This creates a secure token ensuring that the package cannot be tampered with or read, and will be rejected as invalid once the expiration timestamp has passed.
-
Input Validation and OutPut Encoding
-
Authentication and Authorization
-
Data Protection and Cryptography
-
HTTP and Communication Security
A
Correct answer
Explanation
Cross-Site Scripting (XSS) occurs when untrusted input is executed in the browser. Input validation restricts malicious data from entering the application, and output encoding prevents the browser from interpreting user input as executable code, forming the best defense.
-
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 takes a single String parameter (the data to be signed) and throws SecurityException if signing fails or security constraints are violated. The method does not require an explicit key parameter as the key is managed internally by the security API.
-
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 accepts the data to be sealed and a timestamp parameter for time-based validation, returning a sealed String representation. It throws SecurityException when sealing operations fail due to security violations or invalid parameters.
-
String safeURIToDisplay= "/admin/findUser.do?name=" + TCSSAPI.encoder().encodeForJavaScript(request.getParameter( "dangerousInput"));
-
String safeURIToDisplay = TCSSAPI.encoder().encodeForURL( "/admin/findUser.do?name=" + request.getParameter( "dangerousInput" ) );
-
String safeURIToDisplay= "/admin/findUser.do?name=" + com.tcs.sapi.io.ValidationUtil.encodeForURL(request.getParameter( "dangerousInput"));
-
None of the above
C
Correct answer
Explanation
Only the user-supplied parameter needs encoding, not the entire URL structure. Option C correctly encodes just the dangerous input while preserving the URL's query parameter syntax. Option A uses JavaScript encoding which is inappropriate for URL contexts, and Option B incorrectly encodes the entire URL string including the '=' delimiter.
-
SecurityException
-
AccessException
-
AuthenitcationException
-
Exception
A
Correct answer
Explanation
When a user attempts to access a resource without proper authorization, the security API throws a SecurityException. This exception is specifically designed to indicate that the caller lacks the required permissions or rights to perform the requested operation. Generic exceptions like Exception are too broad, and AccessException is not a standard exception type in most security frameworks.
-
Validation Exception
-
SecurityException
-
Encoding Exception
-
Encryption Exception
B
Correct answer
Explanation
SecurityException is the most common exception thrown by validation methods in the security API. This exception occurs when validation checks fail, such as when input data doesn't meet security requirements or when access permissions are insufficient. Other exceptions like Encoding Exception or Encryption Exception are specific to different operations and not typically thrown during general validation.
-
SecurityException
-
EnterpriseException
-
EnterpriseSecurityException
-
None of the above
C
Correct answer
Explanation
EnterpriseSecurityException is the base class for all Security related exceptions in the security API. This class hierarchy allows for structured exception handling, where specific security exceptions can inherit from a common base. It provides a consistent way to catch and handle security-related errors throughout the application.
-
Its a form of encoding
-
Its a form of encryption
-
Its a form of decryption
-
Its simply the operation of reducing a possibly encoded string down to its simplest form
D
Correct answer
Explanation
Canonicalization is the operation of reducing a possibly encoded string down to its simplest form. It's used in security to normalize input data by decoding all encoding layers, allowing for consistent validation. This helps prevent attacks that use multiple encoding layers to bypass security checks, such as double encoding or mixed encoding schemes.
-
Encrypts the input and returns the encrypted string
-
Encodes the data
-
Hashes the data
-
Create a digital signature for the provided input data and return the signature in a string
D
Correct answer
Explanation
The sign() method creates a digital signature for the provided input data and returns the signature in a string. Digital signatures provide authentication, integrity, and non-repudiation by using cryptographic algorithms to sign data. Unlike encryption (which hides data) or encoding (which transforms representation), signing provides a verifiable signature that proves the data originated from a specific source.