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
Path Traversal attacks attempt to access files outside the intended directory using sequences like '../'. isSafeDirectoryPath and isSafeFileName validate that paths don't escape allowed directories and filenames don't contain dangerous sequences, preventing unauthorized file system access.
-
String hashPassword(String password)
-
String hashPassword(String password, String accountName)
-
String hashpassword(String password)
-
None of the above
B
Correct answer
Explanation
Secure password hashing requires both the password and a unique salt per user. The hashPassword method takes both password and accountName parameters, where accountName serves as the salt, ensuring that even identical passwords produce different hashes for different accounts.
-
Boolean
-
String
-
Integer
-
void
D
Correct answer
Explanation
The verifyPasswordStrength() method performs validation checks on password strength requirements (length, complexity, etc.). Being a void method means it doesn't return a value - it either completes successfully if the password is strong enough, or throws an exception if it fails validation checks.
-
String
-
boolean
-
Integer
-
void
B
Correct answer
Explanation
Authorization checks determine whether a user has permission to access specific data. The isAuthorizedForData() method returns a boolean - true if the user has permission, false otherwise. This simple yes/no result is sufficient for authorization decisions in access control systems.
-
Integer
-
Byte
-
String
-
BigInteger
C
Correct answer
Explanation
CSRF tokens are random, unique strings generated by the server and embedded in forms or AJAX requests. The getCSRFToken() method returns this token as a String, allowing it to be included in requests and validated server-side to ensure requests originate from the legitimate application, not a malicious site.
-
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 the security API encrypts a given data set and attaches an expiration timestamp, signing the package to verify integrity. This prevents unauthorized tampering or replay attacks. Simply encoding, hashing, or scrambling the data does not offer this timestamped, integrity-protected envelope functionality.
-
Input Validation and OutPut Encoding
-
Authentication and Authorization
-
Data Protection and Cryptography
-
HTTP and Communication Security
A
Correct answer
Explanation
Combining input validation and output encoding forms the best defense against Cross-Site Scripting (XSS). Input validation rejects malformed data, while context-aware output encoding ensures that any allowed user input is treated as text rather than executable script when rendered in the browser. Other options address authentication or cryptography.
-
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 throws SecurityException to handle cryptographic failures gracefully. Option B lacks exception handling, A throws the wrong exception type, and C is missing the key parameter. Security operations must declare appropriate exceptions for failure scenarios.
-
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 signature includes a timestamp parameter and throws SecurityException for error handling. Option B uses the wrong exception type (EncryptionException), while options C and D are missing the timestamp parameter which is typically required for temporal validation in sealing operations.
-
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
The correct approach encodes only the dangerous user input parameter using encodeForURL, not the entire URL. Option A uses JavaScript encoding which is wrong for URL parameters. Option B encodes the entire URL which would break the URL structure. Only the user input needs encoding.
-
SecurityException
-
AccessException
-
AuthenitcationException
-
Exception
A
Correct answer
Explanation
SecurityException is the standard exception thrown by security APIs when authorization fails. Unlike AccessException or generic Exception, SecurityException specifically indicates security-related authorization issues. AuthenticationException (misspelled in option C) would apply to authentication failures, not authorization.
-
Validation Exception
-
SecurityException
-
Encoding Exception
-
Encryption Exception
B
Correct answer
Explanation
SecurityException is the common exception thrown by validation methods in security APIs. It serves as the base class for security-related failures, including validation errors. While the option lists specific validation exceptions, SecurityException is the standard runtime exception for such cases.
-
SecurityException
-
EnterpriseException
-
EnterpriseSecurityException
-
None of the above
C
Correct answer
Explanation
EnterpriseSecurityException is the base class for all security-related exceptions in this API. While SecurityException might seem logical, this specific API hierarchy uses EnterpriseSecurityException as the root. EnterpriseException is likely a broader base for all enterprise exceptions.
-
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 reduces an encoded string to its simplest, equivalent form. For example, %41 (URL encoding) canonicalizes to 'A'. This is crucial for security because attackers can use multiple encodings to bypass filters - canonicalization reveals the true input.
-
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 input data and returns it as a string. Digital signatures provide authentication and integrity verification - they prove the data originated from a specific source and wasn't tampered with. This is different from encryption (confidentiality) or hashing (one-way).