Loading...
Bangladesh Bank

Post: Assistant Director (ICT),
Exam Date: 07.02.2025, Exam Taker: DU(CSE)
1. Convert the array (56,33,48,29,99,12 and 344) into min heap.
Initial array as a binary tree:
          56
       /      \
     33        48
    /  \      /  \
  29   99   12  344

Swap 48 and 12:

          56
       /      \
     33        12
    /  \      /  \
  29   99   48  344

Swap 33 and 29:

          56
       /      \
     29        12
    /  \      /  \
  33   99   48  344

Swap 56 and 12:

          12
       /      \
     29        56
    /  \      /  \
  33   99   48  344

Swap 56 and 48:

          12
       /      \
     29        48
    /  \      /  \
  33   99   56  344
Final Result

The array now satisfies the min heap property: every parent node is smaller than or equal to its children.

          12
       /      \
     29        48
    /  \      /  \
  33   99   56  344

🎥 Video Solution:Design a 4-bit Circuit that takes the 2’s Complement using XOR Gates in Digital Logic Design [Credit: EE Vibes]

2. Write the pseudocode/ program (in any language) to print the common element between two arrays and the total number of such elements found. [assume each element in an array distinct].
#include <iostream>
using namespace std;
int main() {
    int size1, size2;
    // Taking input size of first array
    cout << "Enter size of first array: "; 
    cin >> size1;
    int arr1[size1];
    cout << "Enter elements of first array:\n";
    for (int i = 0; i < size1; i++) {
        cin >> arr1[i];
    }
    // Taking input size of second array
    cout << "Enter size of second array: ";
    cin >> size2;
    int arr2[size2];
    cout << "Enter elements of second array:\n";
    for (int i = 0; i < size2; i++) {
        cin >> arr2[i];
    }
    // To store common elements
    int commonElements[size1 < size2 ? size1 : size2];
    int count = 0;
    // Check each element in arr1 against arr2
    for (int i = 0; i < size1; i++) {
        bool found = false;
        for (int j = 0; j < size2; j++) {
            if (arr1[i] == arr2[j]) {
                found = true;
                break;
            }
        }
        if (found) {
            // Check for duplicates
            bool alreadyExists = false;
            for (int k = 0; k < count; k++) {
                if (commonElements[k] == arr1[i]) {
                    alreadyExists = true;
                    break;
                }
            }
            if (!alreadyExists) {
                commonElements[count] = arr1[i];
                count++;
            }
        }
    }
    // Print common elements
    cout << "Common elements: ";
    for (int i = 0; i < count; i++) {
        cout << commonElements[i] << " ";
    }
    cout << endl;
    // Print total count
    cout << "Total number of common elements: " << count << endl;
    return 0;
}
Sample I/O:
Enter size of first array: 5
Enter elements of first array: 0 20 30 40 50
Enter size of second array: 6
Enter elements of second array: 10 2 20 30 60 90
Common elements: 20 30 
Total number of common elements: 2

=== Code Execution Successful ===


🔗 Run Online: Print Common Elements Between Two Arrays

3.Given a logical function, find out the truth table of AB· (A+B).C

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