BPSC Previous Year Question for Assistant Programmer, Assistant Maintenance Engineer, Assistant Network Engineer by Stack IT job Solution
Book : Stack IT job Solution (A pattern Based IT job solution)
বুয়েট, কুয়েট, রুয়েট, ডুয়েট, পিএসসি, টেলিকম, আইবিএ, এমআইএস
সহ যেকোন প্যার্টানে জব প্রস্তুতির একমাত্র বই।
Order Link: https://stackvaly.com/product/stack-it-job-solution-p3qxo
WhatsApp: 01789741518
Bank Question Solution-ADBA Previous Year Question for AP, ANE, AME, ADA, AE
1. ADBA - RAKUB
Solved By Stack IT Job Solution
A pattern IT Job Solution
(BUET, DUET, RUET, KUET, IBA, DU, MIS, DPI, BB, BPSC
Written question:
[04/12/2020]
ব াংল াঃ ব াংল দেদের অর্থনীতিদি ক্ষ
ু দ্র আইটি উদেয ক্ত দের ভূ তিক -20
English: Importance of Mobile Banking during Pandemic -20
1. Explain ACID properties in details - 10
To maintain the integrity of the data, there are four properties described in the database
management system, which are known as the ACID properties. In the context of transaction
processing, the acronym ACID refers to the four key properties of a transaction: atomicity,
consistency, isolation, and durability.
Atomicity
All changes to data are performed as if they are a single operation. That is, all the changes
are performed, or none of them are.
For example, in an application that transfers funds from one account to another, the
atomicity property ensures that, if a debit is made successfully from one account, the
corresponding credit is made to the other account.
Consistency
Data is in a consistent state when a transaction starts and when it ends.
For example, in an application that transfers funds from one account to another, the
consistency property ensures that the total value of funds in both the accounts is the same
at the start and end of each transaction.
Isolation
The intermediate state of a transaction is invisible to other transactions. As a result,
transactions that run concurrently appear to be serialized.
For example, in an application that transfers funds from one account to another, the
isolation property ensures that another transaction sees the transferred funds in one account
or the other, but not in both, nor in neither.
Durability
After a transaction successfully completes, changes to data persist and are not undone, even
in the event of a system failure.
For example, in an application that transfers funds from one account to another, the
durability property ensures that the changes made to each account will not be reversed.
2. Index definition, usage of index, Index for PT. 10
Indexes are used to retrieve data from the database more quickly than otherwise. The users
cannot see the indexes, they are just used to speed up searches/queries.An index helps to speed
up SELECT queries and WHERE clauses, but it slows down data input, with the UPDATE and
the INSERT statements. Indexes can be created or dropped with no effect on the data.
For example, if you want to reference all pages in a book that discusses a certain topic, you first
refer to the index, which lists all the topics alphabetically and are then referred to one or more
specific page numbers.
Uses of Indexing:
S
t
a
c
k
I
T
j
o
b
S
o
l
u
t
i
o
n
F
o
r
O
r
d
e
r
V
i
s
i
t
:
s
t
a
c
k
v
a
l
y
.
c
o
m
o
r
0
1
8
1
2
6
0
3
4
0
6
Stack IT Job Solution
A pattern Based IT job Solution
Order: stackvaly.com
phone: 01812603406
Stack IT Job Solution
A pattern Based IT job Solution
Order: stackvaly.com
phone: 01812603406
2. 1. Indexing is used to find data in a file easily.
2. Creating an index automatically updates the index files even if a new record is input to
the database table.
3. To increase the Performance, an index of data is Created and Used.
4. Index files can be sorted differently without making any changes to the original database
file.
Index for PT
pt-index-usage reads queries from logs and analyzes how they use indexes.
Usage
pt-index-usage [option...]
Options
-h, --host=HOSTNAME
-p, --port=PORT
-U, --username=USERNAME
-d, --dbname=DBNAME
-o, --owner=STRING
-n, --schema=STRING
-t, --table=STRING
-i, --index=STRING
-u, --unused
--help
Risk:
• Read the tool's documentation
• Bugs Review the tool's known “BUGS”
• Test the tool on a non-production server
• Backup your production server and verify the backups
3. Define View, Materialized View, Difference btw them and Usage of two. -10
What is a View in Database?
A view is a logical virtual table that can be created by using the ‘select’ query. Views are
not stored on the hard disk. The query statement can be fired every time specific data is needed.
Therefore, it is possible to get the latest/ updated data at each time from the original table as
available in the database. Views allow for the storage of the definition of queries in the database
itself.
What is Materialized View in Database?
Materialized Views are basically logical views that are created using the ‘select’ query.
However, in their case, the results obtained are saved in a disk or table. As in a view, the query
definition is also stored in the database.
Key Differences Between View and Materialized View
S
t
a
c
k
I
T
j
o
b
S
o
l
u
t
i
o
n
F
o
r
O
r
d
e
r
V
i
s
i
t
:
s
t
a
c
k
v
a
l
y
.
c
o
m
o
r
0
1
8
1
2
6
0
3
4
0
6
Stack IT Job Solution
A pattern Based IT job Solution
Order: stackvaly.com
phone: 01812603406
Stack IT Job Solution
A pattern Based IT job Solution
Order: stackvaly.com
phone: 01812603406
3. 1. The basic difference between View and Materialized View is that Views are not
stored physically on the disk. On the other hands, Materialized Views are stored on
the disc.
2. View can be defined as a virtual table created as a result of the query expression.
However, Materialized View is a physical copy, picture or snapshot of the base table.
3. A view is always updated as the query creating View executes each time the View is
used. On the other hands, Materialized View is updated manually or by
applying triggers to it.
4. Materialized View responds faster than View as the Materialized View is
precomputed.
5. Materialized View utilizes the memory space as it stored on the disk whereas, the
View is just a display hence it do not require memory spac
When to Use Materialized View and View in SQL
Use of Views:
1. It may be utilized for isolating applications and prohibiting changes in the definition of
database tables.
2. It may be used for simplifying SQL statements for better and faster use.
3. Views are also used for enhancing security via restricted access to predetermined sets
of rows and columns.
Use of Materialized Views:
1. The presence of materialized views are transparent to SQL except in case they are looked
up for query rewrites. Query rewrites bring about improvements in the performance of
SQL query execution; they are best used in data warehouse environments.
2. It is possible to insert, delete, update and add data with the help of updatable materialized
views.
4. Differ: Primary vs Unique Key, Shared vs Exclusive Lock, Drop vs Drop Purge, Delete
vs Truncate, -10
Differences between primary key and unique key:
Primary Key Unique Key
There can be one primary key in a table There can be multiple unique keys in the table
It does not allow null columns. It allows null columns.
Default Index is clustered Default Index is no-clustered
The purpose of the primary key is to enforce
entity integrity.
The purpose of unique key is to enforce
unique data.
S
t
a
c
k
I
T
j
o
b
S
o
l
u
t
i
o
n
F
o
r
O
r
d
e
r
V
i
s
i
t
:
s
t
a
c
k
v
a
l
y
.
c
o
m
o
r
0
1
8
1
2
6
0
3
4
0
6
Stack IT Job Solution
A pattern Based IT job Solution
Order: stackvaly.com
phone: 01812603406
Stack IT Job Solution
A pattern Based IT job Solution
Order: stackvaly.com
phone: 01812603406
4. Primary key can be created using syntax:
CREATE TABLE Employee
(
ID int PRIMARY KEY,
Name varchar(255),
City varchar(150)
)
Unique key can be created using syntax:
CREATE TABLE Employee
(
ID int UNIQUE.
Name varchar(255) NOT NULL. City varchar(
150)
)
It is SQL constraint which allows you to
uniquely identify each record or row in the
database table.
It is SQL constraint that doesnot allow the
same value tobe assigned to two
isolatedRecords in a database table.
In the primary key, duplicate keys are not
allowed.
In a unique key, if one or more key parts are
null, then duplicate keys are allowed.
Difference between Shared Lock and Exclusive Lock :
S.No. Shared Lock Exclusive Lock
1. Lock mode is read only operation. Lock mode is read as well as write
operation.
2. Shared lock can be placed on objects that do
not have an exclusive lock already placed on
them.
Exclusive lock can only be placed on
objects that do no have any other kind of
lock.
3. Prevents others from updating the data. Prevents others from reading or updating
the data.
4. Issued when transaction wants to read item
that do not have an exclusive lock.
Issued when transaction wants to update
unlocked item.
5. Any number of transaction can hold shared
lock on an item.
Exclusive lock can be hold by only one
transaction.
6. S-lock is requested using lock-S instruction. X-lock is requested using lock-X
instruction.
Difference Between Drop And Drop Purge
Normally, a table is moved into the recycle bin (as of Oracle 10g), if it is dropped.
However, if the purge modifier is specified as well, the table is unrecoverable (entirely) dropped
from the database.
Difference between DELETE and TRUNCATE command:-
S.NO Delete Truncate
1. The DELETE command is used to delete
specified rows(one or more).
While this command is used to delete all
the rows from a table.
2. It is a DML(Data Manipulation Language)
command.
While it is a DDL(Data Definition
Language) command.
3. There may be WHERE clause in DELETE
command in order to filter the records.
While there may not be WHERE clause
in TRUNCATE command.
S
t
a
c
k
I
T
j
o
b
S
o
l
u
t
i
o
n
F
o
r
O
r
d
e
r
V
i
s
i
t
:
s
t
a
c
k
v
a
l
y
.
c
o
m
o
r
0
1
8
1
2
6
0
3
4
0
6
Stack IT Job Solution
A pattern Based IT job Solution
Order: stackvaly.com
phone: 01812603406
Stack IT Job Solution
A pattern Based IT job Solution
Order: stackvaly.com
phone: 01812603406
5. 4. In the DELETE command, a tuple is locked
before removing it.
While in this command, data page is
locked before removing the table data.
5. We can rollback the data even after using
DELETE command.
While in this command, we can’t
rollback.
6. DELETE command is slower than
TRUNCATE command.
While TRUNCATE command is faster
than DELETE command.
5. Query for retrieving UNCOMMON Name from Name column of two given tables -5
Query:
SELECT * FROM TableA
FULL OUTER JOIN TableB
ON TableA.name = TableB.name
WHERE TableA.id IS null
OR TableB.id IS null
6. Query to find out even number from given table - 5
Select * from table where id % 2 = 0
7. PHOTO/PDF/DOCX Data Type, how to find duplicate data, DDL, DML - 10
PHOTO/PDF/DOCX :
VARBINARY(MAX) data type is used to store images/pdf/word etc files and any data.
How to find duplicate data
The first query we’re going to write is a simple query to verify whether duplicates do
indeed exist in the table. For our example, my query looks like this:
SELECT username, email, COUNT(*)
FROM users
GROUP BY username, email
HAVING COUNT(*) > 1
HAVING is important here because unlike WHERE, HAVING filters on aggregate functions.If
any rows are returned, that means we have duplicates. In this example, our results look like this:
S
t
a
c
k
I
T
j
o
b
S
o
l
u
t
i
o
n
F
o
r
O
r
d
e
r
V
i
s
i
t
:
s
t
a
c
k
v
a
l
y
.
c
o
m
o
r
0
1
8
1
2
6
0
3
4
0
6
Stack IT Job Solution
A pattern Based IT job Solution
Order: stackvaly.com
phone: 01812603406
Stack IT Job Solution
A pattern Based IT job Solution
Order: stackvaly.com
phone: 01812603406
6. USERNAME EMAIL COUNT
Pete pete@example.com 2
Jessica jessica@example.com 2
Miles miles@example.com 2
1. DDL(Data Definition Language) : DDL or Data Definition Language actually
consists of the SQL commands that can be used to define the database schema. It
simply deals with descriptions of the database schema and is used to create and
modify the structure of database objects in the database.
Examples of DDL commands:
• CREATE – is used to create the database or its objects (like table, index,
function, views, store procedure and triggers).
• DROP – is used to delete objects from the database.
• ALTER-is used to alter the structure of the database.
• TRUNCATE–is used to remove all records from a table, including all
spaces allocated for the records are removed.
• COMMENT –is used to add comments to the data dictionary.
• RENAME –is used to rename an object existing in the database.
2. DML(Data Manipulation Language) : The SQL commands that deals with the
manipulation of data present in the database belong to DML or Data Manipulation
Language and this includes most of the SQL statements.
Examples of DML:
• INSERT – is used to insert data into a table.
• UPDATE – is used to update existing data within a table.
• DELETE – is used to delete records from a database table.
8. Constraint Definition, Why use constraint, Differ table and column level Constraint - 10
SQL constraints are used to specify rules for the data in a table.Constraints are used to limit the
type of data that can go into a table. This ensures the accuracy and reliability of the data in the
table. If there is any violation between the constraint and the data action, the action is aborted.
Constraints can be column level or table level. Column level constraints apply to a column, and
table level constraints apply to the whole table.
Differ table and column level Constraint
Table level Constraint
1. Constraints are defined separately after the columns are defined.
2. While defining constraints at this level constraint name must be provided
3. Not null constraints can't be defined at this level.
4. Composite keys can be defined at this level only.
S
t
a
c
k
I
T
j
o
b
S
o
l
u
t
i
o
n
F
o
r
O
r
d
e
r
V
i
s
i
t
:
s
t
a
c
k
v
a
l
y
.
c
o
m
o
r
0
1
8
1
2
6
0
3
4
0
6
Stack IT Job Solution
A pattern Based IT job Solution
Order: stackvaly.com
phone: 01812603406
Stack IT Job Solution
A pattern Based IT job Solution
Order: stackvaly.com
phone: 01812603406
7. A table level constraint can see every column in the table.
Column level Constraint
1. Constraints are defined along with the columns.
2. So constraint name is not required.
3. Not null constraints can be defined at this level only(NOT NULL constraint can only apply to
one column).
4. Composite keys can't be defined at this level .
5. Column level constraint is more clear syntactically and more meaningful.
A column level constraint has scope only to the column it is defined on.The major difference
between the two constraint is the scope. So far as the use of constraints (validating proper data) is
concerned they are pretty much the same.Any column level constraint (exception: not null) can
be expressed at the table level - but the opposite is not true. Go for a column level constraint if
the constraint is in fact a column constraint else use a table constraint.
9. What are the ways for no data loss, describe. -10
What is Data Loss?
Data loss is when information systems are corrupted, deleted, or unrecoverable.It most
commonly occurs due to neglect in storage, transmission, or processing.Data loss is distinct from
data unavailability – which is primarily caused by power outages – and from a data breach –
which refers to your data being stolen.
The ways for no data loss
1. Always back up your data
2. Diversify your backups
3. Encrypt sensitive data
4. Address data security
5. Use anti-virus and email security
6. Trust the professionals
7. Firewall and Antivirus
8. Protect Data from Power Surges
9. Develop a Disaster Recovery Plan
10. Keep Your Computer Dust-Free and Dry
11. Specify Access Levels
12. Work With IT Security Experts
10. What are the roles of Database Engineer -10
1. Maintaining and enhancing the performance of existing database programs.
S
t
a
c
k
I
T
j
o
b
S
o
l
u
t
i
o
n
F
o
r
O
r
d
e
r
V
i
s
i
t
:
s
t
a
c
k
v
a
l
y
.
c
o
m
o
r
0
1
8
1
2
6
0
3
4
0
6
Stack IT Job Solution
A pattern Based IT job Solution
Order: stackvaly.com
phone: 01812603406
Stack IT Job Solution
A pattern Based IT job Solution
Order: stackvaly.com
phone: 01812603406
8. 2. Assisting database development teams in designing new database programs that meet the
organization's data storage needs.
3. Monitoring databases and related systems to ensure optimized performance.
4. Writing new support programs and scripts to increase data storage capacity.
5. Reviewing database and user reports, as well as system information.
6. Performing debugging procedures on database scripts and programs, as well as resolving
conflicts.
7. Mentoring database administrators and providing them with technical support.
8. Adhering to best practices in securely storing, backing up, and archiving data.
9. Documenting processes related to database design, configuration, and performance.
10. Keeping abreast of developments and best practices in database engineering.
11. How to copy from Parent table to Child Table with 1 column dividing into 3 different
column. -5
WITH cte AS (
SELECT Name, ROW_NUMBER() OVER (ORDER BY Name) - 1 rn
FROM yourTable
)
SELECT
MAX(CASE WHEN FLOOR(rn / 2) = 0 THEN Name END) AS Name1,
MAX(CASE WHEN FLOOR(rn / 2) = 1 THEN Name END) AS Name1,
MAX(CASE WHEN FLOOR(rn / 2) = 2 THEN Name END) AS Name3
FROM cte
GROUP BY
rn % 2
ORDER BY
rn % 2;
12. 5 Queries from HR schema: -50
1. Display details of jobs that were done by any employee who is currently drawing more
than 15000 of salary.
SELECT JH.*
FROM JOB_HISTORY JH JOIN EMPLOYEES E ON (JH.EMPLOYEE_ID =
E.EMPLOYEE_ID)
WHERE SALARY > 15000
2. Display department name, manager name, and salary of the manager for all managers
whose experience is more than 5 years.
S
t
a
c
k
I
T
j
o
b
S
o
l
u
t
i
o
n
F
o
r
O
r
d
e
r
V
i
s
i
t
:
s
t
a
c
k
v
a
l
y
.
c
o
m
o
r
0
1
8
1
2
6
0
3
4
0
6
Stack IT Job Solution
A pattern Based IT job Solution
Order: stackvaly.com
phone: 01812603406
Stack IT Job Solution
A pattern Based IT job Solution
Order: stackvaly.com
phone: 01812603406
9. SELECT DEPARTMENT_NAME, FIRST_NAME, SALARY
FROM DEPARTMENTS D JOIN EMPLOYEES E ON
(D.MANAGER_ID=E.MANAGER_ID)
WHERE (SYSDATE-HIRE_DATE) / 365 > 5
3. Display employee name if the employee joined before his manager.
SELECT FIRST_NAME FROM EMPLOYEES E1 JOIN EMPLOYEES E2 ON
(E1.MANAGER_ID=E2.EMPLOYEE_ID)
WHERE E1.HIRE_DATE < E2.HIRE_DATE
4. Display employee name, job title for the jobs employee did in the past where the job was
done less than six months.
SELECT FIRST_NAME, JOB_TITLE FROM EMPLOYEES E JOIN JOB_HISTORY
JH ON (JH.EMPLOYEE_ID = E.EMPLOYEE_ID) JOIN JOBS J ON( JH.JOB_ID =
J.JOB_ID)
WHERE MONTHS_BETWEEN(END_DATE,START_DATE) < 6
5. Display employee name and country in which he is working.
SELECT FIRST_NAME, COUNTRY_NAME FROM EMPLOYEES JOIN
DEPARTMENTS USING(DEPARTMENT_ID)
JOIN LOCATIONS USING( LOCATION_ID)
JOIN COUNTRIES USING ( COUNTRY_ID)
6. Display department name, average salary and number of employees with commission
within the department.
SELECT DEPARTMENT_NAME, AVG(SALARY), COUNT(COMMISSION_PCT)
FROM DEPARTMENTS JOIN EMPLOYEES USING (DEPARTMENT_ID)
GROUP BY DEPARTMENT_NAME
S
t
a
c
k
I
T
j
o
b
S
o
l
u
t
i
o
n
F
o
r
O
r
d
e
r
V
i
s
i
t
:
s
t
a
c
k
v
a
l
y
.
c
o
m
o
r
0
1
8
1
2
6
0
3
4
0
6
Stack IT Job Solution
A pattern Based IT job Solution
Order: stackvaly.com
phone: 01812603406
Stack IT Job Solution
A pattern Based IT job Solution
Order: stackvaly.com
phone: 01812603406