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 Digital Logic (3), Operating Systems (3) and Programming (3). This page lists every question, with 1 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) · এমএসসি ভর্তি (সিএসই ও আইসিটি)
Write a program to find the GCD of 2 numbers. What is operator overloading? Briefly explain.
Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
What is a function pointer? Give an example of calling a function using a pointer.
Model answer
A function pointer is a pointer variable that stores the address of a function instead of the address of data. The function can then be called through the pointer, so the program can choose at run time which function to call, pass a function to another function (a callback), or keep functions in an array.
Declaration: return_type (*name)(parameter_types); for example int (*op)(int); means "op is a pointer to a function that takes an int and returns an int". The parentheses around *op are essential: int *op(int); declares a function returning int *, and assigning op = square; to it gives the gcc error lvalue required as left operand of assignment.
Example program
#include <stdio.h>
#include <stdlib.h>
int twice(int v) { return 2 * v; }
int square(int v) { return v * v; }
/* a function that receives another function through a pointer (callback) */
void applyAll(int data[], int n, int (*rule)(int))
{
for (int i = 0; i < n; i++)
data[i] = rule(data[i]);
}
int descending(const void *a, const void *b) /* comparator for qsort */
{
int x = *(const int *)a, y = *(const int *)b;
return (x < y) - (x > y);
}
int main(void)
{
int (*op)(int); /* pointer to a function taking int, returning int */
int (*table[2])(int) = { twice, square }; /* array of function pointers */
int vals[4] = { 3, -1, 5, 2 };
op = square; /* function name = its address (same as &square) */
printf("op(7) = %d, (*op)(7) = %d\n", op(7), (*op)(7));
printf("table[0](9) = %d, table[1](9) = %d\n", table[0](9), table[1](9));
applyAll(vals, 4, twice); /* pass twice() as an argument */
qsort(vals, 4, sizeof vals[0], descending);
printf("doubled and sorted:");
for (int i = 0; i < 4; i++)
printf(" %d", vals[i]);
printf("\n");
return 0;
}
Output:
op(7) = 49, (*op)(7) = 49
table[0](9) = 18, table[1](9) = 81
doubled and sorted: 10 6 4 -2
| Use | Code in the program | Result |
|---|---|---|
| assign | op = square; (same as op = □) |
op holds the address of square |
| call through pointer | op(7) or (*op)(7) |
both call square(7) = 49 |
| array of function pointers | table[0](9), table[1](9) |
18 and 81 (dispatch table: index selects the function) |
| callback argument | applyAll(vals, 4, twice) |
each element doubled: 6 -2 10 4 |
| library callback | qsort(..., descending) |
qsort calls descending to compare: 10 6 4 -2 |
The pointer's type must match the function's type: assigning descending (two const void * parameters) to op makes gcc report an incompatible pointer type (gcc 6: the warning assignment from incompatible pointer type; from gcc 14 it is an error by default), and calling it through op would be undefined behaviour.
Functions that use pointer parameters (call by address)
If "functions using pointer" means functions that take pointers as arguments: passing addresses lets a function read an array and send back more than one result.
#include <stdio.h>
/* a function that uses pointer parameters to return two results */
void sumAndAverage(const int *a, int n, int *sum, double *avg)
{
*sum = 0;
for (int i = 0; i < n; i++)
*sum += a[i]; /* a[i] is *(a + i) */
*avg = (double)*sum / n;
}
int main(void)
{
int score[] = { 70, 85, 92 };
int total;
double mean;
sumAndAverage(score, 3, &total, &mean);
printf("Total = %d, Average = %.2f\n", total, mean);
return 0;
}
Output:
Total = 247, Average = 82.33
Exam tip: declare as type (*fp)(params), assign a function name, call with fp(args); main uses are callbacks (e.g. the qsort comparator) and tables of functions.
Using binary operators, swap the first 2 bytes with the last 2 bytes of an integer.
Write down the deadlock arising condition. What is preemptive multitasking?
What is the best page size design in operating system? Explain.
Explain temporal locality and spatial locality.
Explain: (1) disk interleaving; (2) page size in demand paging.
Do signed and unsigned numbers affect memory? Explain.
Doubly linked list deletion algorithm. Properties of a generic algorithm.
What is an AVL tree? What is the complexity of a recursive function?
Explain the ACID properties of DBMS. Draw an ER diagram of a bus system.
Difference between Switch and Bridge. NRZ for the bit stream 00011101
Sign up free to see the model answers to written questions 3–12 · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
Difference between gate and circuit. How many bits can one SR flip-flop store?
When the majority of the inputs are 1, the output is 1. Find the truth table and the Boolean function.
Using two full adders, make a two-bit comparator. Simplify the equation ((CD)'+A)' + A + CD + AB.
Sign up free to see the model answers to written questions 13–15 · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
Explanations © ARBS Academy
Keep going with a free account · ফ্রি অ্যাকাউন্টে যা যা করতে পারবেন
14 more answers from this paper open with a free account.
এই প্রশ্নপত্রের আরও ১৪টি উত্তর, ধাপে ধাপে ব্যাখ্যাসহ, ফ্রি অ্যাকাউন্টে খুলবে।
Free account · 1 day of Premium free
Paper analysis · প্রশ্নপত্র বিশ্লেষণ
Its questions come from 11 syllabus chapters; Language Basics & Syntax, Boolean Algebra & K-Maps and Memory Management lead, with 2 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–20262
- Boolean Algebra & K-Maps Digital Logic · 50 other papers, 2016–20262
- Memory Management Operating Systems · 40 other papers, 2015–20262
- ER Model & Design Database · 101 other papers, 2015–20261
- Functions & Recursion Programming · 60 other papers, 2016–20261
- Processes & Threads Operating Systems · 55 other papers, 2011–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)?
- Digital Logic (3), Operating Systems (3) and Programming (3), 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: 1 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