Skip to content
Past paper

BKSP — Assistant Programmer — Exam: 13.07.2024প্রশ্ন ও সমাধান

Set by
BKSP
Post
Assistant Programmer
Exam date
13 Jul 2024
Questions
9 (0 MCQ, 9 written)
Exam guide
Government IT officer posts · সরকারি প্রতিষ্ঠানের আইটি পদ
  • Algorithms · অ্যালগরিদম 2
  • Web Technology · ওয়েব টেকনোলজি 2
  • Data Structures · ডেটা স্ট্রাকচার 1
  • Database · ডেটাবেজ 1
  • Networking · নেটওয়ার্কিং 1
  • Operating Systems · অপারেটিং সিস্টেম 1
  • Programming · প্রোগ্রামিং 1
Written question 1Operating Systems

What is deadlock? Draw its diagram.

Model answer

A deadlock is a state where two or more processes are each waiting indefinitely for a resource held by another process in the same waiting cycle, so none of them can ever proceed.

graph LR
    P1((Process P1)) -->|holds| R1[Resource R1]
    R1 -->|requested by| P2((Process P2))
    P2 -->|holds| R2[Resource R2]
    R2 -->|requested by| P1

This circular "holds/requests" chain (a Resource Allocation Graph with a cycle) is the classic signature of deadlock: P1 holds R1 and wants R2; P2 holds R2 and wants R1 — neither can proceed.

Deadlock occurs only when all four Coffman conditions hold simultaneously:

Condition Meaning
Mutual Exclusion At least one resource must be held in a non-shareable mode
Hold and Wait A process holds a resource while waiting for another
No Preemption A resource cannot be forcibly taken away from a process
Circular Wait A closed chain of processes, each waiting on the next
  • Handling strategies: Prevention (break one of the 4 conditions structurally), Avoidance (Banker's Algorithm — grant requests only if the system stays in a safe state), Detection & Recovery (allow deadlocks, detect via cycle-checking, then kill/preempt a process), or simple Ignorance (Ostrich algorithm, used by most general-purpose OSes since deadlocks are rare).

Exam takeaway: deadlock = circular wait for resources satisfying all 4 Coffman conditions; visualise it as a cycle in the Resource Allocation Graph, and remember the 4 conditions are individually necessary but only jointly sufficient.

Written question 2Programming

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.

Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন

Written question 3Data Structures

Given a post order data strings of a binaray search tree. Find pre-order and in- order of this this tree and draw the binary search tree.

Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন

Written question 4Web Technology

What is URL? Give an Example.

Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন

Written question 5Algorithms

What is complexity of Algorithm? Categorize complexity of Algorihm.

Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন

Written question 6Algorithms

Why Quick sort worst complexity in O(n²)? Explain with example.

Model answer

Quicksort's worst case (O(n²)) happens when pivot selection consistently produces maximally unbalanced partitions — the algorithm degenerates into something as slow as Bubble/Insertion sort.

Why it happens: Quicksort picks a pivot, splits the array into <pivot and >pivot, then recurses on both halves. If the pivot is always the smallest or largest remaining element (e.g. first-element pivot on already-sorted input), one partition has (n−1) elements and the other has 0 — there is no real "divide," so recursion depth becomes n instead of log n.

graph TD
    A["n=5: [1,2,3,4,5], pivot=1"] --> B["Right: [2,3,4,5] (4 elems)"]
    B --> C["pivot=2, Right: [3,4,5] (3 elems)"]
    C --> D["pivot=3, Right: [4,5] (2 elems)"]
    D --> E["pivot=4, Right: [5] (1 elem)"]

Worked example — array [1,2,3,4,5], pivot = first element each pass:

  • Pass 1: pivot=1 → right partition of 4 elements
  • Pass 2: pivot=2 → right partition of 3 elements
  • Pass 3: pivot=3 → right partition of 2 elements
  • Pass 4: pivot=4 → right partition of 1 element
  • Total comparisons = 4+3+2+1 = 10 = n(n−1)/2 = O(n²)

Recurrence: T(n) = T(n−1) + O(n) → T(n) = O(n²)

  • Avoiding it: randomised pivot selection, median-of-three pivot, or switching to Introsort/Heapsort when recursion depth exceeds a threshold — all keep the expected case at O(n log n).

Exam takeaway: Quicksort is O(n²) exactly when every partition is maximally unbalanced (n−1 vs 0) — most likely with a fixed (first/last-element) pivot on sorted or reverse-sorted input; randomised pivot avoids this.

Written question 7Database

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.

Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন

Written question 8Networking

Given a (slash) /26 based network address. Find Subnet mask, broadcast address, number of host, Number of valid host and number of subnet.

Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন

Written question 9Web Technology

Write difference between RESt APi and SOAP API.

Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন

Question text is from the public recruitment exam; answers and explanations are written by ARBS Academy. All past papers · Government IT officer posts guide