Computer Knowledge
Database and SQL
4,213 Questions
Master structured query language commands, database joins, table constraints, and alias generation. This section covers relational database management concepts and query outputs essential for technical aptitude. These technical questions feature prominently in banking IT officer exams and computer knowledge sections.
SQL queries and aliasesDatabase table constraintsDatabase joins and transformationsStored procedures and functions
Database and SQL Questions
-
The step does not execute.
-
The first numeric column is summed by default.
-
The GROUP BY clause is changed to an ORDER BY clause.
-
The step executes but does not group or sort data.
C
Correct answer
Explanation
In PROC SQL, if you use GROUP BY without any summary (aggregate) functions like SUM, COUNT, AVG, etc., SAS automatically converts the GROUP BY clause to an ORDER BY clause. The step still executes but performs sorting instead of grouping. The other options are incorrect.
-
Model
-
Formula
-
Declarative constraint
-
Declarative expression
D
Correct answer
Explanation
A Declarative Expression automatically computes and updates a property's value dynamically whenever any of its input properties change. Models initialize values, Constraints validate conditions, and Formulas are components rather than rule types.
-
Class Key value
-
Local List
-
Remote List
-
None of the above
B
Correct answer
Explanation
Local List is the preferred choice when restricting properties to a set of legal values where the set size is small-to-medium and changes frequently. Local Lists are easier to maintain and modify compared to Class Key values (which are more static) or Remote Lists (which require external table management). They provide good performance for dynamic value sets.
-
Decision Shape in a Flow
-
Activity
-
Collection Rule
-
Declare Expression
-
None
A,B,C,D
Correct answer
Explanation
Decision Tables are versatile evaluation rules that can be invoked across Pega. They are referenced in Flow Decision shapes, called in Activities, executed as collection steps, or used as calculations in Declare Expressions.
-
Declaring property as Exposed Property
-
By changing at DB
-
Property column visibility as Required
-
Not possible
C
Correct answer
Explanation
A property is made available for exposing by setting its column visibility to Required. This configuration makes the property visible and accessible for external systems or reporting. Declaring as an Exposed Property is not the correct mechanism, and direct database changes are not recommended. The column visibility setting is the proper way to control property exposure.
-
control structures such as if-then-else statements and loop.
-
object types and methods.
-
procedures and functions.
-
none of these.
A,B,C
Correct answer
Explanation
PL/SQL extends SQL with procedural programming features. It adds control structures (if-then-else, loops), modular programming with procedures and functions, and object-oriented features with object types and methods. Standard SQL is declarative and lacks these procedural capabilities.
-
consists of procedures and functions stored in database as standalone.
-
block that is associated with an event that occurs in database
-
constructed dynamically and executed once.
-
none if these
C
Correct answer
Explanation
An anonymous block in PL/SQL is a block of code that is not stored in the database with a name. It is constructed dynamically, compiled, and executed once during a session. Producures/functions are stored blocks, while triggers are associated with database events.
-
both are same
-
both are different
-
none of these
-
the subtypes VARCHAR and STRING are equivalent to VARCHAR2
D
Correct answer
Explanation
VARCHAR is the legacy SQL standard type, while VARCHAR2 is Oracle's proprietary variable-length string type. In Oracle, VARCHAR is deprecated and VARCHAR2 should be used. The subtypes VARCHAR and STRING are equivalent to VARCHAR2 for compatibility. VARCHAR has different NULL behavior than VARCHAR2.
-
Data is injected from application into query
-
The data is used to dynamically construct a SQL query
-
when sql query is executed injected application code from the database.
-
None of these
B
Correct answer
Explanation
SQL injection occurs when user-supplied data is used to dynamically construct SQL queries without proper validation or parameterization, allowing attackers to manipulate query structure. Option A describes the flow but not the vulnerability mechanism. Option C describes a different scenario. SQL injection is specifically about the DYNAMIC construction of queries from untrusted input.
-
Vulnerable to SQL Injection
-
Vulnerable to DoS
-
Both a & b
-
None of the above
-
SQL Injection is a type of security exploit in which the attacker is able to call built-in stored procedures
-
SQL Injection attack technique forces a web site to echo client-supplied data, which executes in a user's web browser
-
SQL Injection is a type of security exploit in which the attacker adds SQL statements in the user input
-
SQL Injection attacks allow a malicious individual to execute undesired SQL statements
B
Correct answer
Explanation
Forcing a website to echo client-supplied data that executes in a user's browser describes Cross-Site Scripting (XSS), not SQL Injection. The other options accurately describe characteristics and capabilities of SQL Injection, such as executing undesired statements or stored procedures.
-
Client side only
-
server side only
-
Both client and server side
-
In the SQL procedure
B
Correct answer
Explanation
Password complexity validation must be implemented server-side because client-side checks can be easily bypassed by disabling JavaScript, modifying HTTP requests, or using API tools. Server-side validation ensures the security rule is enforced regardless of how the client submits data.
-
executeUpdate()
-
execute()
-
executeQuery()
-
none of these
C
Correct answer
Explanation
executeQuery() method executes a simple query and returns a single ResultSet object.
-
executeQuery()
-
executeUpdate()
-
execute()
-
none of these
B
Correct answer
Explanation
executeUpdate() method executes an SQL INSERT, UPDATE or DELETE statement.