Loading...
Bangladesh Rural Electrification Board

Post: Assistant Programmer
Exam Date: 21/12/2025 ; Exam Taker: BREB
1. X = 00110, Y = 11100 are represented in 5-bit signed 2’s complement system. Then their sum X + Y in 6-bit signed 2’s complemented representation is?

Given:
X = 00110 (5-bit 2’s complement)
Y = 11100 (5-bit 2’s complement)

Step 1: Convert to Decimal

  • X = 00110 → MSB = 0 → Positive number
    = 6 (in decimal)
  • Y = 11100 → MSB = 1 → Negative number
    Find 2’s complement to get magnitude:

1’s complement of 11100 → 00011
Add 1 → 00100 = 4

So, Y = −4

Step 2: Add the Numbers

X + Y = 6 + (−4) = 2

Step 3: Represent in 6-bit 2’s Complement

2 in binary (6-bit) = 000010
Final Answer:
X + Y = 000010 (6-bit signed 2’s complement)

2. Consider the following C Program.
#include <stdio.h>
int main () {
int m = 10;
int n, n1;
n = ++m;
n1 = m++;
n--;
--n1;
n -= n1;
printf("%d", n);
return 0;
}
The output of the program is ________?

Initially: m = 10
1) n = ++m;
m becomes 11, then n = 11
2) n1 = m++;
n1 = 11, then m becomes 12
3) n–;
n = 10
4) –n1;
n1 = 10
5) n -= n1;
n = 10 – 10 = 0
So the output is: 0

3. What is the value printed by the following program?
#include <stdio.h>
int f(int *a, int n){
if (n <= 0) return 0;
else if (*a % 2 == 0)
return *a + f(a+1, n-1);
else
return *a - f(a+1, n-1);
}
int main (){
int a[] = {12, 7, 13, 4, 11, 6};
printf("%d", f(a, 6));
return 0;
}
Function Logic
If the element is even → add it.
If the element is odd → subtract the recursive result from it.
Array: {12, 7, 13, 4, 11, 6}
Compute from last element (recursive evaluation):
f(6) = 6 (even) → 6 + 0 = 6
f(11,6) = 11 – 6 = 5
f(4,11,6) = 4 + 5 = 9
f(13,4,11,6) = 13 – 9 = 4
f(7,13,4,11,6) = 7 – 4 = 3
f(12,7,13,4,11,6) = 12 + 3 = 15
Final Output: 15
Function-এর কাজ
যদি সংখ্যা জোড় হয় → যোগ করবে।
যদি সংখ্যা বিজোড় হয় → পরের ফলাফল বিয়োগ করবে।
Array: {12, 7, 13, 4, 11, 6}
পেছন থেকে হিসাব করি:
6 (জোড়) → 6 + 0 = 6
11 (বিজোড়) → 11 – 6 = 5
4 (জোড়) → 4 + 5 = 9
13 (বিজোড়) → 13 – 9 = 4
7 (বিজোড়) → 7 – 4 = 3
12 (জোড়) → 12 + 3 = 15
চূড়ান্ত Output: 15
4. When the statement numbered 4,5,6,7 are replaced by
{for(S=1, P=-x, I=1, I<a; i++)
P = P*X*X-1;
S = S + P/f(I);
What will be the approximation of f(x)?

Approximation of f(x)

Because the new code starts with S = 1 and then keeps adding terms where the numerator is multiplied by X·X and the sign changes (multiplication by −1), it is generating the even-power alternating series.

So the function being approximated is the cosine series (Maclaurin series):

\(\displaystyle f(x) \approx \cos(x) = 1-\frac{x^2}{2!}+\frac{x^4}{4!}-\frac{x^6}{6!}+\cdots\)

General term:
\(\displaystyle \cos(x)\approx \sum_{k=0}^{m}(-1)^k\frac{x^{2k}}{(2k)!}\) (up to the number of terms used in the loop).

Exam line: The loop computes an alternating even-power factorial series, hence it approximates \(\cos(x)\).

f(x)-এর Approximation

নতুন code-এ শুরুতে S = 1 রাখা হয়েছে এবং প্রতি ধাপে numerator-কে X·X দিয়ে গুণ করা হচ্ছে ও −1 দিয়ে sign পরিবর্তন হচ্ছে। ফলে এটি even power এবং alternating sign series তৈরি করে।

অতএব এখানে যে function-টি approximate করা হচ্ছে সেটি হলো cosine এর Maclaurin series:

\(\displaystyle f(x) \approx \cos(x) = 1-\frac{x^2}{2!}+\frac{x^4}{4!}-\frac{x^6}{6!}+\cdots\)

General form:
\(\displaystyle \cos(x)\approx \sum_{k=0}^{m}(-1)^k\frac{x^{2k}}{(2k)!}\) (loop যত term নেয় তত পর্যন্ত)।

Exam point: Alternating even-power factorial series হওয়ায় এটি \(\cos(x)\) approximate করে।

5. Describe three basic techniques that exist to control deadlocks in databases.
Techniques to Control Deadlocks in Databases

Deadlock in databases occurs when two or more transactions wait indefinitely for each other to release locks. There are three basic techniques to control deadlocks:
1) Deadlock Prevention:
This technique ensures that deadlock never occurs by eliminating one of the necessary conditions of deadlock.

  • Request all required locks at once (no Hold and Wait).
  • Impose ordering of resources.
  • Use timestamp-based schemes (Wait-Die, Wound-Wait).

