Loading...
Combined Bank

Post: Senior Officer (IT)
Exam Date: 31/01/2022, Exam Taker: BSC
1. What happened after executing the following SQL Statement:
CREATE TABLE t (Val INT);
INSERT INTO t(val) VALUES (1,2,2,3,
"null", "null",4,5);
SELECT COUNT (val)
FROM t;
SELECT COUNT DISTICT (val)
FROM t;

CREATE TABLE:
A table t is created with one column val of type INTEGER.

INSERT INTO:
The values 1, 2, 2, 3, NULL, NULL, 4, 5 are inserted into the column val.

SELECT COUNT(val):
This query counts all non-NULL values in the val column.

Total non-NULL values: 1, 2, 2, 3, 4, 5

Result: 6

SELECT COUNT(DISTINCT val):
This query counts only the unique non-NULL values in the val column.

Unique values: 1, 2, 3, 4, 5

Result: 5

2. ER diagram from the given infos.

Note: Question Collect করা সম্ভব হয়নি।

3. Using this IP 172.16.16.137/22 find the answer of the following question.

i. Subnet Mask
ii. Block Size.
iii. Network Address
iv. Broadcast Address
v. Total valid Host.

Subnet Mask:/22 corresponds to the subnet mask 255.255.252.0.

Block Size: 2^(32−22)=2^10=1024.

Network Address: 172.16.16.0/22.

Broadcast Address: 172.16.19.255/22.

Total Valid Hosts: 2^(32−22)−2=1024−2=1022

Explanation

Given IP Address: 172.16.16.137/22

Step 1: /22 বোঝা
/22 মানে Network bits = 22
Host bits = 32 − 22 = 10 bits

Step 2: Subnet Mask লেখা
/22 এর Binary Subnet Mask:
11111111.11111111.11111100.00000000
Decimal Subnet Mask = 255.255.252.0

Step 3: IP Address কে Binary তে রূপান্তর
172 = 10101100
16 = 00010000
16 = 00010000
137 = 10001001

IP (Binary):
10101100.00010000.00010000.10001001

Step 4: AND Operation (Network Address)
IP Address AND Subnet Mask করা হয়।
যেখানে Subnet Mask = 0 → Host bits 0 হয়ে যায়।

IP:     10101100.00010000.00010000.10001001
Mask:   11111111.11111111.11111100.00000000
------------------------------------------------
Result: 10101100.00010000.00010000.00000000

Binary Result কে Decimal এ রূপান্তর করলে:
Network Address = 172.16.16.0

Step 5: Broadcast Address বের করা
Broadcast address পেতে সব Host bits = 1 করা হয়।

Network (Binary):
10101100.00010000.00010000.00000000

Host bits (10 bits) = 1111111111

Broadcast (Binary):
10101100.00010000.00010011.11111111

Binary থেকে Decimal করলে:
Broadcast Address = 172.16.19.255

Step 6: Valid Host Range
First Host = Network + 1 → 172.16.16.1
Last Host = Broadcast − 1 → 172.16.19.254

Step 7: Total Valid Hosts
Host bits = 10
Total = 210 = 1024
Valid Hosts = 1024 − 2 = 1022

4. Explain the problems with possible solutions- Session hijacking and SQL injection.

1. Session Hijacking

Problem: Session hijacking is an attack where an attacker steals a valid user session ID to gain unauthorized access to a web application. This can occur through packet sniffing, XSS attacks, or insecure cookies.

Possible Solutions:

  • Use HTTPS to encrypt data transmission.
  • Implement secure and HttpOnly cookies.
  • Regenerate session IDs after login.
  • Set proper session timeout.

2. SQL Injection

Problem: SQL injection occurs when an attacker inserts malicious SQL queries through input fields, allowing unauthorized access to the database or manipulation of data.

Possible Solutions:

  • Use prepared statements and parameterized queries.
  • Validate and sanitize user inputs.
  • Apply least privilege principle for database users.
  • Use Web Application Firewalls (WAF).

1. Session Hijacking

Problem: Session hijacking হলো এমন একটি attack যেখানে attacker বৈধ user-এর session ID চুরি করে unauthorized access লাভ করে। এটি packet sniffing, XSS attack বা insecure cookie-এর মাধ্যমে ঘটতে পারে।

Possible Solutions:

  • HTTPS ব্যবহার করে data encrypt করা।
  • Secure এবং HttpOnly cookie ব্যবহার করা।
  • Login-এর পর session ID regenerate করা।
  • Proper session timeout সেট করা।

2. SQL Injection

Problem: SQL injection তখন ঘটে যখন attacker input field-এর মাধ্যমে malicious SQL query প্রবেশ করিয়ে database থেকে unauthorized data access বা manipulation করে।

Possible Solutions:

  • Prepared statement এবং parameterized query ব্যবহার করা।
  • User input validate ও sanitize করা।
  • Database user-এর জন্য least privilege প্রয়োগ করা।
  • Web Application Firewall (WAF) ব্যবহার করা।
5. Write a recursive function that returns a boolean after taking a string as parameter to check if its a palindrome or not.
#include<stdio.h> 
using namespace std;

// Recursive function to check if a string is a palindrome
bool isPalindrome(string str, int start, int end) {
    // Base case: If the start index is greater than or equal to the end index
    if (start >= end) {
        return true;
    }
    // Check if the first and last characters are the same
    if (str[start] != str[end]) {
        return false;
    }
    // Recursive case: Check the substring excluding the first and last characters
    return isPalindrome(str, start + 1, end - 1);
}

int main() {
    string input;
    cout << "Enter a string: "; cin >> input;

    if (isPalindrome(input, 0, input.length() - 1)) {
        cout << input << " is a palindrome." << endl;
    } else {
        cout << input << " is not a palindrome." << endl;
    }

    return 0;
}

Sample I/O:
Enter a string: noon
noon is a palindrome.
=== Code Execution Successful ===


🔗 Run Online: Check Palindrome

6. Solve the following function using K-map. F (w, x, y, z)= ∑(0,4,5,6,12,14,15)

You must subscribe & Login to view more.

Don’t have an account? Register

Or your subscription is under review by admin. Please message on WhatsApp / Telegram.

Leave a Comment

Latest Post
Field Based Job Question & Solution
Bank IT Job Solution

MCQ + Written from Bangladesh Bank, Sonali, Combined Bank IT recruitment.

BPSC IT Job Solution

BPSC Computer/IT cadre & non-cadre post Question papers with full solutions.

Gas Field IT Job Solution

Gas field like TGTDCL, BGDCL, JGTDSL, KGDCL, SGCL, RPGCL, GTCL etc. question solution

Power Sector IT Job Solution

Power sector such as NESCO, DESCO, DPDC, WZPDCL, BPDB, PGCB, BREB etc

Other IT Job Solution

Other Govt. Semi govt. organization like BCC, BTCL, CAAB, NSI etc.

NTRCA IT Job Solution (upcoming)

NTRCA ICT-related posts such as Assistant Teacher, Demonstrator, Lecturer.

IT MCQ Job Solution

Collected MCQ Job solution of BANK, BPSC, POWER SECTOR, GAS Field and Others.

Topic Based Q&S
WhatsApp Telegram Messenger