BUET M.Sc Admission — Exam: 2018 (IICT)প্রশ্ন ও সমাধান
- Set by
- BUET M.Sc. Admission
- Exam date
- 2018
- Questions
- 15 (0 MCQ, 15 written)
- Exam guide
- M.Sc. admission (CSE and ICT) · এমএসসি ভর্তি (সিএসই ও আইসিটি)
- Digital Logic · ডিজিটাল লজিক 3
- Operating Systems · অপারেটিং সিস্টেম 3
- Programming · প্রোগ্রামিং 3
- Computer Architecture · কম্পিউটার আর্কিটেকচার 2
- Data Structures · ডেটা স্ট্রাকচার 2
- Database · ডেটাবেজ 1
- Networking · নেটওয়ার্কিং 1
Write a Program GCD of 2 number. What is operator overloading? Briefly explain.
Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
What is function pointer? Example of functions using pointer.
Model answer
A function pointer is a variable that stores the address of a function (its entry point in code memory) instead of the address of data. Because a function's address is known at compile time, a function pointer lets you call that function indirectly, pass it as an argument, store it in an array/struct, and decide at run time which function actually executes — the basis of callbacks, dispatch tables, and simple plugin-style designs.
Declaration syntax: return_type (*pointer_name)(parameter_types);
Example:
#include <stdio.h>
int add(int a, int b) { return a + b; }
int sub(int a, int b) { return a - b; }
int main(void) {
int (*fp)(int, int); /* declare a function pointer */
fp = add; /* point it at add() */
printf("Add: %d\n", fp(10, 4)); /* calls add() indirectly */
fp = sub; /* now point it at sub() */
printf("Sub: %d\n", fp(10, 4)); /* calls sub() indirectly */
return 0;
}
Output:
Add: 14
Sub: 6
Common real uses:
- Callback functions — e.g. the comparator passed to
qsort(base, n, size, cmp). - Dispatch/jump table — an array of function pointers indexed by a command code, replacing long
if-else/switchchains:
int (*ops[2])(int, int) = { add, sub };
printf("%d\n", ops[0](5, 3)); /* calls add(5,3) -> 8 */
- Implementing simple state machines and plugin-style, run-time-selectable behaviour.
Exam takeaway: a function pointer stores a code address, is declared as return_type (*name)(params), and is invoked exactly like the function itself (fp(args)) — enabling indirection and runtime selection of behaviour.
Using binary operator swap 1st 2 byte with last 2 byte of an integer?
Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
Write down the deadlock arising condition. What is preemptive multitasking?
Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
What is the best page size design in operating system? Explain.
Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
Temporal locality and spatial locality.
Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
Disk interleaving. Page size in demand paging.
Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
Do signed and unsigned number effect memory? Explain.
Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
Delete doubly linked list algorithm. Properties of generic algorithm.
Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
What is AVL tree and Complexity of recursive function?
Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
ACID property of DBMS. ER diagram of bus
Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
Difference between Switch and Bridge. NRZ for bit stream 00011101
Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
Difference between gate and circuit. How many bit store by 1 SR flip-flop?
Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
When the majority of 1 is 1, the output is 1. Find truth table and Boolean function.
Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
Using two full adder and make two, two bit comparator. ((CD)'+A)' +A+CD+AB simplofied the equation.
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 · M.Sc. admission (CSE and ICT) guide