BUET M.Sc Admission Exam 2018 — Question Solution | বুয়েট এমএসসি ভর্তি নিয়োগ পরীক্ষা ২০১৮ — প্রশ্ন সমাধান
- BUET M.Sc. Admission
- 2018
- 15 questions · 0 MCQ, 15 written
Page updated
ARBS Academy · itjobs.arbsacademy.com
About this exam paper · প্রশ্নপত্র পরিচিতি
The BUET M.Sc Admission exam was held in 2018, set by BUET M.Sc. Admission. The paper had 15 written questions. The subjects asked most were Algorithms (5), Programming (3) and Operating Systems (2). 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
- BUET M.Sc. Admission
- Exam date
- 2018
- Questions
- 15 (0 MCQ, 15 written)
- Exam guide
- M.Sc. admission (CSE and ICT) · এমএসসি ভর্তি (সিএসই ও আইসিটি)
Draw the maximum heap structure from a given array [4,10,3,5,1]
Write the time complexity of binary searches.
Sign up free to see the model answers to written questions 1–2 · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
Why left recursion has to be eliminated to build a parser?
Model answer
Left recursion: a grammar is left recursive if some non-terminal A can derive a string that starts with A itself, A ⇒⁺ Aα. It is immediate when a rule has the form A → Aα, and indirect when it happens through other non-terminals (A → Bβ, B → Aγ).
Why it must be eliminated: top-down parsers (recursive-descent and predictive LL(1) parsers) cannot handle it.
- Infinite recursion: in recursive descent, each non-terminal is a procedure. For A → Aα the procedure A() first calls A() again without reading any input token, so the input position never changes and the calls never end (stack overflow).
- No unique choice for LL(1): for A → Aα | β (β not deriving ε), every string derived from Aα also starts with something derived from β, so FIRST(Aα) ⊇ FIRST(β). Both rules fall into the same parse-table cell, so the grammar is not LL(1); the parser cannot decide which rule to use by looking at one token.
Bottom-up (LR) parsers handle left recursion without trouble, so the elimination is needed only for top-down parsing.
Example: a comma-separated list, L → L , n | n (strings n, n,n, n,n,n, …)
procedure L():
L() // calls itself before matching anything: never returns
match(',')
match('n')
Elimination rule: replace A → Aα | β (β not starting with A) by
A → β A'
A' → α A' | ε
For the list grammar (α = , n, β = n):
L → n L'
L' → , n L' | ε
Now every call of L' first checks for ',' and either consumes , n or chooses ε, so input is consumed before any recursive call. For the input n , n , n the new parser consumes all 5 tokens, while the left-recursive version recurses until the stack overflows. Both grammars generate exactly the same strings.
General form: A → Aα₁ | … | Aαₘ | β₁ | … | βₙ becomes A → β₁A' | … | βₙA', A' → α₁A' | … | αₘA' | ε.
Indirect left recursion (substitute first, then apply the rule):
S → T a | b
T → S c | d (S ⇒ T a ⇒ S c a)
Substitute T into S: S → S c a | d a | b, then remove the immediate left recursion:
S → d a S' | b S'
S' → c a S' | ε
Side effect: the transformed parse tree leans to the right, so for left-associative operators (such as a − b − c) the semantic actions must rebuild the left-to-right grouping.
Exam tip: "A → Aα calls A again before reading any token, so a top-down parser loops forever (and the grammar cannot be LL(1)); fix it with A → βA', A' → αA' | ε."
Draw a DFA for words ending with two a's only, that is 'aa', over the alphabet {a,b}.
What will be the output of this following program?
#include<stdio.h>
#include<string.h>
int main(int argc, const char *argv[]){
int result;
char example1[150];
char example2[50];
strcpy(example1, "C Programming at TechOnTheNet.com");
strcpy(example2, "C Programming is fun");
result = strcmp(example1, example2);
printf("%d", result);
return 0;
}
Find length of each string in string list without using for loop in java.
String[]text ={"hello", "world", "API"};
Sign up free to see the model answers to written questions 4–6 · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
Why branching poses a problem for pipelining? How can you tackle this pipelining hazard?
Model answer
Why branches are a problem: a pipeline fetches a new instruction every cycle, but the address of the instruction after a branch is not known until the branch is resolved — its condition evaluated and its target address computed, usually in a later stage (EX in the classic five-stage IF–ID–EX–MEM–WB pipeline). Meanwhile the next sequential instructions have already entered the pipeline. If the branch is taken, they are on the wrong path and must be flushed. This is a control (branch) hazard.
graph LR
IF["IF: fetch"] --> ID["ID: decode"] --> EX["EX: execute / branch resolved here"] --> MEM["MEM"] --> WB["WB"]
Timing (branch taken, resolved in EX):
| Instruction | C1 | C2 | C3 | C4 | C5 | C6 |
|---|---|---|---|---|---|---|
| BEQ (branch) | IF | ID | EX: taken | MEM | WB | |
| next sequential i+1 | IF | ID → flushed | ||||
| next sequential i+2 | IF → flushed | |||||
| branch target | IF | ID | EX |
Two cycles are lost, so the branch penalty is 2 cycles. Deeper pipelines resolve branches later, so the penalty grows with depth.
Cost — example: 15 % of instructions are branches, penalty 2 cycles, ideal CPI = 1.
- Always stall: CPI = 1 + 0.15 × 2 = 1.30
- Predict not-taken, with 60 % of branches taken: CPI = 1 + (0.15 × 0.60 × 2) = 1.18
- Dynamic predictor with a BTB, 8 % mispredicted: CPI = 1 + (0.15 × 0.08 × 2) = 1.024
How to tackle the hazard
- Stall (freeze): stop fetching until the branch resolves — simple, but pays the full penalty on every branch.
- Resolve earlier: compare and compute the target in ID → penalty 1 cycle (always-stall CPI = 1 + 0.15 × 1 = 1.15 in the example).
- Static prediction: predict not-taken (keep fetching in sequence, flush only if taken), or backward-taken/forward-not-taken, which suits loops.
- Dynamic prediction: a branch history table of 2-bit saturating counters; a prediction flips only after two wrong guesses in a row, so a loop branch mispredicts about once per loop instead of twice.
- Branch target buffer (BTB): caches each branch's target address, so a predicted-taken branch fetches its target in the very next cycle.
- Delayed branch: the instruction in the slot after the branch always executes; the compiler fills it with useful, independent work (MIPS, SPARC).
- Remove branches: predicated or conditional-move instructions (ARM conditional execution, x86 CMOV) replace short if-else branches; loop unrolling cuts the number of branches.
Modern out-of-order CPUs combine prediction with speculative execution: instructions on the predicted path execute, but their results are held (reorder buffer) and committed only when the branch is confirmed; on a misprediction they are discarded and fetch restarts at the correct address.
stateDiagram-v2
state "Strongly taken 11" as ST
state "Weakly taken 10" as WT
state "Weakly not taken 01" as WN
state "Strongly not taken 00" as SN
ST --> ST: taken
ST --> WT: not taken
WT --> ST: taken
WT --> WN: not taken
WN --> WT: taken
WN --> SN: not taken
SN --> WN: taken
SN --> SN: not taken
Exam tip: say why (next address unknown until the branch resolves → wrong-path instructions flushed), quantify the penalty, then list remedies — stall, early resolution, prediction + BTB, delayed branch, predication.
Write classes to keep data of employees, projects and employee info of a company.
What are the bottlenecks of the greedy algorithm?
Write command i) to create a directory, ii) Delete folder with all its component, iii) Find common words in two files.
Write down the four conditions of deadlock.
Show the class diagram of a library management system.
Why dijkstra algorithm fails on a negative weighted graph?
Write down the port numbers of the following protocols (HTTPS, SSH, SMTP).
Design an ER diagram about a company having some projects, employees and departments.
Sign up free to see the model answers to written questions 8–15 · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
Explanations © ARBS Academy
Keep going with a free account · ফ্রি অ্যাকাউন্টে যা যা করতে পারবেন
13 more answers from this paper open with a free account.
এই প্রশ্নপত্রের আরও ১৩টি উত্তর, ধাপে ধাপে ব্যাখ্যাসহ, ফ্রি অ্যাকাউন্টে খুলবে।
Free account · 1 day of Premium free
Paper analysis · প্রশ্নপত্র বিশ্লেষণ
Its questions come from 14 syllabus chapters; the biggest is Theory of Computation & Compilers, in Algorithms, with 2 questions. Theory of Computation & Compilers is asked in 20 other papers too (2017–2026).
Its biggest topics · প্রধান টপিক
Questions in this paper, and how many of our other papers ask the topic
- Theory of Computation & Compilers Algorithms · 20 other papers, 2017–20262
- Language Basics & Syntax Programming · 122 other papers, 2015–20261
- OSI & TCP/IP Models Networking · 112 other papers, 2012–20261
- ER Model & Design Database · 101 other papers, 2015–20261
- Object-Oriented Programming Programming · 88 other papers, 2015–20261
- Control Flow & Loops Programming · 76 other papers, 2015–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 BUET M.Sc Admission exam (2018)?
- 15 written questions.
- Which subjects were asked most in the BUET M.Sc Admission exam (2018)?
- Algorithms (5), Programming (3) and Operating Systems (2), out of 15 questions.
- When was the BUET M.Sc Admission exam held?
- In 2018. The exact day isn't in our records.
- Where can I find the BUET M.Sc Admission exam (2018) question solution?
- On this page: 2 of the 15 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