2) Deadlock Avoidance:
The system checks whether granting a lock will lead to a deadlock state.

  • Uses algorithms like Banker’s Algorithm.
  • Allocates resources only if the system remains in a safe state.

3) Deadlock Detection and Recovery:
Deadlocks are allowed to occur, but the system detects and resolves them.

  • Use Wait-For Graph to detect cycles.
  • Abort or roll back one or more transactions to break the deadlock.

ডাটাবেসে Deadlock নিয়ন্ত্রণের তিনটি পদ্ধতি

ডাটাবেসে Deadlock তখন ঘটে যখন দুই বা ততোধিক transaction একে অপরের lock-এর জন্য অপেক্ষা করে থাকে।
১) Deadlock Prevention:
Deadlock-এর একটি শর্ত দূর করে এটি প্রতিরোধ করা হয়।

  • সব lock একসাথে চাওয়া (Hold and Wait দূর করা)।
  • Resource-এর নির্দিষ্ট ক্রম নির্ধারণ।
  • Timestamp ভিত্তিক পদ্ধতি (Wait-Die, Wound-Wait)।

২) Deadlock Avoidance:
Lock দেওয়ার আগে পরীক্ষা করা হয় এতে unsafe অবস্থা তৈরি হবে কিনা।

  • Banker’s Algorithm ব্যবহার করা হয়।
  • System safe state-এ থাকলে তবেই resource বরাদ্দ করা হয়।

৩) Deadlock Detection and Recovery:
Deadlock হতে দেওয়া হয়, পরে শনাক্ত করে সমাধান করা হয়।

  • Wait-For Graph ব্যবহার করে cycle শনাক্ত করা।
  • এক বা একাধিক transaction abort/rollback করা।

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.

General Part
11. রচনা লিখুনঃ "সমাজে নৈতিকতার ভূমিকা"
12. এক কথায় প্রকাশ করো: (ক) যা অতিক্রম করা যায় না(খ) দমন করা কষ্টকর যাকে
13. কারক ও বিভক্তি নির্ণয় করুন: (ক) কাননে কুসুম কলি সকলি ফুটিল(খ) চিত্ত যেথা ভয়শূন্য উচ্চ সেথা শির(গ) গগনে গরজে মেঘ ঘন বর্ষা
14. বাগধারা লিখুন: (ক) একাদশে বৃহস্পতি(খ) অতি দর্পে হত লঙ্কা(গ) অগস্ত্য যাত্রা
15. Write a paragraph on "Tourism Development in Bangladesh".
16. Fill in the blanks:
(a) You cannot count ______ him to get the job done.
(b) We must adapt ourselves ______ all circumstances.
(c) No sooner had I seen the bird ______ it flew away.
(d) He speaks ______ he were a scientist.
(e) If I ______ you, I wouldn’t risk it.
17. Make sentences with meaning:
(a) Look up from
(b) In the face of
(c) Barking on
18. রহিমের মাসিক বেতন ১৬ শতাংশ বৃদ্ধি পেলে তিনি প্রতি মাসে ৮১২ টাকা অতিরিক্ত পেতে পারেন। যদি তার মাসিক বেতন ১০ শতাংশ বৃদ্ধি পেত, তিনি প্রতি মাসে কত টাকা উপার্জন করতেন?
19. (a+b)2=36 এবং (a−b)2=16 হলে ab এবং (a2+b2)-এর মান নির্ণয় কর।
20. "রোহিঙ্গাদের মায়ানমারে প্রত্যাবর্তন, বাংলাদেশের স্থিতিশীলতা ও নিরাপত্তার জন্য জরুরী" — এ বিষয়ে আপনার মতামত দিন।
21. (ক) হাওয়াই দ্বীপপুঞ্জ কোন রাষ্ট্রের অংশ?(খ) দুটি মহাদেশের অংশ এমন একটি দেশের নাম লিখুন।(গ) IRRI এর পূর্ণরূপ লিখুন।
22. (ক) হাওয়াই দ্বীপপুঞ্জ কোন রাষ্ট্রের অংশ? (খ) পরিবেশ রক্ষায় কোন ধরণের উৎস হতে বিদ্যুৎ উৎপাদনের মনোযোগ আবশ্যক বলে আপনি মনে করেন।

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