JGTDSL Assistant Engineer Exam 8 October 2021 — Question Solution | জালালাবাদ গ্যাস (জেজিটিডিএসএল) সহকারী প্রকৌশলী নিয়োগ পরীক্ষা ২০২১ — প্রশ্ন সমাধান
- JGTDSL
- Assistant Engineer
- 8 October 2021
- 12 questions · 0 MCQ, 12 written
Page updated
ARBS Academy · itjobs.arbsacademy.com
About this exam paper · প্রশ্নপত্র পরিচিতি
The JGTDSL Assistant Engineer exam was held on 8 October 2021. The paper had 12 written questions. The subjects asked most were Software Engineering (2), Algorithms (1) and Cloud & Emerging Tech (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
- JGTDSL
- Post
- Assistant Engineer
- Exam date
- 8 October 2021
- Questions
- 12 (0 MCQ, 12 written)
- Exam guide
- Government IT officer posts · সরকারি প্রতিষ্ঠানের আইটি পদ
- Software Engineering · সফটওয়্যার ইঞ্জিনিয়ারিং 2
- Algorithms · অ্যালগরিদম 1
- Cloud & Emerging Tech · ক্লাউড ও উদীয়মান প্রযুক্তি 1
- Cyber Security · সাইবার নিরাপত্তা 1
- Data Structures · ডেটা স্ট্রাকচার 1
- Database · ডেটাবেজ 1
- Digital Logic · ডিজিটাল লজিক 1
- Microprocessor · মাইক্রোপ্রসেসর 1
- Networking · নেটওয়ার্কিং 1
- Operating Systems · অপারেটিং সিস্টেম 1
- Programming · প্রোগ্রামিং 1
Why do we optimize an algorithm at compile time?
Model answer
Code optimization is the compiler phase (mainly between intermediate-code generation and target-code generation, with machine-dependent improvements on the target code) that transforms the program into an equivalent program that runs faster and/or needs less memory, without changing its output. It is done at compile time because the analysis is paid for once, while the benefit is enjoyed every time the program runs.
Why we optimize at compile time
- Faster execution: redundant work is removed, so the generated machine code executes fewer instructions.
- Less memory and smaller code: dead (never-used) and unreachable code and unused variables are deleted, so the executable is smaller.
- One-time cost, repeated benefit: a program is compiled once but may run millions of times; spending a little extra compile time saves CPU time on every run, and there is no optimization overhead at run time.
- Better use of the target machine: register allocation, instruction selection and instruction scheduling make the code fit the processor (machine-dependent optimization).
- Programmer productivity: programmers can write clear, readable code (named constants, simple loops); the optimizer removes the inefficiency automatically. Hand-optimizing every line is slow, error-prone and makes code hard to maintain.
- Global view: data-flow analysis lets the compiler see the whole function or program and find redundancies a human would miss.
Common techniques
| Technique | What it does |
|---|---|
| Constant folding | Evaluates constant expressions at compile time: 24 * 60 * 60 * days becomes 86400 * days |
| Common sub-expression elimination | An expression computed twice with the same operands is computed once and reused |
| Dead-code elimination | Removes statements whose result is never used |
| Loop-invariant code motion | Moves a computation whose value does not change inside the loop to before the loop |
| Strength reduction | Replaces a costly operation by a cheaper one, e.g. i * 4 by repeated + 4 |
Worked example
/* before optimization */
for (i = 0; i < n; i++) {
t = x * y; /* same value in every iteration */
a[i] = t + i * 4;
}
/* after loop-invariant code motion and strength reduction */
t = x * y; /* computed once */
k = 0;
for (i = 0; i < n; i++) {
a[i] = t + k; /* k always equals i * 4 */
k = k + 4;
}
For n = 1000 the first version performs 2 multiplications per iteration (2,000 in total); the second performs only 1 multiplication in total (x * y, once before the loop) and replaces the 1,000 multiplications i * 4 by 1,000 additions k + 4; both fill the array with exactly the same values.
Limits: an optimization must preserve the program's meaning and must be worth its compile-time cost. It improves the code that implements an algorithm, not the algorithm itself: a compiler will not turn an O(n²) bubble sort into an O(n log n) merge sort, so choosing an efficient algorithm remains the programmer's job.
Exam tip: "a little more time at compile time, faster and smaller code at every run, with the same output" is the key reason; support it with two or three named techniques.
How can a CFG represent a palindrome number?
Write LSTM gates name in AI.
Write a Linux command to revoke permission from no user but owner from a file "jdcl.txt".
Given a Hash function h(x) = x%11. Find the location of keys 22, 44, 73, 55, 18, 8, 31, 32. Use linear probing as collision resolution technique.
Simplify ĀBC̄ + ABC + ABC̄ using K-map.
Write two symmetric key algorithm name.
Given a topology of distance vector routing. Find the table of each node for the 1st route..
Use the following topology of 3 routers (link costs):
- X–Y: 1
- Y–Z: 2
- X–Z: 5
Sign up free to see the model answers to written questions 2–8 · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
Describe ACID properties of DBMS.
Model answer
ACID Properties of a DBMS
A transaction is a logical unit of work — a group of reads and writes that must be treated as one, such as a fund transfer. To keep data correct in spite of failures and many concurrent users, a transactional DBMS guarantees four properties, known together as ACID.
| Property | Meaning | How the DBMS enforces it | What goes wrong without it |
|---|---|---|---|
| Atomicity | All or nothing: either every operation of the transaction is committed, or none is; on failure the partial work is undone (rolled back) | Transaction/recovery manager using an undo (rollback) log | Money is debited from one account but never credited to the other |
| Consistency | A transaction takes the database from one valid state to another: every integrity constraint (PK, FK, CHECK) and business rule holds after it commits | Constraint checking by the DBMS plus correctly written transaction logic | Negative balance, or the total money in the bank changes |
| Isolation | Concurrent transactions do not see each other's uncommitted, intermediate results; at the SERIALIZABLE level the outcome equals some one-after-another (serial) order | Concurrency-control manager: locking (two-phase locking), MVCC, isolation levels | Dirty read, lost update, wrong totals |
| Durability | Once committed, the changes are permanent and survive a crash or power failure | Recovery manager: write-ahead log forced to non-volatile storage at COMMIT, redo after restart | A confirmed deposit disappears after a power cut |
Worked example — transfer ৳1,000 from account 101 (৳5,000) to account 102 (৳2,000):read(A); A = A − 1000; write(A); read(B); B = B + 1000; write(B); COMMIT
- A: if the system crashes after write(A) but before write(B), recovery undoes write(A), so A is ৳5,000 again.
- C: A + B = ৳7,000 before and after; no balance becomes negative.
- I: another transaction adding A + B while the transfer runs sees ৳7,000, never the intermediate ৳6,000.
- D: after COMMIT, A = ৳4,000 and B = ৳3,000 even if the server fails a second later.
In SQL (BEGIN works in MySQL, PostgreSQL and SQLite; the standard form is START TRANSACTION, SQL Server uses BEGIN TRANSACTION, and Oracle starts a transaction implicitly):
CREATE TABLE account (
acc_no INT PRIMARY KEY,
owner VARCHAR(20) NOT NULL,
balance INT NOT NULL CHECK (balance >= 0)
);
INSERT INTO account VALUES (101, 'Karim', 5000), (102, 'Nila', 2000);
BEGIN;
UPDATE account SET balance = balance - 1000 WHERE acc_no = 101;
UPDATE account SET balance = balance + 1000 WHERE acc_no = 102;
COMMIT;
SELECT acc_no, balance FROM account ORDER BY acc_no;
| acc_no | balance |
|---|---|
| 101 | 4000 |
| 102 | 3000 |
A transfer of ৳6,000 from 101 shows atomicity and consistency together:
BEGIN;
UPDATE account SET balance = balance + 6000 WHERE acc_no = 102; -- succeeds: 102 now 9000
UPDATE account SET balance = balance - 6000 WHERE acc_no = 101; -- rejected: CHECK (balance >= 0) fails
ROLLBACK;
SELECT acc_no, balance FROM account ORDER BY acc_no; -- 101 = 4000, 102 = 3000 again
In MySQL and SQLite (and in Oracle and SQL Server with default settings) the failed statement alone is undone, so 102 still shows 9000 inside the open transaction; the application must issue ROLLBACK to cancel the whole unit. PostgreSQL instead marks the whole transaction as failed and accepts only ROLLBACK. (MySQL enforces CHECK constraints from version 8.0.16.)
stateDiagram-v2
[*] --> Active
Active --> PartiallyCommitted : last statement executed
Active --> Failed : error or user abort
PartiallyCommitted --> Committed : commit record written to log
PartiallyCommitted --> Failed : failure before commit
Failed --> Aborted : rollback using undo log
Committed --> [*]
Aborted --> [*]
Default isolation levels: READ COMMITTED in PostgreSQL, Oracle and SQL Server; REPEATABLE READ in MySQL InnoDB. Many NoSQL stores relax ACID in favour of BASE (Basically Available, Soft state, Eventual consistency).
Exam tip: pair each letter with its mechanism — Atomicity ↔ undo/rollback, Consistency ↔ constraints, Isolation ↔ locking/MVCC, Durability ↔ write-ahead log.
What is reverse engineering and forward engineering?
Which signal could a sensor send to the microcontroller if the sensor finds any gas leakage point?
Find out program output of f(arr,2), f(arr,3), f(arr,5), f(arr,8). arr[] = [0,1,1,0,1,1,0,1], (like as ….)
int f (int *arr, int arrSize) {
int r=0;
for(int i=0; i<arrSize; ++i){
r=r^ *(arr+1);
}
return r;
}
Sign up free to see the model answers to written questions 10–12 · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
Explanations © ARBS Academy
Keep going with a free account · ফ্রি অ্যাকাউন্টে যা যা করতে পারবেন
10 more answers from this paper open with a free account.
এই প্রশ্নপত্রের আরও ১০টি উত্তর, ধাপে ধাপে ব্যাখ্যাসহ, ফ্রি অ্যাকাউন্টে খুলবে।
Free account · 1 day of Premium free
Paper analysis · প্রশ্নপত্র বিশ্লেষণ
Its questions come from 12 syllabus chapters; Language Basics & Syntax, Protocols (TCP/UDP/HTTP/DNS) and Boolean Algebra & K-Maps 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
- Protocols (TCP/UDP/HTTP/DNS) Networking · 90 other papers, 2012–20261
- Boolean Algebra & K-Maps Digital Logic · 50 other papers, 2016–20261
- Requirements & Design Software Engineering · 50 other papers, 2016–20261
- AI & Machine Learning Cloud & Emerging Tech · 49 other papers, 2017–20261
- Cryptography Cyber Security · 49 other papers, 2012–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 JGTDSL Assistant Engineer exam (2021)?
- 12 written questions.
- Which subjects were asked most in the JGTDSL Assistant Engineer exam (2021)?
- Software Engineering (2), Algorithms (1) and Cloud & Emerging Tech (1), out of 12 questions.
- When was the JGTDSL Assistant Engineer exam held?
- On 8 October 2021.
- Where can I find the JGTDSL Assistant Engineer exam (2021) question solution?
- On this page: 2 of the 12 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