BKSP Assistant Programmer Exam 13 July 2024 — Question Solution | বিকেএসপি সহকারী প্রোগ্রামার নিয়োগ পরীক্ষা ২০২৪ — প্রশ্ন সমাধান
- BKSP
- Assistant Programmer
- 13 July 2024
- 7 questions · 0 MCQ, 7 written
Page updated
ARBS Academy · itjobs.arbsacademy.com
About this exam paper · প্রশ্নপত্র পরিচিতি
The BKSP Assistant Programmer exam was held on 13 July 2024. The paper had 7 written questions. The subjects asked most were Algorithms (2), Web Technology (2) and Database (1). This page lists every question, with 2 answered and explained; the rest of the answers open with a free ARBS Academy account, where the paper can also be practised as a timed test.
বিকেএসপি সহকারী প্রোগ্রামার নিয়োগ পরীক্ষার (২০২৪) এই প্রশ্নপত্রে ৭টি প্রশ্ন ছিল, বেশিরভাগ অ্যালগরিদম ও ওয়েব টেকনোলজি থেকে। এখানে ২টি প্রশ্নের ব্যাখ্যাসহ উত্তর দেওয়া আছে; বাকিগুলো ফ্রি অ্যাকাউন্টে খোলে।
- Organisation
- BKSP
- Post
- Assistant Programmer
- Exam date
- 13 July 2024
- Questions
- 7 (0 MCQ, 7 written)
- Exam guide
- Government IT officer posts · সরকারি প্রতিষ্ঠানের আইটি পদ
What is deadlock? Draw its diagram.
Model answer
Deadlock is a state in which every process of a set is waiting for an event — usually the release of a resource — that only another waiting process of the same set can cause. Since every member is waiting, none of them ever proceeds; they stay blocked until the operating system intervenes.
Everyday picture: two cars enter a one-lane bridge from opposite ends; each occupies half the bridge and waits for the other to reverse, so neither moves.
Diagram — resource-allocation graph (RAG)
Circle = process, box = resource, request edge P → R, assignment edge R → P. Illustrative case: P1 has been given the printer R1 and asks for the disk drive R2; P2 has been given R2 and asks for R1.
graph LR
P1((P1)) -->|"requests"| R2["R2: disk drive"]
R2 -->|"assigned to"| P2((P2))
P2 -->|"requests"| R1["R1: printer"]
R1 -->|"assigned to"| P1
Reading the diagram: P1 holds R1 and waits for R2; P2 holds R2 and waits for R1. The edges form the closed cycle P1 → R2 → P2 → R1 → P1. Each resource has only one instance, so neither request can ever be granted: P1 and P2 are deadlocked.
Removing the resource nodes gives the equivalent wait-for graph:
graph LR
P1((P1)) -->|"waits for"| P2((P2))
P2 -->|"waits for"| P1
Four necessary (Coffman) conditions
| Condition | Meaning | In the diagram |
|---|---|---|
| Mutual exclusion | A resource is used by one process at a time | Printer and disk drive cannot be shared |
| Hold and wait | A process keeps what it holds while waiting for more | P1 keeps R1 while waiting for R2 |
| No preemption | A resource cannot be taken away by force | The OS cannot snatch R2 from P2 |
| Circular wait | A closed chain of waiting processes | P1 waits for P2, P2 waits for P1 |
All four must hold together. In a RAG, if every resource has a single instance, a cycle means deadlock; if resources have several instances, a cycle is necessary but not sufficient, because a process outside the cycle may release an instance.
Handling: prevention (make one condition impossible, e.g. request resources in a fixed global order), avoidance (Banker's algorithm keeps the system in a safe state), detection and recovery (abort or preempt a victim), or ignoring it (the "ostrich" approach of most desktop systems).
Deadlock vs starvation: deadlocked processes wait on each other forever; a starving process could run but is always passed over (for example, low priority) — aging cures starvation, not deadlock.
Exam tip: draw request edges from process to resource and assignment edges from resource to process, and show the closed cycle.
Write a program that take a number as input and output should be sum of digits of that number using python/C also draw its flow chart.
What is URL? Give an Example.
What is complexity of Algorithm? Categorize complexity of Algorithm.
Sign up free to see the model answers to written questions 2–4 · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
Why is the worst-case complexity of Quick sort O(n²)? Explain with example.
Model answer
Why Quick Sort's worst case is O(n²)
Short answer: Quick Sort is fast only when the pivot splits the array into two reasonably balanced parts. If every pivot turns out to be the minimum or maximum of its sub-array, each partition separates just the pivot itself, leaving parts of size 0 and n − 1. Then n − 1 levels of partitioning are needed instead of about log₂ n, and the partition work adds up to a quadratic total.
Derivation. Partitioning m elements compares the pivot with the other m − 1 elements. With a (0, n − 1) split every time:
T(n) = T(n − 1) + (n − 1), T(1) = 0
T(n) = 1 + 2 + … + (n − 1) = n(n − 1)/2 = Θ(n²)
With balanced splits instead, T(n) = 2T(n/2) + Θ(n) = Θ(n log n), which is the best and the average case.
When it happens: with a fixed first- or last-element pivot, on input that is already sorted or reverse-sorted; with Lomuto partitioning, also when all keys are equal.
Example
Reverse-sorted array [36, 30, 24, 18, 12, 6], last element as pivot (Lomuto partition):
| Step | Sub-array partitioned | Pivot | Result | Split (left, right) | Comparisons |
|---|---|---|---|---|---|
| 1 | [36, 30, 24, 18, 12, 6] | 6 (smallest) | [6, 30, 24, 18, 12, 36] | (0, 5) | 5 |
| 2 | [30, 24, 18, 12, 36] | 36 (largest) | unchanged | (4, 0) | 4 |
| 3 | [30, 24, 18, 12] | 12 (smallest) | [12, 24, 18, 30] | (0, 3) | 3 |
| 4 | [24, 18, 30] | 30 (largest) | unchanged | (2, 0) | 2 |
| 5 | [24, 18] | 18 (smallest) | [18, 24] | (0, 1) | 1 |
Sorted result: [6, 12, 18, 24, 30, 36]. Total = 5 + 4 + 3 + 2 + 1 = 15 = 6 × 5 / 2 comparisons; every split is one-sided, so the recursion depth is 5 = n − 1.
graph TD
A["6 keys: pivot 6, 5 comparisons"] --> A0["left: empty"]
A --> B["5 keys: pivot 36, 4 comparisons"]
B --> C["4 keys: pivot 12, 3 comparisons"]
B --> B0["right: empty"]
C --> D["3 keys: pivot 30, 2 comparisons"]
D --> E["2 keys: pivot 18, 1 comparison"]
Contrast: the same six keys in the order [24, 6, 36, 18, 12, 30] split more evenly (pivots 30, 12, 24) and need only 9 comparisons. For 1000 keys the gap is large: sorted or reverse-sorted input with this pivot rule costs 999 × 1000 / 2 = 499,500 comparisons, while a random order of the same keys needs only about 11,000 on average (expected count 2(n + 1)Hₙ − 4n ≈ 10,986, where Hₙ = 1 + 1/2 + … + 1/n).
How it is avoided: random pivot (expected Θ(n log n) for every input), median-of-three pivot (handles sorted and reverse-sorted input), three-way partitioning (many equal keys), or introsort, which switches to heap sort when the recursion becomes too deep and so guarantees O(n log n).
Exam tip: worst case ⇔ pivot is always an extreme element ⇒ split (0, n − 1) ⇒ T(n) = T(n − 1) + Θ(n) = Θ(n²).
Write SQL Query For create, insert of a table Emp (id, name, designation, Dept_name, Salary). Write SQL Query that show department wise salary of Employee.
Write the difference between REST API and SOAP API.
Sign up free to see the model answers to written questions 6–7 · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
Explanations © ARBS Academy
Keep going with a free account · ফ্রি অ্যাকাউন্টে যা যা করতে পারবেন
5 more answers from this paper open with a free account.
এই প্রশ্নপত্রের আরও ৫টি উত্তর, ধাপে ধাপে ব্যাখ্যাসহ, ফ্রি অ্যাকাউন্টে খুলবে।
Free account · 1 day of Premium free
Paper analysis · প্রশ্নপত্র বিশ্লেষণ
Its questions come from 7 syllabus chapters; Language Basics & Syntax, SQL & Queries and Sorting lead, with 1 each. Language Basics & Syntax is asked in 122 other papers too (2015–2026).
Its biggest topics · প্রধান টপিক
Questions in this paper, and how many of our other papers ask the topic
- Language Basics & Syntax Programming · 122 other papers, 2015–20261
- SQL & Queries Database · 93 other papers, 2015–20261
- Sorting Algorithms · 59 other papers, 2013–20261
- Complexity & Analysis Algorithms · 26 other papers, 2016–20251
- HTTP & Web Protocols Web Technology · 25 other papers, 2015–20261
- APIs & Architecture Web Technology · 18 other papers, 2016–20261
From our own past papers: each question filed under one syllabus chapter. Practice and held questions are not counted.
Questions about this paper · সাধারণ প্রশ্ন
- How many questions were in the BKSP Assistant Programmer exam (2024)?
- 7 written questions.
- Which subjects were asked most in the BKSP Assistant Programmer exam (2024)?
- Algorithms (2), Web Technology (2) and Database (1), out of 7 questions.
- When was the BKSP Assistant Programmer exam held?
- On 13 July 2024.
- Where can I find the BKSP Assistant Programmer exam (2024) question solution?
- On this page: 2 of the 7 questions are shown with worked answers. The rest of the answers open with a free ARBS Academy account, where the paper can also be practised as a timed test.
Question text is from the public recruitment exam; answers and explanations are written by ARBS Academy. All past papers